Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/iximiuz/client-go-examples

Collection of mini-programs demonstrating Kubernetes client-go usage.
https://github.com/iximiuz/client-go-examples

client-go kubernetes kubernetes-api kubernetes-client

Last synced: about 2 months ago
JSON representation

Collection of mini-programs demonstrating Kubernetes client-go usage.

Awesome Lists containing this project

README

        

# Kubernetes client-go examples

```diff
! Support development of this project > patreon.com/iximiuz
```

A collection of mini-programs demonstrating various [client-go](https://github.com/kubernetes/client-go) use cases augmented by a [preconfigured online development environment](https://labs.iximiuz.com/playgrounds/k8s-client-go/). Inspired by [client-go/examples](https://github.com/kubernetes/client-go/tree/master/examples).

The intention is to test a (more or less) fresh version of Go and `k8s.io` packages against the [currently maintained Kubernetes release branches](https://kubernetes.io/releases/).

What is tested at the moment:

- `go 1.22.3`
- `k8s.io/client-go 0.27.14 0.28.10 0.29.5 0.30.1` (maintained release branches)
- `Kubernetes 1.27.13 1.28.9 1.29.4 1.30.0` (best-effort match with versions supported by `kind`)

## Setup

Most examples expect at least two Kubernetes clusters - `shared1` and `shared2`.

```bash
curl -sLS https://get.arkade.dev | sudo sh
arkade get kind kubectl

kind create cluster --name shared1
kind create cluster --name shared2
```

## Run

Oversimplified (for now):

```bash
cd
make test

# or from the root folder:
make test-all
```

## TODO

- Add more assertions to mini-programs
- Examples to be covered
- setting API request timeout
- configuring API request throttling
- `delete`
- `delete collection`
- `list` filtration
- `watch` filtration
- `informer` filtration
- `patch` with different strategies
- `Server Side Apply` (SSA)
- working with subresources
- `ownerReference` (one and many)
- optimistic locking
- https://stackoverflow.com/questions/56115197/how-to-idiomatically-fill-empty-fields-with-default-values-for-kubernetes-api-ob

## Contribution

Contributions are always welcome! Want to participate but don't know where to start? The TODO list above could give you some ideas.
Before jumping to the code, please create an issue describing the addition/change first. This will allow me to coordinate the effort
and make sure multiple people don't work on the same task.