1
0
Fork 0
mirror of https://github.com/imjasonh/client-go2 synced 2026-07-11 10:29:39 +00:00
client-go2/README.md

38 lines
1.2 KiB
Markdown
Raw Normal View History

2021-11-13 07:25:55 -05:00
## Experimenting with `k8s.io/client-go` and Go generics
2021-09-09 12:29:21 -04:00
2021-12-15 12:18:41 -05:00
[![Build](https://github.com/imjasonh/client-go2/actions/workflows/build.yaml/badge.svg)](https://github.com/imjasonh/client-go2/actions/workflows/build.yaml)
This is an experimental type-parameter-aware client that wraps [`k8s.io/client-go/rest`](https://pkg.go.dev/k8s.io/client-go/rest), in [about 500 lines of mostly-vibe-coded Go](./generic/client.go).
2021-09-09 12:29:21 -04:00
## Features
- **Type-safe generic client** - Work with strongly-typed Kubernetes objects instead of `unstructured.Unstructured`
- **Zero code generation** - Uses Go generics instead of code generation
- **Full CRUD operations** - List, Get, Create, Update, Delete, and Patch support
- **Informer support** - Watch for changes with type-safe event handlers
- **Automatic GVR inference** - No need to manually specify GroupVersionResource for standard Kubernetes types
## Usage
See [the example](./main.go)
## Testing
Unit tests against a mock REST client:
2021-09-09 12:29:21 -04:00
```
make test
```
End-to-end tests against a real K8s cluster:
```
make e2e
2021-09-09 12:29:21 -04:00
```
# ⚠️ THIS IS AN EXPERIMENT
This is just for demo purposes.
2021-09-09 12:29:21 -04:00
The name `client-go2` is a placeholder, and a joke.