1
0
Fork 0
mirror of https://github.com/imjasonh/client-go2 synced 2026-07-11 02:22:02 +00:00
client-go2/README.md
2021-12-15 12:18:41 -05:00

39 lines
1.7 KiB
Markdown

## Experimenting with `k8s.io/client-go` and Go generics
[![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/dynamic`](https://pkg.go.dev/k8s.io/client-go/dynamic) _(...for now)_.
Until Go 1.18 is released, use [`gotip`](https://pkg.go.dev/golang.org/dl/gotip), or the recently released [Go 1.18 beta](https://go.dev/blog/go1.18beta1).
Assuming you've got a working kubeconfig (does `kubectl get pods` work?), you can run this code:
```
$ go1.18beta1 run ./
2021/12/15 12:08:11 LISTING PODS
2021/12/15 12:08:11 - coredns-558bd4d5db-hjs27
2021/12/15 12:08:11 - coredns-558bd4d5db-vhrtd
2021/12/15 12:08:11 - etcd-kind-control-plane
2021/12/15 12:08:11 - kindnet-c977m
2021/12/15 12:08:11 - kube-apiserver-kind-control-plane
2021/12/15 12:08:11 - kube-controller-manager-kind-control-plane
2021/12/15 12:08:11 - kube-proxy-fgpfd
2021/12/15 12:08:11 - kube-scheduler-kind-control-plane
I1215 12:08:11.086322 32526 shared_informer.go:240] Waiting for caches to sync for /v1, Resource=configmaps
2021/12/15 12:08:11 --> ADD kube-public/cluster-info
2021/12/15 12:08:11 --> ADD kube-system/extension-apiserver-authentication
2021/12/15 12:08:11 --> ADD tekton-pipelines/config-logging
...
2021/12/15 12:08:11 LISTING CONFIGMAPS
2021/12/15 12:08:11 - coredns
2021/12/15 12:08:11 - extension-apiserver-authentication
2021/12/15 12:08:11 - kube-proxy
2021/12/15 12:08:11 - kube-root-ca.crt
2021/12/15 12:08:11 - kubeadm-config
2021/12/15 12:08:11 - kubelet-config-1.21
```
# THIS IS AN EXPERIMENT
None of this is anywhere near set in stone.
The name `client-go2` is a placeholder, and a joke.