What is a Kubernetes client-go "clientset"?

1/22/2018

In the kubernetes go client, what is a clientset?

It is defined in multiple places.

  1. In the client-go package. https://github.com/kubernetes/client-go/blob/62b2cb756b8cea8fba00764ff123993eb44dbd48/kubernetes/clientset.go#L120

  2. In the kubernetes package https://github.com/kubernetes/kubernetes/blob/80e344644e2b6222296f2f03551a8d0273c7cbce/pkg/client/clientset_generated/internalclientset/clientset.go#L64

The documentation says the same thing for both of them:

Clientset contains the clients for groups. Each group has exactly one version included in a Clientset.

This is confusing. What is a group?

-- Charles Holbrow
kubernetes

1 Answer

1/22/2018

Every resource type in Kubernetes (Pods, Deployments, Services and so on) is a member of an API group. These logically "group" the different types. Some examples of groups are

  • core
  • extensions
  • batch
  • apps
  • authentication
  • autoscaling

Groups also contain versions. Versions allow developers to introduce breaking changes to APIs, and manage them as they do. Some examples of versions inside a group

  • core/v1
  • extensions/v1beta
  • apps/v1beta1
  • batch/v1, batch/v2alpha1 (notice the two versions inside the same group)
  • authentication/v1, authentication/v1beta1
  • autoscaling/v1, autoscaling/v2alpha1

So the client documentation is saying that it's creating a different client for every group.

-- Jose Armesto
Source: StackOverflow