client-go

module
v2.0.0-alpha.1+incompa... Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 20, 2016 License: Apache-2.0

README

client-go

Go clients for talking to a kubernetes cluster.

Table of Contents

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.
Versioning

client-go version numbers are unrelated to Kubernetes version numbers. Please see the compatibility matrix for the compatible Kubernetes clusters.

client-go follows semver. We will not make backwards-incompatible changes without incrementing the major version number. A change is backwards-incompatible either if it i) changes the public interfaces of client-go, or ii) makes client-go incompatible with otherwise supported versions of Kubernetes clusters.

We will create a new branch for each increment in the major version number or minor version number. We will create a new tag for each increment in the patch version number. See semver for definitions of major, minor, and patch.

The master branch will track the head in the main Kubernetes repo and accumulating changes. We will make a new client-go major/minor/patch version when:

  • A new major (very rare) or a new minor version is released in the Kubernetes main repository.
  • A feature or a bug fix in the master branch is popular and users want it in a stable branch or with a stable tag.
Compatibility: your code <-> client-go

client-go follows semver, so until the major version of client-go gets increased, your code will compile and will continue to work with explicitly supported versions of Kubernetes clusters.

Compatibility: client-go <-> Kubernetes clusters

client-go versions will be backwards compatible with many Kubernetes clusters. As we increment client-go versions, we will note which Kubernetes versions we expect them to work with.

We do not back-port new Kubernetes features into older clients. If you need a new feature, you are expected to upgrade to the new client. You can check out the CHANGELOG for notable changes.

Compatibility matrix
  • client-go/1.4 is compatible with Kubernetes 1.3 through 1.5; it includes all features provided by Kubernetes 1.4.
  • client-go/1.5 is compatible with Kubernetes 1.3 through 1.5; it includes all features provided by Kubernetes 1.4.
Why do the 1.4 and 1.5 branch contain top-level folder named after the version?

1.4 and 1.5 branch keep the top-level folders so they do not break the import lines of existing users. These top-level folders are deprecated and are removed from the master branch and future branches.

How to get it

If you use go get to get client-go, you will get the unstable master branch! You can git checkout a stable branch.

We recommend using a vendor tool, like godep, glide, or govendor to track a stable version of client-go.

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/ 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/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.

Directories

