Documentation ¶
Index ¶
- Constants
- type Client
- func (c *Client) APIExtensionsClientset() *apiextensionclientset.Clientset
- func (c *Client) APIRegistrationClientset() *apiregistrationclientset.Clientset
- func (c *Client) Apply(m []byte) error
- func (c *Client) CheckForwardPodPort(namespace, name string, local, remote int) (bool, error)
- func (c *Client) CheckResourceCleanup(logger *logrus.Entry, exceptions map[string]map[string]bool, resource string, ...) (bool, error)
- func (c *Client) CleanupAPIGroupResources(exceptions map[string]map[string]bool, resource string, apiGroupPath []string) error
- func (c *Client) CleanupResources(exceptions map[string]map[string]bool) error
- func (c *Client) Clientset() *kubernetes.Clientset
- func (c *Client) CreateConfigMap(namespace, name string, data map[string]string, updateIfExists bool) (*corev1.ConfigMap, error)
- func (c *Client) CreateNamespace(namespace *corev1.Namespace, updateIfExists bool) (*corev1.Namespace, error)
- func (c *Client) CreateOrPatchRoleBinding(meta metav1.ObjectMeta, ...) (*rbacv1.RoleBinding, error)
- func (c *Client) CreateSecret(namespace, name string, secretType corev1.SecretType, data map[string][]byte, ...) (*corev1.Secret, error)
- func (c *Client) CreateSecretObject(secret *corev1.Secret, updateIfExists bool) (*corev1.Secret, error)
- func (c *Client) Curl(path string) (*rest.Result, error)
- func (c *Client) DeleteAPIService(name string) error
- func (c *Client) DeleteAPIServiceForcefully(name string) error
- func (c *Client) DeleteCRDForcefully(name string) error
- func (c *Client) DeleteConfigMap(namespace, name string) error
- func (c *Client) DeleteDeployment(namespace, name string) error
- func (c *Client) DeleteJob(namespace, name string) error
- func (c *Client) DeleteNamespace(name string) error
- func (c *Client) DeletePod(namespace, name string) error
- func (c *Client) DeletePodForcefully(namespace, name string) error
- func (c *Client) DeleteReplicaSet(namespace, name string) error
- func (c *Client) DeleteSecret(namespace, name string) error
- func (c *Client) DeleteService(namespace, name string) error
- func (c *Client) DeleteStatefulSet(namespace, name string) error
- func (c *Client) DiscoverAPIGroups() error
- func (c *Client) ForwardPodPort(namespace, name string, local, remote int) (chan struct{}, error)
- func (c *Client) GardenClientset() *gardenclientset.Clientset
- func (c *Client) GetAPIResourceList() []*metav1.APIResourceList
- func (c *Client) GetConfig() *rest.Config
- func (c *Client) GetConfigMap(namespace, name string) (*corev1.ConfigMap, error)
- func (c *Client) GetDeployment(namespace, name string) (*appsv1.Deployment, error)
- func (c *Client) GetJob(namespace, name string) (*batch_v1.Job, error)
- func (c *Client) GetNamespace(name string) (*corev1.Namespace, error)
- func (c *Client) GetPod(namespace, name string) (*corev1.Pod, error)
- func (c *Client) GetPodLogs(namespace, name string, podLogOptions *corev1.PodLogOptions) (*bytes.Buffer, error)
- func (c *Client) GetResourceAPIGroups() map[string][]string
- func (c *Client) GetSecret(namespace, name string) (*corev1.Secret, error)
- func (c *Client) GetService(namespace, name string) (*corev1.Service, error)
- func (c *Client) ListAPIServices(opts metav1.ListOptions) (*apiregistrationv1beta1.APIServiceList, error)
- func (c *Client) ListCRDs(opts metav1.ListOptions) (*apiextensionsv1beta1.CustomResourceDefinitionList, error)
- func (c *Client) ListDaemonSets(namespace string, opts metav1.ListOptions) (*appsv1.DaemonSetList, error)
- func (c *Client) ListDeployments(namespace string, listOptions metav1.ListOptions) (*appsv1.DeploymentList, error)
- func (c *Client) ListNamespaces(selector metav1.ListOptions) (*corev1.NamespaceList, error)
- func (c *Client) ListNodes(listOptions metav1.ListOptions) (*corev1.NodeList, error)
- func (c *Client) ListPods(namespace string, listOptions metav1.ListOptions) (*corev1.PodList, error)
- func (c *Client) ListReplicaSets(namespace string, listOptions metav1.ListOptions) (*appsv1.ReplicaSetList, error)
- func (c *Client) ListResources(absPath ...string) (unstructured.Unstructured, error)
- func (c *Client) ListRoleBindings(namespace string, selector metav1.ListOptions) (*rbacv1.RoleBindingList, error)
- func (c *Client) ListSecrets(namespace string, listOptions metav1.ListOptions) (*corev1.SecretList, error)
- func (c *Client) ListStatefulSets(namespace string, listOptions metav1.ListOptions) (*appsv1.StatefulSetList, error)
- func (c *Client) MachineClientset() *machineclientset.Clientset
- func (c *Client) MachineV1alpha1(verb, resource, namespace string) *rest.Request
- func (c *Client) PatchDeployment(namespace, name string, body []byte) (*appsv1.Deployment, error)
- func (c *Client) PatchNamespace(name string, body []byte) (*corev1.Namespace, error)
- func (c *Client) QueryVersion() (string, error)
- func (c *Client) RESTClient() rest.Interface
- func (c *Client) ScaleDeployment(namespace, name string, replicas int32) (*appsv1.Deployment, error)
- func (c *Client) SetClientset(clientset *kubernetes.Clientset)
- func (c *Client) SetConfig(config *rest.Config)
- func (c *Client) SetGardenClientset(client *gardenclientset.Clientset)
- func (c *Client) SetMachineClientset(client *machineclientset.Clientset)
- func (c *Client) SetRESTClient(client rest.Interface)
- func (c *Client) SetResourceAPIGroup(group string, path []string)
- func (c *Client) SetResourceAPIGroups(groups map[string][]string)
- func (c *Client) StrategicMergePatchDeployment(oldObj, newObj *appsv1.Deployment) (*appsv1.Deployment, error)
- func (c *Client) UpdateConfigMap(namespace, name string, data map[string]string) (*corev1.ConfigMap, error)
- func (c *Client) UpdateNamespace(namespace *corev1.Namespace) (*corev1.Namespace, error)
- func (c *Client) UpdateSecret(namespace, name string, secretType corev1.SecretType, data map[string][]byte) (*corev1.Secret, error)
- func (c *Client) UpdateSecretObject(secret *corev1.Secret) (*corev1.Secret, error)
- func (c *Client) Version() string
Constants ¶
const ( // CronJobs is a constant for a Kubernetes resource with the same name. CronJobs = "cronjobs" // CustomResourceDefinitions is a constant for a Kubernetes resource with the same name. CustomResourceDefinitions = "customresourcedefinitions" // DaemonSets is a constant for a Kubernetes resource with the same name. DaemonSets = "daemonsets" // Deployments is a constant for a Kubernetes resource with the same name. Deployments = "deployments" // Ingresses is a constant for a Kubernetes resource with the same name. Ingresses = "ingresses" // Jobs is a constant for a Kubernetes resource with the same name. Jobs = "jobs" // Namespaces is a constant for a Kubernetes resource with the same name. Namespaces = "namespaces" // PersistentVolumeClaims is a constant for a Kubernetes resource with the same name. PersistentVolumeClaims = "persistentvolumeclaims" // Pods is a constant for a Kubernetes resource with the same name. Pods = "pods" // ReplicaSets is a constant for a Kubernetes resource with the same name. ReplicaSets = "replicasets" // ReplicationControllers is a constant for a Kubernetes resource with the same name. ReplicationControllers = "replicationcontrollers" // Services is a constant for a Kubernetes resource with the same name. Services = "services" // StatefulSets is a constant for a Kubernetes resource with the same name. StatefulSets = "statefulsets" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a struct containing the configuration for the respective Kubernetes cluster, the collection of Kubernetes clients <Clientset> containing all REST clients for the built-in Kubernetes API groups, and the GardenClientset which is a REST clientset for the Garden API group. The RESTClient itself is a normal HTTP client for the respective Kubernetes cluster, allowing requests to arbitrary URLs. The version string contains only the major/minor part in the form <major>.<minor>.
func NewForConfig ¶
NewForConfig returns a new Kubernetes base client.
func (*Client) APIExtensionsClientset ¶
func (c *Client) APIExtensionsClientset() *apiextensionclientset.Clientset
APIExtensionsClientset will return the apiextensionsClientset attribute of the Client object.
func (*Client) APIRegistrationClientset ¶
func (c *Client) APIRegistrationClientset() *apiregistrationclientset.Clientset
APIRegistrationClientset will return the apiregistrationClientset attribute of the Client object.
func (*Client) Apply ¶
Apply is a function which does the same like `kubectl apply -f <file>`. It takes a bunch of manifests <m>, all concatenated in a byte slice, and sends them one after the other to the API server. If a resource already exists at the API server, it will update it. It returns an error as soon as the first error occurs.
func (*Client) CheckForwardPodPort ¶
CheckForwardPodPort tries to forward the <remote> port of the pod with name <name> in namespace <namespace> to the <local> port. If <local> equals zero, a free port will be chosen randomly. It returns true if the port forward connection has been established successfully or false otherwise.
func (*Client) CheckResourceCleanup ¶
func (c *Client) CheckResourceCleanup(logger *logrus.Entry, exceptions map[string]map[string]bool, resource string, apiGroupPath []string) (bool, error)
CheckResourceCleanup will check whether all resources except for those in the <exceptions> map have been deleted.
func (*Client) CleanupAPIGroupResources ¶
func (c *Client) CleanupAPIGroupResources(exceptions map[string]map[string]bool, resource string, apiGroupPath []string) error
CleanupAPIGroupResources will clean up all resources of a single API group.
func (*Client) CleanupResources ¶
CleanupResources will delete all resources except for those stored in the <exceptions> map.
func (*Client) Clientset ¶
func (c *Client) Clientset() *kubernetes.Clientset
Clientset will return the clientset attribute of the Client object.
func (*Client) CreateConfigMap ¶
func (c *Client) CreateConfigMap(namespace, name string, data map[string]string, updateIfExists bool) (*corev1.ConfigMap, error)
CreateConfigMap creates a new ConfigMap object.
func (*Client) CreateNamespace ¶
func (c *Client) CreateNamespace(namespace *corev1.Namespace, updateIfExists bool) (*corev1.Namespace, error)
CreateNamespace creates a new Namespace object.
func (*Client) CreateOrPatchRoleBinding ¶
func (c *Client) CreateOrPatchRoleBinding(meta metav1.ObjectMeta, transform func(*rbacv1.RoleBinding) *rbacv1.RoleBinding) (*rbacv1.RoleBinding, error)
CreateOrPatchRoleBinding either creates the object or patches the existing one with the strategic merge patch type.
func (*Client) CreateSecret ¶
func (c *Client) CreateSecret(namespace, name string, secretType corev1.SecretType, data map[string][]byte, updateIfExists bool) (*corev1.Secret, error)
CreateSecret creates a new Secret object.
func (*Client) CreateSecretObject ¶
func (c *Client) CreateSecretObject(secret *corev1.Secret, updateIfExists bool) (*corev1.Secret, error)
CreateSecretObject creates a new Secret object.
func (*Client) DeleteAPIService ¶
DeleteAPIService will gracefully delete an APIService with the given <name>.
func (*Client) DeleteAPIServiceForcefully ¶
DeleteAPIServiceForcefully will forcefully delete an APIService with the given <name>.
func (*Client) DeleteCRDForcefully ¶
DeleteCRDForcefully will forcefully delete a CRD with the given <name>.
func (*Client) DeleteConfigMap ¶
DeleteConfigMap deletes a ConfigMap object.
func (*Client) DeleteDeployment ¶
DeleteDeployment deletes a Deployment object.
func (*Client) DeleteNamespace ¶
DeleteNamespace deletes a namespace.
func (*Client) DeletePod ¶
DeletePod will delete a Pod with the given <name> in the given <namespace>.
func (*Client) DeletePodForcefully ¶
DeletePodForcefully will forcefully delete a Pod with the given <name> in the given <namespace>.
func (*Client) DeleteReplicaSet ¶
DeleteReplicaSet deletes a ReplicaSet object.
func (*Client) DeleteSecret ¶
DeleteSecret deletes an already existing Secret object.
func (*Client) DeleteService ¶
DeleteService deletes an already existing Service object.
func (*Client) DeleteStatefulSet ¶
DeleteStatefulSet deletes a StatefulSet object.
func (*Client) DiscoverAPIGroups ¶
DiscoverAPIGroups will fetch all Kubernetes server resources, i.e. all registered API groups and the associated resources.
func (*Client) ForwardPodPort ¶
ForwardPodPort tries to forward the <remote> port of the pod with name <name> in namespace <namespace> to the <local> port. If <local> equals zero, a free port will be chosen randomly. It returns the stop channel which must be closed when the port forward connection should be terminated.
func (*Client) GardenClientset ¶
func (c *Client) GardenClientset() *gardenclientset.Clientset
GardenClientset will return the gardenClientset attribute of the Client object.
func (*Client) GetAPIResourceList ¶
func (c *Client) GetAPIResourceList() []*metav1.APIResourceList
GetAPIResourceList will return the Kubernetes API resource list.
func (*Client) GetConfigMap ¶
GetConfigMap returns a ConfigMap object.
func (*Client) GetDeployment ¶
func (c *Client) GetDeployment(namespace, name string) (*appsv1.Deployment, error)
GetDeployment returns a Deployment object.
func (*Client) GetNamespace ¶
GetNamespace returns a Namespace object.
func (*Client) GetPod ¶
GetPod will return the Pod object for the given <name> in the given <namespace>.
func (*Client) GetPodLogs ¶
func (c *Client) GetPodLogs(namespace, name string, podLogOptions *corev1.PodLogOptions) (*bytes.Buffer, error)
GetPodLogs will get the logs of all containers within the Pod for the given <name> in the given <namespace> for the given <podLogOptions>.
func (*Client) GetResourceAPIGroups ¶
GetResourceAPIGroups will return the resourceAPIGroups attribute of the Client object.
func (*Client) GetService ¶
GetService returns the desired Service object.
func (*Client) ListAPIServices ¶
func (c *Client) ListAPIServices(opts metav1.ListOptions) (*apiregistrationv1beta1.APIServiceList, error)
ListAPIServices will list all the APIServices for the given <listOptions>.
func (*Client) ListCRDs ¶
func (c *Client) ListCRDs(opts metav1.ListOptions) (*apiextensionsv1beta1.CustomResourceDefinitionList, error)
ListCRDs will list all the CRDs for the given <listOptions>.
func (*Client) ListDaemonSets ¶
func (c *Client) ListDaemonSets(namespace string, opts metav1.ListOptions) (*appsv1.DaemonSetList, error)
ListDaemonSets returns the list of DaemonSets in the given namespace.
func (*Client) ListDeployments ¶
func (c *Client) ListDeployments(namespace string, listOptions metav1.ListOptions) (*appsv1.DeploymentList, error)
ListDeployments returns the list of Deployments in the given <namespace>.
func (*Client) ListNamespaces ¶
func (c *Client) ListNamespaces(selector metav1.ListOptions) (*corev1.NamespaceList, error)
ListNamespaces returns a list of namespaces. The selection can be restricted by passing a <selector>.
func (*Client) ListPods ¶
func (c *Client) ListPods(namespace string, listOptions metav1.ListOptions) (*corev1.PodList, error)
ListPods will list all the Pods in the given <namespace> for the given <listOptions>.
func (*Client) ListReplicaSets ¶
func (c *Client) ListReplicaSets(namespace string, listOptions metav1.ListOptions) (*appsv1.ReplicaSetList, error)
ListReplicaSets returns the list of ReplicaSets in the given <namespace>.
func (*Client) ListResources ¶
func (c *Client) ListResources(absPath ...string) (unstructured.Unstructured, error)
ListResources will return a list of Kubernetes resources as JSON byte slice.
func (*Client) ListRoleBindings ¶
func (c *Client) ListRoleBindings(namespace string, selector metav1.ListOptions) (*rbacv1.RoleBindingList, error)
ListRoleBindings returns a list of rolebindings in a given <namespace>. The selection can be restricted by passsing an <selector>.
func (*Client) ListSecrets ¶
func (c *Client) ListSecrets(namespace string, listOptions metav1.ListOptions) (*corev1.SecretList, error)
ListSecrets lists all Secrets in a given <namespace>.
func (*Client) ListStatefulSets ¶
func (c *Client) ListStatefulSets(namespace string, listOptions metav1.ListOptions) (*appsv1.StatefulSetList, error)
ListStatefulSets returns the list of StatefulSets in the given <namespace>.
func (*Client) MachineClientset ¶
func (c *Client) MachineClientset() *machineclientset.Clientset
MachineClientset will return the machineClientset attribute of the Client object.
func (*Client) MachineV1alpha1 ¶
MachineV1alpha1 creates a RESTClient request object for the given <verb> and the given <machineClassPlural>.
func (*Client) PatchDeployment ¶
PatchDeployment patches a Deployment object.
func (*Client) PatchNamespace ¶
PatchNamespace patches a Namespace object.
func (*Client) QueryVersion ¶
QueryVersion queries the version of the API server and returns the GitVersion (e.g., v1.11.2).
func (*Client) RESTClient ¶
RESTClient will return the restClient attribute of the Client object.
func (*Client) ScaleDeployment ¶
func (c *Client) ScaleDeployment(namespace, name string, replicas int32) (*appsv1.Deployment, error)
ScaleDeployment scales a Deployment object.
func (*Client) SetClientset ¶
func (c *Client) SetClientset(clientset *kubernetes.Clientset)
SetClientset will set the clientset attribute of the Client object.
func (*Client) SetGardenClientset ¶
func (c *Client) SetGardenClientset(client *gardenclientset.Clientset)
SetGardenClientset will set the gardenClientset attribute of the Client object.
func (*Client) SetMachineClientset ¶
func (c *Client) SetMachineClientset(client *machineclientset.Clientset)
SetMachineClientset will set the machineClientset attribute of the Client object.
func (*Client) SetRESTClient ¶
SetRESTClient will set the restClient attribute of the Client object.
func (*Client) SetResourceAPIGroup ¶
SetResourceAPIGroup sets the specified resource API group path.
func (*Client) SetResourceAPIGroups ¶
SetResourceAPIGroups set the resourceAPIGroups attribute of the Client object.
func (*Client) StrategicMergePatchDeployment ¶
func (c *Client) StrategicMergePatchDeployment(oldObj, newObj *appsv1.Deployment) (*appsv1.Deployment, error)
StrategicMergePatchDeployment performs a strategic merge patch on a Deployment object.
func (*Client) UpdateConfigMap ¶
func (c *Client) UpdateConfigMap(namespace, name string, data map[string]string) (*corev1.ConfigMap, error)
UpdateConfigMap updates an already existing ConfigMap object.
func (*Client) UpdateNamespace ¶
UpdateNamespace updates an already existing Namespace object.
func (*Client) UpdateSecret ¶
func (c *Client) UpdateSecret(namespace, name string, secretType corev1.SecretType, data map[string][]byte) (*corev1.Secret, error)
UpdateSecret updates an already existing Secret object.
func (*Client) UpdateSecretObject ¶
UpdateSecretObject updates an already existing Secret object.