README

client-go

Go clients for talking to a kubernetes cluster.

What's included
  • The kubernetes package contains the clientset to access Kubernetes API.
  • The discovery package is used to discover APIs supported by a Kubernetes API server.
  • The dynamic package contains a dynamic client that can perform generic operations on arbitrary Kubernetes API objects.
  • The transport package is used to set up auth and start a connection.
  • The tools/cache package is useful for writing controllers.
Releases

Each top-level folder (e.g., 1.4) contains a release of clients and their dependencies.

client-go has the same release cycle as the Kubernetes main repository. For example, in the 1.4 release cycle, the contents in 1.4/ folder are subjected to changes. Once 1.4 is released, new changes will go into the 1.5/ folder. We will make great efforts to not change the public interface of a version of the client once that version has been released. We may change the interface between versions. Old versions of the client will be retained for two release cycles.

How to get it

You can go get to get a release of client-go, e.g., go get k8s.io/client-go/1.4/... or go get k8s.io/client-go/1.4/kubernetes.

How to use it

If your application runs in a Pod in the cluster, please refer to the in-cluster example, otherwise please refer to the out-of-cluster example.

Dependency management

If your application depends on a package that client-go depends on, and you let the Go compiler find the dependency in GOPATH, you will end up with duplicated dependencies: one copy from the GOPATH, and one from the vendor folder of client-go. This will cause unexpected runtime error like flag redefinition, since the go compiler ends up importing both packages separately, even if they are exactly the same thing. If this happens, you can either

  • run godep restore (godep) in the client-go/1.4 folder, then remove the vendor folder of client-go. Then the packages in your GOPATH will be the only copy
  • or run godep save in your application folder to flatten all dependencies.
Reporting bugs

Please report bugs to the main Kubernetes repository.

Contributing code

Please send pull requests against the client packages in the Kubernetes main repository, and run the /staging/src/k8s.io/client-go/copy.sh script to update the staging area in the main repository. Changes in the staging area will be published to this repository every day.

