Categorygithub.com/yaklabs/k8s-client
modulepackage
0.1.0
Repository: https://github.com/yaklabs/k8s-client.git
Documentation: pkg.go.dev

# README

k8s-client GoDoc

k8s-client is a Kubernetes client for Go.

Notice

Master should not be considered stable. Please vendor a tagged version. I will be making breaking changes to the API. Also import paths have changed to github.com/bakins/k8s-client

Status

k8s-client should be considered alpha quality. The API is subject to change.

k8s-client does not have 100% coverage of the Kubenretes API, but supports the common operations. Submit an issue or PR for support of others.

Motivation

The "official" Kubernetes client for Go is part of the Kubernetes project proper and lives within the main Kubernetes repository. It also requires a rather large number of dependencies.

k8s-client is a small simple API client.

License

Apache 2 License

k8s-client also includes parts of the Kubernetes code that is also under the Apache 2 License.

Usage

See GoDoc for documentation.

Testing

To test the included Kubernetes http client, I use minikube to start a local cluster. Then I run kubectl proxy to proxy to the local cluster without authentication (this makes testing easier). Then:

cd http
go test -v

The tests will try to connect to Kubernetes at http://127.0.0.1:8001. This can be overriden using the K8S_SERVER environment value.

TODO

  • Mock client for testing
  • Better docs/examples
  • Support all the Kubernetes types and operations
  • Support watches

# Packages

Package http provides an HTTP client for kubernetes.
No description provided by the author

# Functions

Date returns the Time corresponding to the supplied parameters by wrapping time.Date.
IsNotFoundError can be used to check if the error was a not found error.
NewConfigMap creates a new ConfigMap struct.
NewDaemonSet creates a new DaemonSet struct.
NewDeployment creates a new Deployment struct.
NewHorizontalPodAutoscaler creates a new HorizontalPodAutoscaler struct.
NewIngress creates a new Ingress struct.
NewJob creates a new Job struct.
NewNamespace creates a new namespace struct.
NewObjectMeta creates a new ObjectMeta and initializes the given namespace, name & internal maps.
NewPodTemplateSpec creates a new PodTemplateSpec struct.
NewReplicaSet creates a new ReplicaSet struct.
NewSecret creates a new Secret struct.
NewService creates a new service struct.
NewServiceAccount creates a new ServiceAccount struct.
NewTypeMeta creates a new TypeMeta and initializes the given kind & apiVersion.
Now returns the current local time.
Unix returns the local time corresponding to the given Unix time by wrapping time.Unix.

# Constants

AffinityAnnotationKey represents the key of affinity data (json serialized) in the Annotations of a Pod.
CauseTypeFieldValueDuplicate is used to report collisions of values that must be unique (e.g.
CauseTypeFieldValueInvalid is used to report malformed values (e.g.
CauseTypeFieldValueNotFound is used to report failure to find a requested value (e.g.
CauseTypeFieldValueNotSupported is used to report valid (as per formatting rules) values that can not be handled (e.g.
CauseTypeFieldValueRequired is used to report required values that are not provided (e.g.
CauseTypeUnexpectedServerResponse is used to report when the server responded to the client without the expected return type.
No description provided by the author
No description provided by the author
PodFailed means that all containers in the pod have terminated, and at least one container has terminated in a failure (exited with a non-zero exit code or was stopped by the system).
PodPending means the pod has been accepted by the system, but one or more of the containers has not been started.
PodRunning means the pod has been bound to a node and all of the containers have been started.
PodSucceeded means that all containers in the pod have voluntarily terminated with a container exit code of 0, and the system is not going to restart any of these containers.
PodUnknown means that for some reason the state of the pod could not be obtained, typically due to an error in communicating with the host of the pod.
PullAlways means that kubelet always attempts to pull the latest image.
PullIfNotPresent means that kubelet pulls if the image isn't present on disk.
PullNever means that kubelet never pulls an image, but only uses a local image.
Kill all existing pods before creating new ones.
CPU, in cores.
Memory, in bytes.
Volume size, in bytes (e,g.
No description provided by the author
No description provided by the author
No description provided by the author
Replace the old RCs by new one using rolling update i.e gradually scale down the old RCs and scale up the new one.
ServiceAffinityClientIP is the Client IP based.
ServiceAffinityNone - no session affinity.
ServiceTypeClusterIP means a service will only be accessible inside the cluster, via the ClusterIP.
ServiceTypeExternalName means a service that does not have selectors.
ServiceTypeLoadBalancer means a service will be exposed via an external load balancer (if the cloud provider supports it), in addition to 'NodePort' type.
ServiceTypeNodePort means a service will be exposed on one port of every node, in addition to 'ClusterIP' type.
Values of Status.Status.
Values of Status.Status.
URISchemeHTTP means that the scheme used will be http://.
URISchemeHTTPS means that the scheme used will be https://.
WatchEvent.Type constants.
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Interfaces

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Type aliases

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author