client-go/examples
Arpit Agrawal f4a635a743 Update README.md
The Service Account Token link in the readme is broken and refers to a page that no longer exists.
In this PR I updated the correct link in the readme

Kubernetes-commit: 279a663f948337da156f544b74e41928ad66f9ef
2023-08-11 17:46:28 +05:30
..
create-update-delete-deployment Remove references to openstack and cinder 2022-08-08 16:01:59 -04:00
dynamic-create-update-delete-deployment Remove references to openstack and cinder 2022-08-08 16:01:59 -04:00
fake-client fix the fake client example: how to handle a race between the fake client and informer 2020-10-26 22:50:32 -07:00
in-cluster-client-configuration Update README.md 2023-08-11 17:46:28 +05:30
leader-election switch over k/k to use klog v2 2020-04-17 15:25:06 -04:00
out-of-cluster-client-configuration Remove references to openstack and cinder 2022-08-08 16:01:59 -04:00
workqueue unify worker num to workers 2021-08-09 10:48:53 +08:00
README.md client-go: remove reference to TPR in examples 2022-09-16 15:14:13 +01:00

client-go Examples

This directory contains examples that cover various use cases and functionality for client-go.

Auth plugins

Client configuration is typically loaded from kubeconfig files containing server and credential configuration. Several plugins for obtaining credentials from external sources are available, but are not loaded by default. To enable these plugins in your program, import them in your main package.

You can load all auth plugins:

import _ "k8s.io/client-go/plugin/pkg/client/auth"

Or you can load specific auth plugins:

import _ "k8s.io/client-go/plugin/pkg/client/auth/azure"
import _ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
import _ "k8s.io/client-go/plugin/pkg/client/auth/oidc"

Configuration

Basics

Advanced Concepts

  • Work queues: Create a hotloop-free controller with the rate-limited workqueue and the informer framework.
  • Custom Resource Definition (CRD): Register a custom resource type with the API, create/update/query this custom type, and write a controller that drives the cluster state based on the changes to the custom resources.
  • Leader election: Demonstrates the use of the leader election package, which can be used to implement HA controllers.

Testing