apiclient

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2020 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 8 more Imports: 29 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// APICallRetryInterval defines how long should wait before retrying a failed API operation
	APICallRetryInterval = 500 * time.Millisecond
	// PatchNodeTimeout specifies how long should wait for applying the label and taint on the master before timing out
	PatchNodeTimeout = 2 * time.Minute
	// UpdateNodeTimeout specifies how long should wait for updating node with the initial remote configuration of kubelet before timing out
	UpdateNodeTimeout = 2 * time.Minute
	// LabelHostname specifies the lable in node.
	LabelHostname = "kubernetes.io/hostname"
)

Variables

This section is empty.

Functions

func CheckAPIHealthz

func CheckAPIHealthz(client rest.Interface) bool

CheckAPIHealthz check healthz

func CheckDaemonset

func CheckDaemonset(client kubernetes.Interface, namespace string, name string) (bool, error)

CheckDaemonset check daemonset current replicas is equal to desired and all pods are running

func CheckDeployment

func CheckDeployment(client kubernetes.Interface, namespace string, name string) (bool, error)

CheckDeployment check Deployment current replicas is equal to desired and all pods are running

func CheckStatefulSet

func CheckStatefulSet(client kubernetes.Interface, namespace string, name string) (bool, error)

CheckStatefulSet check StatefulSet current replicas is equal to desired and all pods are running

func CreateOrRetainConfigMap

func CreateOrRetainConfigMap(client clientset.Interface, cm *v1.ConfigMap, configMapName string) error

CreateOrRetainConfigMap creates a ConfigMap if the target resource doesn't exist. If the resource exists already, this function will retain the resource instead.

func CreateOrUpdateClusterRole

func CreateOrUpdateClusterRole(client clientset.Interface, clusterRole *rbac.ClusterRole) error

CreateOrUpdateClusterRole creates a ClusterRole if the target resource doesn't exist. If the resource exists already, this function will update the resource instead.

func CreateOrUpdateClusterRoleBinding

func CreateOrUpdateClusterRoleBinding(client clientset.Interface, clusterRoleBinding *rbac.ClusterRoleBinding) error

CreateOrUpdateClusterRoleBinding creates a ClusterRoleBinding if the target resource doesn't exist. If the resource exists already, this function will update the resource instead.

func CreateOrUpdateConfigMap

func CreateOrUpdateConfigMap(client clientset.Interface, cm *v1.ConfigMap) error

CreateOrUpdateConfigMap creates a ConfigMap if the target resource doesn't exist. If the resource exists already, this function will update the resource instead.

func CreateOrUpdateConfigMapFromFile

func CreateOrUpdateConfigMapFromFile(client clientset.Interface, cm *v1.ConfigMap, pattern string) error

CreateOrUpdateConfigMapFromFile like kubectl create configmap --from-file

func CreateOrUpdateCronJob

func CreateOrUpdateCronJob(client clientset.Interface, cronjob *batchv1beta1.CronJob) error

CreateOrUpdateCronJob creates a Job if the target resource doesn't exist. If the resource exists already, this function will update

func CreateOrUpdateDaemonSet

func CreateOrUpdateDaemonSet(client clientset.Interface, ds *apps.DaemonSet) error

CreateOrUpdateDaemonSet creates a DaemonSet if the target resource doesn't exist. If the resource exists already, this function will update the resource instead.

func CreateOrUpdateDeployment

func CreateOrUpdateDeployment(client clientset.Interface, deploy *apps.Deployment) error

CreateOrUpdateDeployment creates a Deployment if the target resource doesn't exist. If the resource exists already, this function will update the resource instead.

func CreateOrUpdateDeploymentExtensionsV1beta1

func CreateOrUpdateDeploymentExtensionsV1beta1(client clientset.Interface, deploy *extensionsv1beta1.Deployment) error

CreateOrUpdateDeploymentExtensionsV1beta1 creates a ExtensionsV1beta1 Deployment if the target resource doesn't exist. If the resource exists already, this function will update the resource instead.

func CreateOrUpdateEndpoints

func CreateOrUpdateEndpoints(client clientset.Interface, ep *v1.Endpoints) error

CreateOrUpdateEndpoints creates a Endpoints if the target resource doesn't exist. If the resource exists already, this function will update the resource instead.

func CreateOrUpdateIngress

func CreateOrUpdateIngress(client clientset.Interface, ing *extensionsv1beta1.Ingress) error

CreateOrUpdateIngress creates a Ingress if the target resource doesn't exist. If the resource exists already, this function will update the resource instead.

func CreateOrUpdateJob

func CreateOrUpdateJob(client clientset.Interface, job *batchv1.Job) error

CreateOrUpdateJob creates a Job if the target resource doesn't exist. If the resource exists already, this function will update

func CreateOrUpdateNamespace

func CreateOrUpdateNamespace(client clientset.Interface, ns *v1.Namespace) error

CreateOrUpdateNamespace creates a namespace if the target resource doesn't exist. If the resource exists already, this function will update the resource instead.

func CreateOrUpdateRole

func CreateOrUpdateRole(client clientset.Interface, role *rbac.Role) error

CreateOrUpdateRole creates a Role if the target resource doesn't exist. If the resource exists already, this function will update the resource instead.

func CreateOrUpdateRoleBinding

func CreateOrUpdateRoleBinding(client clientset.Interface, roleBinding *rbac.RoleBinding) error

CreateOrUpdateRoleBinding creates a RoleBinding if the target resource doesn't exist. If the resource exists already, this function will update the resource instead.

func CreateOrUpdateSecret

func CreateOrUpdateSecret(client clientset.Interface, secret *v1.Secret) error

CreateOrUpdateSecret creates a Secret if the target resource doesn't exist. If the resource exists already, this function will update the resource instead.

func CreateOrUpdateService

func CreateOrUpdateService(client clientset.Interface, svc *v1.Service) error

CreateOrUpdateService creates a service if the target resource doesn't exist. If the resource exists already, this function will update the resource instead.

func CreateOrUpdateServiceAccount

func CreateOrUpdateServiceAccount(client clientset.Interface, sa *v1.ServiceAccount) error

CreateOrUpdateServiceAccount creates a ServiceAccount if the target resource doesn't exist. If the resource exists already, this function will update the resource instead.

func CreateOrUpdateStatefulSet

func CreateOrUpdateStatefulSet(client clientset.Interface, sts *apps.StatefulSet) error

CreateOrUpdateStatefulSet creates a statefulSet if the target resource doesn't exist. If the resource exists already, this function will update the resource instead.

func CreateResourceWithDir

func CreateResourceWithDir(client kubernetes.Interface, pattern string, option interface{}) error

CreateResourceWithDir create k8s resource with dir

func CreateResourceWithFile

func CreateResourceWithFile(client kubernetes.Interface, filename string, option interface{}) error

CreateResourceWithFile create k8s resource with file

func DeleteClusterRoleBinding

func DeleteClusterRoleBinding(client clientset.Interface, crbName string) error

DeleteClusterRoleBinding delete a clusterrolebinding

func DeleteDaemonSetForeground

func DeleteDaemonSetForeground(client clientset.Interface, namespace, name string) error

DeleteDaemonSetForeground deletes the specified DaemonSet in foreground mode; i.e. it blocks until/makes sure all the managed Pods are deleted

func DeleteDeployment

func DeleteDeployment(client clientset.Interface, namespace string, deployName string, isExtensions bool, labelSelector metav1.LabelSelector) error

func DeleteDeploymentForeground

func DeleteDeploymentForeground(client clientset.Interface, namespace, name string) error

DeleteDeploymentForeground deletes the specified Deployment in foreground mode; i.e. it blocks until/makes sure all the managed Pods are deleted

func DeleteReplicaSetApp

func DeleteReplicaSetApp(client clientset.Interface, options metav1.ListOptions) error

DeleteReplicaSetApp delete the replicaset and pod additionally for deployment app with extension group

func DeleteService

func DeleteService(client clientset.Interface, namespace string, svcName string) error

DeleteService delete a service

func DeleteServiceAccounts

func DeleteServiceAccounts(client clientset.Interface, namespace string, svcAccountName string) error

DeleteServiceAccounts delete a serviceAccount

func GetClientset

func GetClientset(masterEndpoint string, token string, caCert []byte) (*kubernetes.Clientset, error)

GetClientset return clientset

func GetClusterRoleBinding

func GetClusterRoleBinding(client clientset.Interface, name string) (*rbac.ClusterRoleBinding, error)

GetClusterRoleBinding get a cluster role binding.

func GetPlatformClientset

func GetPlatformClientset(masterEndpoint string, token string, caCert []byte) (tkeclientset.Interface, error)

GetPlatformClientset return clientset

func GetService

func GetService(client clientset.Interface, namespace string, name string) (*v1.Service, error)

GetService get a service.

func GetServiceAccount

func GetServiceAccount(client clientset.Interface, namespace string, name string) (*v1.ServiceAccount, error)

GetServiceAccount get a service.

func IsPodReady

func IsPodReady(pod *corev1.Pod) bool

IsPodReady returns true if a pod is ready; false otherwise.

func PatchNode

func PatchNode(client clientset.Interface, nodeName string, patchFn func(*v1.Node)) error

PatchNode tries to patch a node using patchFn for the actual mutating logic. Retries are provided by the wait package.

func PatchNodeOnce

func PatchNodeOnce(client clientset.Interface, nodeName string, patchFn func(*v1.Node)) func() (bool, error)

PatchNodeOnce executes patchFn on the node object found by the node name. This is a condition function meant to be used with wait.Poll. false, nil implies it is safe to try again, an error indicates no more tries should be made and true indicates success.

Types

This section is empty.

Jump to

Keyboard shortcuts

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