Expand ▾ Collapse ▴

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
1.5
dynamic
Package dynamic provides a client interface to arbitrary Kubernetes APIs that exposes common high level operations and exposes common metadata.
Package dynamic provides a client interface to arbitrary Kubernetes APIs that exposes common high level operations and exposes common metadata.
kubernetes
This package has the automatically generated clientset.
This package has the automatically generated clientset.
kubernetes/fake
This package has the automatically generated fake clientset.
This package has the automatically generated fake clientset.
kubernetes/typed/apps/v1alpha1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
kubernetes/typed/apps/v1alpha1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
kubernetes/typed/authentication/v1beta1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
kubernetes/typed/authentication/v1beta1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
kubernetes/typed/authorization/v1beta1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
kubernetes/typed/authorization/v1beta1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
kubernetes/typed/autoscaling/v1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
kubernetes/typed/autoscaling/v1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
kubernetes/typed/batch/v1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
kubernetes/typed/batch/v1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
kubernetes/typed/certificates/v1alpha1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
kubernetes/typed/certificates/v1alpha1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
kubernetes/typed/core/v1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
kubernetes/typed/core/v1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
kubernetes/typed/extensions/v1beta1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
kubernetes/typed/extensions/v1beta1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
kubernetes/typed/policy/v1alpha1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
kubernetes/typed/policy/v1alpha1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
kubernetes/typed/rbac/v1alpha1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
kubernetes/typed/rbac/v1alpha1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
kubernetes/typed/storage/v1beta1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
kubernetes/typed/storage/v1beta1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
pkg/api
Package api contains the latest (or "internal") version of the Kubernetes API objects.
Package api contains the latest (or "internal") version of the Kubernetes API objects.
pkg/api/errors
Package errors provides detailed error types for api field validation.
Package errors provides detailed error types for api field validation.
pkg/api/install
Package install installs the v1 monolithic api, making it available as an option to all of the API encoding/decoding machinery.
Package install installs the v1 monolithic api, making it available as an option to all of the API encoding/decoding machinery.
pkg/api/meta
Package meta provides functions for retrieving API metadata from objects belonging to the Kubernetes API TODO: move everything in this file to pkg/api/rest
Package meta provides functions for retrieving API metadata from objects belonging to the Kubernetes API TODO: move everything in this file to pkg/api/rest
pkg/api/meta/metatypes
The types defined in this package are used by the meta package to represent the in-memory version of objects.
The types defined in this package are used by the meta package to represent the in-memory version of objects.
pkg/api/resource
Package resource is a generated protocol buffer package.
Package resource is a generated protocol buffer package.
pkg/api/testapi
Package testapi provides a helper for retrieving the KUBE_TEST_API environment variable.
Package testapi provides a helper for retrieving the KUBE_TEST_API environment variable.
pkg/api/unversioned
Package unversioned is a generated protocol buffer package.
Package unversioned is a generated protocol buffer package.
pkg/api/v1
Package v1 is the v1 version of the API.
Package v1 is the v1 version of the API.
pkg/apimachinery
Package apimachinery contains the generic API machinery code that is common to both server and clients.
Package apimachinery contains the generic API machinery code that is common to both server and clients.
pkg/apimachinery/announced
Package announced contains tools for announcing API group factories.
Package announced contains tools for announcing API group factories.
pkg/apimachinery/registered
Package to keep track of API Versions that can be registered and are enabled in api.Scheme.
Package to keep track of API Versions that can be registered and are enabled in api.Scheme.
pkg/apis/apps/install
Package install installs the apps API group, making it available as an option to all of the API encoding/decoding machinery.
Package install installs the apps API group, making it available as an option to all of the API encoding/decoding machinery.
pkg/apis/apps/v1alpha1
Package v1alpha1 is a generated protocol buffer package.
Package v1alpha1 is a generated protocol buffer package.
pkg/apis/authentication
+k8s:deepcopy-gen=package,register +groupName=authentication.k8s.io +k8s:openapi-gen=true
+k8s:deepcopy-gen=package,register +groupName=authentication.k8s.io +k8s:openapi-gen=true
pkg/apis/authentication/install
Package install installs the experimental API group, making it available as an option to all of the API encoding/decoding machinery.
Package install installs the experimental API group, making it available as an option to all of the API encoding/decoding machinery.
pkg/apis/authentication/v1beta1
+k8s:deepcopy-gen=package,register +k8s:conversion-gen=k8s.io/kubernetes/pkg/apis/authentication +groupName=authentication.k8s.io +k8s:openapi-gen=true Package v1beta1 is a generated protocol buffer package.
+k8s:deepcopy-gen=package,register +k8s:conversion-gen=k8s.io/kubernetes/pkg/apis/authentication +groupName=authentication.k8s.io +k8s:openapi-gen=true Package v1beta1 is a generated protocol buffer package.
pkg/apis/authorization
+groupName=authorization.k8s.io
+groupName=authorization.k8s.io
pkg/apis/authorization/install
Package install installs the experimental API group, making it available as an option to all of the API encoding/decoding machinery.
Package install installs the experimental API group, making it available as an option to all of the API encoding/decoding machinery.
pkg/apis/authorization/v1beta1
+groupName=authorization.k8s.io Package v1beta1 is a generated protocol buffer package.
+groupName=authorization.k8s.io Package v1beta1 is a generated protocol buffer package.
pkg/apis/autoscaling/install
Package install installs the experimental API group, making it available as an option to all of the API encoding/decoding machinery.
Package install installs the experimental API group, making it available as an option to all of the API encoding/decoding machinery.
pkg/apis/autoscaling/v1
Package v1 is a generated protocol buffer package.
Package v1 is a generated protocol buffer package.
pkg/apis/batch/install
Package install installs the batch API group, making it available as an option to all of the API encoding/decoding machinery.
Package install installs the batch API group, making it available as an option to all of the API encoding/decoding machinery.
pkg/apis/batch/v1
Package v1 is a generated protocol buffer package.
Package v1 is a generated protocol buffer package.
pkg/apis/batch/v2alpha1
Package v2alpha1 is a generated protocol buffer package.
Package v2alpha1 is a generated protocol buffer package.
pkg/apis/certificates
+groupName=certificates.k8s.io
+groupName=certificates.k8s.io
pkg/apis/certificates/install
Package install installs the certificates API group, making it available as an option to all of the API encoding/decoding machinery.
Package install installs the certificates API group, making it available as an option to all of the API encoding/decoding machinery.
pkg/apis/certificates/v1alpha1
+groupName=certificates.k8s.io Package v1alpha1 is a generated protocol buffer package.
+groupName=certificates.k8s.io Package v1alpha1 is a generated protocol buffer package.
pkg/apis/componentconfig/install
Package install installs the experimental API group, making it available as an option to all of the API encoding/decoding machinery.
Package install installs the experimental API group, making it available as an option to all of the API encoding/decoding machinery.
pkg/apis/extensions/install
Package install installs the experimental API group, making it available as an option to all of the API encoding/decoding machinery.
Package install installs the experimental API group, making it available as an option to all of the API encoding/decoding machinery.
pkg/apis/extensions/v1beta1
Package v1beta1 is a generated protocol buffer package.
Package v1beta1 is a generated protocol buffer package.
pkg/apis/imagepolicy/install
Package install installs the experimental API group, making it available as an option to all of the API encoding/decoding machinery.
Package install installs the experimental API group, making it available as an option to all of the API encoding/decoding machinery.
pkg/apis/imagepolicy/v1alpha1
+groupName=imagepolicy.k8s.io Package v1alpha1 is a generated protocol buffer package.
+groupName=imagepolicy.k8s.io Package v1alpha1 is a generated protocol buffer package.
pkg/apis/policy/install
Package install installs the experimental API group, making it available as an option to all of the API encoding/decoding machinery.
Package install installs the experimental API group, making it available as an option to all of the API encoding/decoding machinery.
pkg/apis/policy/v1alpha1
Package policy is for any kind of policy object.
Package policy is for any kind of policy object.
pkg/apis/rbac
+groupName=rbac.authorization.k8s.io
+groupName=rbac.authorization.k8s.io
pkg/apis/rbac/install
Package install installs the batch API group, making it available as an option to all of the API encoding/decoding machinery.
Package install installs the batch API group, making it available as an option to all of the API encoding/decoding machinery.
pkg/apis/rbac/v1alpha1
+groupName=rbac.authorization.k8s.io Package v1alpha1 is a generated protocol buffer package.
+groupName=rbac.authorization.k8s.io Package v1alpha1 is a generated protocol buffer package.
pkg/apis/storage
+k8s:deepcopy-gen=package,register +groupName=storage.k8s.io +g8k:openapi-gen=true
+k8s:deepcopy-gen=package,register +groupName=storage.k8s.io +g8k:openapi-gen=true
pkg/apis/storage/install
Package install installs the experimental API group, making it available as an option to all of the API encoding/decoding machinery.
Package install installs the experimental API group, making it available as an option to all of the API encoding/decoding machinery.
pkg/apis/storage/v1beta1
+k8s:deepcopy-gen=package,register +k8s:conversion-gen=k8s.io/kubernetes/pkg/apis/storage +groupName=storage.k8s.io +k8s:openapi-gen=true Package v1beta1 is a generated protocol buffer package.
+k8s:deepcopy-gen=package,register +k8s:conversion-gen=k8s.io/kubernetes/pkg/apis/storage +groupName=storage.k8s.io +k8s:openapi-gen=true Package v1beta1 is a generated protocol buffer package.
pkg/auth/user
Package user contains utilities for dealing with simple user exchange in the auth packages.
Package user contains utilities for dealing with simple user exchange in the auth packages.
pkg/conversion
Package conversion provides go object versioning.
Package conversion provides go object versioning.
pkg/conversion/queryparams
Package queryparams provides conversion from versioned runtime objects to URL query values
Package queryparams provides conversion from versioned runtime objects to URL query values
pkg/federation/apis/federation/v1beta1
+k8s:deepcopy-gen=package,register +k8s:conversion-gen=k8s.io/kubernetes/federation/apis/federation +k8s:openapi-gen=true Package v1beta1 is a generated protocol buffer package.
+k8s:deepcopy-gen=package,register +k8s:conversion-gen=k8s.io/kubernetes/federation/apis/federation +k8s:openapi-gen=true Package v1beta1 is a generated protocol buffer package.
pkg/fields
Package fields implements a simple field system, parsing and matching selectors with sets of fields.
Package fields implements a simple field system, parsing and matching selectors with sets of fields.
pkg/genericapiserver/openapi/common
package common holds shared codes and types between open API code generator and spec generator.
package common holds shared codes and types between open API code generator and spec generator.
pkg/kubelet/qos
package qos contains helper functions for quality of service.
package qos contains helper functions for quality of service.
pkg/kubelet/server/portforward
package portforward contains server-side logic for handling port forwarding requests.
package portforward contains server-side logic for handling port forwarding requests.
pkg/kubelet/types
Common types in the Kubelet.
Common types in the Kubelet.
pkg/labels
Package labels implements a simple label system, parsing and matching selectors with sets of labels.
Package labels implements a simple label system, parsing and matching selectors with sets of labels.
pkg/master/ports
Package ports defines ports used by various pieces of the kubernetes infrastructure.
Package ports defines ports used by various pieces of the kubernetes infrastructure.
pkg/runtime
Defines conversions between generic types and structs to map query strings to struct objects.
Defines conversions between generic types and structs to map query strings to struct objects.
pkg/runtime/serializer/protobuf
Package protobuf provides a Kubernetes serializer for the protobuf format.
Package protobuf provides a Kubernetes serializer for the protobuf format.
pkg/runtime/serializer/streaming
Package streaming implements encoder and decoder for streams of runtime.Objects over io.Writer/Readers.
Package streaming implements encoder and decoder for streams of runtime.Objects over io.Writer/Readers.
pkg/third_party/forked/golang/json
Package json is forked from the Go standard library to enable us to find the field of a struct that a given JSON key maps to.
Package json is forked from the Go standard library to enable us to find the field of a struct that a given JSON key maps to.
pkg/third_party/forked/golang/reflect
Package reflect is a fork of go's standard library reflection package, which allows for deep equal with equality functions defined.
Package reflect is a fork of go's standard library reflection package, which allows for deep equal with equality functions defined.
pkg/types
Package types implements various generic types used throughout kubernetes.
Package types implements various generic types used throughout kubernetes.
pkg/util
Package util implements various utility functions used in both testing and implementation of Kubernetes.
Package util implements various utility functions used in both testing and implementation of Kubernetes.
pkg/util/config
Package config provides utility objects for decoupling sources of configuration and the actual configuration state.
Package config provides utility objects for decoupling sources of configuration and the actual configuration state.
pkg/util/errors
Package errors implements various utility functions and types around errors.
Package errors implements various utility functions and types around errors.
pkg/util/framer
Package framer implements simple frame decoding techniques for an io.ReadCloser
Package framer implements simple frame decoding techniques for an io.ReadCloser
pkg/util/httpstream
Package httpstream adds multiplexed streaming support to HTTP requests and responses via connection upgrades.
Package httpstream adds multiplexed streaming support to HTTP requests and responses via connection upgrades.
pkg/util/intstr
Package intstr is a generated protocol buffer package.
Package intstr is a generated protocol buffer package.
pkg/util/labels
Package labels provides utilities to work with Kubernetes labels.
Package labels provides utilities to work with Kubernetes labels.
pkg/util/rand
Package rand provides utilities related to randomization.
Package rand provides utilities related to randomization.
pkg/util/sets
Package sets has auto-generated set types.
Package sets has auto-generated set types.
pkg/util/wait
Package wait provides tools for polling or listening for changes to a condition.
Package wait provides tools for polling or listening for changes to a condition.
pkg/version
Package version supplies version information collected at build time to kubernetes components.
Package version supplies version information collected at build time to kubernetes components.
pkg/watch
Package watch contains a generic watchable interface, and a fake for testing code that uses the watch interface.
Package watch contains a generic watchable interface, and a fake for testing code that uses the watch interface.
pkg/watch/versioned
Package versioned is a generated protocol buffer package.
Package versioned is a generated protocol buffer package.
tools/auth
Package auth defines a file format for holding authentication information needed by clients of Kubernetes.
Package auth defines a file format for holding authentication information needed by clients of Kubernetes.
tools/cache
Package cache is a client-side caching mechanism.
Package cache is a client-side caching mechanism.
tools/clientcmd
Package clientcmd provides one stop shopping for building a working client from a fixed config, from a .kubeconfig file, from command line flags, or from any merged combination.
Package clientcmd provides one stop shopping for building a working client from a fixed config, from a .kubeconfig file, from command line flags, or from any merged combination.
tools/metrics
Package metrics provides abstractions for registering which metrics to record.
Package metrics provides abstractions for registering which metrics to record.
tools/portforward
Package portforward adds support for SSH-like port forwarding from the client's local host to remote containers.
Package portforward adds support for SSH-like port forwarding from the client's local host to remote containers.
tools/record
Package record has all client logic for recording and reporting events.
Package record has all client logic for recording and reporting events.
examples