Path Synopsis
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.
examples
This package has the automatically generated clientset.
This package has the automatically generated clientset.
fake
This package has the automatically generated fake clientset.
This package has the automatically generated fake clientset.
typed/apps/v1beta1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
typed/apps/v1beta1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
typed/authentication/v1beta1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
typed/authentication/v1beta1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
typed/authorization/v1beta1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
typed/authorization/v1beta1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
typed/autoscaling/v1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
typed/autoscaling/v1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
typed/batch/v1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
typed/batch/v1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
typed/batch/v2alpha1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
typed/batch/v2alpha1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
typed/certificates/v1alpha1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
typed/certificates/v1alpha1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
typed/core/v1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
typed/core/v1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
typed/extensions/v1beta1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
typed/extensions/v1beta1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
typed/policy/v1alpha1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
typed/policy/v1alpha1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
typed/policy/v1beta1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
typed/policy/v1beta1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
typed/rbac/v1alpha1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
typed/rbac/v1alpha1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
typed/storage/v1beta1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
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.
api/errors
Package errors provides detailed error types for api field validation.
Package errors provides detailed error types for api field validation.
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.
api/meta
Package meta provides functions for retrieving API metadata from objects belonging to the Kubernetes API
Package meta provides functions for retrieving API metadata from objects belonging to the Kubernetes API
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.
api/resource
Package resource is a generated protocol buffer package.
Package resource is a generated protocol buffer package.
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.
api/unversioned
Package unversioned is a generated protocol buffer package.
Package unversioned is a generated protocol buffer package.
api/v1
Package v1 is the v1 version of the API.
Package v1 is the v1 version of the API.
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.
apimachinery/announced
Package announced contains tools for announcing API group factories.
Package announced contains tools for announcing API group factories.
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.
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.
apis/apps/v1beta1
Package v1beta1 is a generated protocol buffer package.
Package v1beta1 is a generated protocol buffer package.
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
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.
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 +k8s:defaulter-gen=TypeMeta
+k8s:deepcopy-gen=package,register +k8s:conversion-gen=k8s.io/kubernetes/pkg/apis/authentication +groupName=authentication.k8s.io +k8s:openapi-gen=true +k8s:defaulter-gen=TypeMeta
apis/authorization
+groupName=authorization.k8s.io
+groupName=authorization.k8s.io
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.
apis/authorization/v1beta1
+groupName=authorization.k8s.io
+groupName=authorization.k8s.io
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.
apis/autoscaling/v1
Package v1 is a generated protocol buffer package.
Package v1 is a generated protocol buffer package.
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.
apis/batch/v1
Package v1 is a generated protocol buffer package.
Package v1 is a generated protocol buffer package.
apis/batch/v2alpha1
Package v2alpha1 is a generated protocol buffer package.
Package v2alpha1 is a generated protocol buffer package.
apis/certificates
+groupName=certificates.k8s.io
+groupName=certificates.k8s.io
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.
apis/certificates/v1alpha1
+groupName=certificates.k8s.io
+groupName=certificates.k8s.io
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.
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.
apis/extensions/v1beta1
Package v1beta1 is a generated protocol buffer package.
Package v1beta1 is a generated protocol buffer package.
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.
apis/imagepolicy/v1alpha1
+groupName=imagepolicy.k8s.io
+groupName=imagepolicy.k8s.io
apis/kubeadm
+groupName=kubeadm.k8s.io
+groupName=kubeadm.k8s.io
apis/kubeadm/v1alpha1
+k8s:defaulter-gen=TypeMeta +groupName=kubeadm.k8s.io
+k8s:defaulter-gen=TypeMeta +groupName=kubeadm.k8s.io
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.
apis/policy/v1alpha1
Package policy is for any kind of policy object.
Package policy is for any kind of policy object.
apis/policy/v1beta1
Package policy is for any kind of policy object.
Package policy is for any kind of policy object.
apis/rbac
+groupName=rbac.authorization.k8s.io
+groupName=rbac.authorization.k8s.io
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.
apis/rbac/v1alpha1
+groupName=rbac.authorization.k8s.io
+groupName=rbac.authorization.k8s.io
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
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.
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 +k8s:defaulter-gen=TypeMeta
+k8s:deepcopy-gen=package,register +k8s:conversion-gen=k8s.io/kubernetes/pkg/apis/storage +groupName=storage.k8s.io +k8s:openapi-gen=true +k8s:defaulter-gen=TypeMeta
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.
conversion
Package conversion provides go object versioning.
Package conversion provides go object versioning.
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
federation/apis/federation/v1beta1
+k8s:deepcopy-gen=package,register +k8s:conversion-gen=k8s.io/kubernetes/federation/apis/federation +k8s:openapi-gen=true +k8s:defaulter-gen=TypeMeta
+k8s:deepcopy-gen=package,register +k8s:conversion-gen=k8s.io/kubernetes/federation/apis/federation +k8s:openapi-gen=true +k8s:defaulter-gen=TypeMeta
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.
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.
kubelet/qos
package qos contains helper functions for quality of service.
package qos contains helper functions for quality of service.
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.
kubelet/types
Common types in the Kubelet.
Common types in the Kubelet.
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.
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.
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.
runtime/serializer/protobuf
Package protobuf provides a Kubernetes serializer for the protobuf format.
Package protobuf provides a Kubernetes serializer for the protobuf format.
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.
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.
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.
third_party/forked/golang/template
This package is copied from Go library text/template.
This package is copied from Go library text/template.
types
Package types implements various generic types used throughout kubernetes.
Package types implements various generic types used throughout kubernetes.
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.
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.
util/errors
Package errors implements various utility functions and types around errors.
Package errors implements various utility functions and types around errors.
util/framer
Package framer implements simple frame decoding techniques for an io.ReadCloser
Package framer implements simple frame decoding techniques for an io.ReadCloser
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.
util/intstr
Package intstr is a generated protocol buffer package.
Package intstr is a generated protocol buffer package.
util/jsonpath
package jsonpath is a template engine using jsonpath syntax, which can be seen at http://goessner.net/articles/JsonPath/.
package jsonpath is a template engine using jsonpath syntax, which can be seen at http://goessner.net/articles/JsonPath/.
util/labels
Package labels provides utilities to work with Kubernetes labels.
Package labels provides utilities to work with Kubernetes labels.
util/rand
Package rand provides utilities related to randomization.
Package rand provides utilities related to randomization.
util/sets
Package sets has auto-generated set types.
Package sets has auto-generated set types.
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.
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.
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.
watch/versioned
Package versioned is a generated protocol buffer package.
Package versioned is a generated protocol buffer package.
plugin
fake
This is made a separate package and should only be imported by tests, because it imports testapi
This is made a separate package and should only be imported by tests, because it imports testapi
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.
cache
Package cache is a client-side caching mechanism.
Package cache is a client-side caching mechanism.
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.
metrics
Package metrics provides abstractions for registering which metrics to record.
Package metrics provides abstractions for registering which metrics to record.
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.
record
Package record has all client logic for recording and reporting events.
Package record has all client logic for recording and reporting events.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL