Documentation
¶
Index ¶
- Constants
- func AddNameSpaceLabel(kubeClient kubernetes.Interface, namespaceName string, ...) error
- func AddNodeLabel(kubeClient kubernetes.Interface, nodeName string, labels map[string]string) error
- func CheckNodeLabel(kubeClient *kubernetes.Clientset, nodeName string, labels map[string]string) (bool, error)
- func CompleteTemplate(strtmpl string, context interface{}) (string, error)
- func CreateOrDeleteResourceWithFile(client kubernetes.Interface, dynamicClient dynamic.Interface, strtmpl string, ...) error
- func CreateOrRetainConfigMap(client clientset.Interface, cm *corev1.ConfigMap, configMapName string) error
- func CreateOrUpdateCSIDriver(client clientset.Interface, csiDriver *storagev1.CSIDriver) error
- func CreateOrUpdateClusterRole(client clientset.Interface, clusterRole *rbac.ClusterRole) error
- func CreateOrUpdateClusterRoleBinding(client clientset.Interface, clusterRoleBinding *rbac.ClusterRoleBinding) error
- func CreateOrUpdateConfigMap(client clientset.Interface, cm *corev1.ConfigMap) error
- func CreateOrUpdateConfigMapFromFile(client clientset.Interface, cm *corev1.ConfigMap, pattern string) error
- func CreateOrUpdateCronJob(client clientset.Interface, cronjob *batchv1beta1.CronJob) error
- func CreateOrUpdateCustomResourceDefinition(client extensionSclientset.Interface, yaml string, option interface{}) error
- func CreateOrUpdateDaemonSet(client clientset.Interface, ds *apps.DaemonSet) error
- func CreateOrUpdateDeployment(client clientset.Interface, deploy *apps.Deployment) error
- func CreateOrUpdateDeploymentExtensionsV1beta1(client clientset.Interface, deploy *extensionsv1beta1.Deployment) error
- func CreateOrUpdateEndpoints(client clientset.Interface, ep *corev1.Endpoints) error
- func CreateOrUpdateIngress(client clientset.Interface, ing *extensionsv1beta1.Ingress) error
- func CreateOrUpdateJob(client clientset.Interface, job *batchv1.Job) error
- func CreateOrUpdateMutatingWebhookConfiguration(client clientset.Interface, obj *admissionv1.MutatingWebhookConfiguration) error
- func CreateOrUpdateNamespace(client clientset.Interface, ns *corev1.Namespace) error
- func CreateOrUpdatePodSecurityPolicy(client clientset.Interface, podSecurityPolicy *v1beta1.PodSecurityPolicy) error
- func CreateOrUpdateRole(client clientset.Interface, role *rbac.Role) error
- func CreateOrUpdateRoleBinding(client clientset.Interface, roleBinding *rbac.RoleBinding) error
- func CreateOrUpdateSecret(client clientset.Interface, secret *corev1.Secret) error
- func CreateOrUpdateService(client clientset.Interface, svc *corev1.Service) error
- func CreateOrUpdateServiceAccount(client clientset.Interface, sa *corev1.ServiceAccount) error
- func CreateOrUpdateStatefulSet(client clientset.Interface, sts *apps.StatefulSet) error
- func CreateOrUpdateStorageClass(client clientset.Interface, csiDriver *storagev1.StorageClass) error
- func CreateOrUpdateValidatingWebhookConfiguration(client clientset.Interface, obj *admissionv1.ValidatingWebhookConfiguration) error
- func CreateResourceWithFile(client kubernetes.Interface, yamlStr string, option interface{}) error
- func CustomConfig() string
- func DeleteCSIDriver(client clientset.Interface, csiDriver *storagev1.CSIDriver) error
- func DeleteClusterRole(client clientset.Interface, clusterRole *rbac.ClusterRole) error
- func DeleteClusterRoleBinding(client clientset.Interface, clusterRoleBinding *rbac.ClusterRoleBinding) error
- func DeleteConfigMap(client clientset.Interface, cm *corev1.ConfigMap) error
- func DeleteDaemonSet(client clientset.Interface, ds *apps.DaemonSet) error
- func DeleteDaemonSetForeground(client clientset.Interface, namespace, name string) error
- func DeleteDeployment(client clientset.Interface, namespace string, deployName string, ...) error
- func DeleteDeploymentForeground(client clientset.Interface, namespace, name string) error
- func DeleteJob(client clientset.Interface, job *batchv1.Job) error
- func DeleteMutatingMutatingWebhookConfigurations(client clientset.Interface, obj *admissionv1.MutatingWebhookConfiguration) error
- func DeleteNodeLabel(kubeClient *kubernetes.Clientset, nodeName string, labels map[string]string) error
- func DeletePodSecurityPolicy(client clientset.Interface, podSecurityPolicy *v1beta1.PodSecurityPolicy) error
- func DeleteReplicaSetApp(client clientset.Interface, options metav1.ListOptions) error
- func DeleteResourceWithFile(client kubernetes.Interface, yamlStr string, option interface{}) error
- func DeleteRole(client clientset.Interface, role *rbac.Role) error
- func DeleteRoleBinding(client clientset.Interface, roleBinding *rbac.RoleBinding) error
- func DeleteSecret(client clientset.Interface, secret *corev1.Secret) error
- func DeleteService(client clientset.Interface, svc *corev1.Service) error
- func DeleteServiceAccount(client clientset.Interface, sa *corev1.ServiceAccount) error
- func DeleteServiceAccounts(client clientset.Interface, namespace string, svcAccountName string) error
- func DeleteStorageClasses(client clientset.Interface, csiDriver *storagev1.StorageClass) error
- func GetAPIExtensionSclientset(kubeconfigFile string) (extensionSclientset.Interface, error)
- func GetClientSet(kubeconfigFile string) (*kubernetes.Clientset, error)
- func GetClusterInfo(kubeconfigFile string) (*api.Cluster, error)
- func GetClusterRoleBinding(client clientset.Interface, name string) (*rbac.ClusterRoleBinding, error)
- func GetInclusterClientSet(kubeConfigPath string) (*kubernetes.Clientset, error)
- func GetKubeConfig(kubeConfigPath string) (*restclient.Config, error)
- func GetNodeListStatus(nodes []corev1.Node) (readyNodes []string, notReadyNodes []string)
- func GetService(client clientset.Interface, namespace string, name string) (*corev1.Service, error)
- func GetServiceAccount(client clientset.Interface, namespace string, name string) (*corev1.ServiceAccount, error)
- func IsJobFinished(j *batchv1.Job) bool
- func IsOverK8sVersion(baseK8sVersion, k8sVersion string) (bool, error)
- func IsReadyNode(node *corev1.Node) bool
- func MarkNode(client clientset.Interface, nodeName string, labels map[string]string, ...) error
- func ParseString(strtmpl string, obj interface{}) ([]byte, error)
- func PatchNode(client clientset.Interface, nodeName string, patchFn func(*corev1.Node)) error
- func PatchNodeOnce(client clientset.Interface, nodeName string, patchFn func(*corev1.Node)) func() (bool, error)
Constants ¶
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 AddNameSpaceLabel ¶
func AddNodeLabel ¶
func CheckNodeLabel ¶
func CompleteTemplate ¶
CompleteTemplate complete templates with context
func CreateOrDeleteResourceWithFile ¶
func CreateOrDeleteResourceWithFile(client kubernetes.Interface, dynamicClient dynamic.Interface, strtmpl string, option map[string]interface{}, create bool) error
1. 推荐使用dynamicClient创建和删除资源 2. 需要替换的变量不在matadata中,可以不替换直接删除
func CreateOrRetainConfigMap ¶
func CreateOrRetainConfigMap(client clientset.Interface, cm *corev1.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 CreateOrUpdateCSIDriver ¶
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 ¶
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 *corev1.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 CreateOrUpdateCustomResourceDefinition ¶
func CreateOrUpdateCustomResourceDefinition(client extensionSclientset.Interface, yaml string, option interface{}) error
func CreateOrUpdateDaemonSet ¶
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 ¶
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 ¶
CreateOrUpdateJob creates a Job if the target resource doesn't exist. If the resource exists already, this function will update
func CreateOrUpdateMutatingWebhookConfiguration ¶
func CreateOrUpdateMutatingWebhookConfiguration(client clientset.Interface, obj *admissionv1.MutatingWebhookConfiguration) error
CreateOrUpdateMutatingWebhookConfiguration creates a MutatingWebhookConfigurations if the target resource doesn't exist. If the resource exists already, this function will update the resource instead.
func CreateOrUpdateNamespace ¶
CreateOrUpdateNamespace creates a namespace if the target resource doesn't exist. If the resource exists already, this function will update the resource instead.
func CreateOrUpdatePodSecurityPolicy ¶
func CreateOrUpdatePodSecurityPolicy(client clientset.Interface, podSecurityPolicy *v1beta1.PodSecurityPolicy) error
CreateOrUpdateIngress creates a podSecurityPolicy if the target resource doesn't exist. If the resource exists already, this function will update the resource instead.
func CreateOrUpdateRole ¶
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 ¶
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 ¶
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 *corev1.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 CreateOrUpdateStorageClass ¶
func CreateOrUpdateStorageClass(client clientset.Interface, csiDriver *storagev1.StorageClass) error
func CreateOrUpdateValidatingWebhookConfiguration ¶
func CreateOrUpdateValidatingWebhookConfiguration(client clientset.Interface, obj *admissionv1.ValidatingWebhookConfiguration) error
CreateOrUpdateValidatingWebhookConfiguration creates a ValidatingWebhookConfigurations if the target resource doesn't exist. If the resource exists already, this function will update the resource instead.
func CreateResourceWithFile ¶
func CreateResourceWithFile(client kubernetes.Interface, yamlStr string, option interface{}) error
CreateResourceWithFile create k8s resource with file
func CustomConfig ¶
func CustomConfig() string
func DeleteCSIDriver ¶
func DeleteClusterRole ¶
func DeleteClusterRole(client clientset.Interface, clusterRole *rbac.ClusterRole) error
func DeleteClusterRoleBinding ¶
func DeleteClusterRoleBinding(client clientset.Interface, clusterRoleBinding *rbac.ClusterRoleBinding) error
func DeleteDaemonSetForeground ¶
DeleteDaemonSetForeground deletes the specified DaemonSet in foreground mode; i.e. it blocks until/makes sure all the managed Pods are deleted
func DeleteDeployment ¶
func DeleteDeploymentForeground ¶
DeleteDeploymentForeground deletes the specified Deployment in foreground mode; i.e. it blocks until/makes sure all the managed Pods are deleted
func DeleteMutatingMutatingWebhookConfigurations ¶
func DeleteMutatingMutatingWebhookConfigurations(client clientset.Interface, obj *admissionv1.MutatingWebhookConfiguration) error
func DeleteNodeLabel ¶
func DeletePodSecurityPolicy ¶
func DeletePodSecurityPolicy(client clientset.Interface, podSecurityPolicy *v1beta1.PodSecurityPolicy) error
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 DeleteResourceWithFile ¶
func DeleteResourceWithFile(client kubernetes.Interface, yamlStr string, option interface{}) error
DeleteResourceWithFile create k8s resource with file
func DeleteRoleBinding ¶
func DeleteRoleBinding(client clientset.Interface, roleBinding *rbac.RoleBinding) error
func DeleteServiceAccount ¶
func DeleteServiceAccount(client clientset.Interface, sa *corev1.ServiceAccount) error
func DeleteServiceAccounts ¶
func DeleteServiceAccounts(client clientset.Interface, namespace string, svcAccountName string) error
DeleteServiceAccounts delete a serviceAccount
func DeleteStorageClasses ¶
func DeleteStorageClasses(client clientset.Interface, csiDriver *storagev1.StorageClass) error
func GetAPIExtensionSclientset ¶
func GetAPIExtensionSclientset(kubeconfigFile string) (extensionSclientset.Interface, error)
func GetClientSet ¶
func GetClientSet(kubeconfigFile string) (*kubernetes.Clientset, error)
func GetClusterRoleBinding ¶
func GetClusterRoleBinding(client clientset.Interface, name string) (*rbac.ClusterRoleBinding, error)
GetClusterRoleBinding get a cluster role binding.
func GetInclusterClientSet ¶
func GetInclusterClientSet(kubeConfigPath string) (*kubernetes.Clientset, error)
func GetKubeConfig ¶
func GetKubeConfig(kubeConfigPath string) (*restclient.Config, error)
func GetNodeListStatus ¶
func GetService ¶
GetService get a service.
func GetServiceAccount ¶
func GetServiceAccount(client clientset.Interface, namespace string, name string) (*corev1.ServiceAccount, error)
GetServiceAccount get a service.
func IsJobFinished ¶
func IsOverK8sVersion ¶
func IsReadyNode ¶
func MarkNode ¶
func MarkNode(client clientset.Interface, nodeName string, labels map[string]string, taints []corev1.Taint) error
MarkNode mark node by adding labels and taints
func ParseString ¶
ParseString validates and parses passed as argument template
func PatchNode ¶
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(*corev1.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.