Documentation
¶
Index ¶
- Constants
- func CheckAPIHealthz(ctx context.Context, client rest.Interface) bool
- func CheckClusterVersion(client kubernetes.Interface, versionConstraint string) (bool, error)
- func CheckDaemonset(ctx context.Context, client kubernetes.Interface, namespace string, ...) (bool, error)
- func CheckDeployment(ctx context.Context, client kubernetes.Interface, namespace string, ...) (bool, error)
- func CheckPodReady(ctx context.Context, client kubernetes.Interface, namespace string, ...) (bool, error)
- func CheckPodReadyWithLabel(ctx context.Context, client kubernetes.Interface, namespace string, ...) (bool, error)
- func CheckPodWithPredicate(ctx context.Context, client kubernetes.Interface, namespace string, ...) (bool, error)
- func CheckStatefulSet(ctx context.Context, client kubernetes.Interface, namespace string, ...) (bool, error)
- func CheckVersion(version string, versionConstraint string) (bool, error)
- func CheckVersionOrDie(version string, versionConstraint string) bool
- func ClusterVersionIsBefore116(client kubernetes.Interface) bool
- func ClusterVersionIsBefore118(client kubernetes.Interface) bool
- func ClusterVersionIsBefore19(client kubernetes.Interface) bool
- func CreateKAResourceWithFile(ctx context.Context, client kubernetes.Interface, ...) error
- func CreateOrRetainConfigMap(ctx context.Context, client clientset.Interface, cm *corev1.ConfigMap, ...) error
- func CreateOrUpdateAPIService(ctx context.Context, client kubeaggregatorclientset.Interface, ...) error
- func CreateOrUpdateClusterRole(ctx context.Context, client clientset.Interface, clusterRole *rbac.ClusterRole) error
- func CreateOrUpdateClusterRoleBinding(ctx context.Context, client clientset.Interface, ...) error
- func CreateOrUpdateConfigMap(ctx context.Context, client clientset.Interface, cm *corev1.ConfigMap) error
- func CreateOrUpdateConfigMapFromFile(ctx context.Context, client clientset.Interface, cm *corev1.ConfigMap, ...) error
- func CreateOrUpdateCronJob(ctx context.Context, client clientset.Interface, cronjob *batchv1beta1.CronJob) error
- func CreateOrUpdateDaemonSet(ctx context.Context, client clientset.Interface, ds *apps.DaemonSet) error
- func CreateOrUpdateDeployment(ctx context.Context, client clientset.Interface, deploy *apps.Deployment) error
- func CreateOrUpdateDeploymentExtensionsV1beta1(ctx context.Context, client clientset.Interface, ...) error
- func CreateOrUpdateEndpoints(ctx context.Context, client clientset.Interface, ep *corev1.Endpoints) error
- func CreateOrUpdateIngress(ctx context.Context, client clientset.Interface, ...) error
- func CreateOrUpdateJob(ctx context.Context, client clientset.Interface, job *batchv1.Job) error
- func CreateOrUpdateMutatingWebhookConfiguration(ctx context.Context, client clientset.Interface, ...) error
- func CreateOrUpdateNamespace(ctx context.Context, client clientset.Interface, ns *corev1.Namespace) error
- func CreateOrUpdatePod(ctx context.Context, client clientset.Interface, pod *corev1.Pod) error
- func CreateOrUpdateRole(ctx context.Context, client clientset.Interface, role *rbac.Role) error
- func CreateOrUpdateRoleBinding(ctx context.Context, client clientset.Interface, roleBinding *rbac.RoleBinding) error
- func CreateOrUpdateSecret(ctx context.Context, client clientset.Interface, secret *corev1.Secret) error
- func CreateOrUpdateService(ctx context.Context, client clientset.Interface, svc *corev1.Service) error
- func CreateOrUpdateServiceAccount(ctx context.Context, client clientset.Interface, sa *corev1.ServiceAccount) error
- func CreateOrUpdateStatefulSet(ctx context.Context, client clientset.Interface, sts *apps.StatefulSet) error
- func CreateOrUpdateValidatingWebhookConfiguration(ctx context.Context, client clientset.Interface, ...) error
- func CreateResourceWiteContent(ctx context.Context, client kubernetes.Interface, content string, ...) error
- func CreateResourceWithDir(ctx context.Context, client kubernetes.Interface, pattern string, ...) error
- func CreateResourceWithFile(ctx context.Context, client kubernetes.Interface, filename string, ...) error
- func DeleteClusterRoleBinding(ctx context.Context, client clientset.Interface, crbName string) error
- func DeleteDaemonSetForeground(ctx context.Context, client clientset.Interface, namespace, name string) error
- func DeleteDeployment(ctx context.Context, client clientset.Interface, namespace string, ...) error
- func DeleteDeploymentForeground(ctx context.Context, client clientset.Interface, namespace, name string) error
- func DeleteReplicaSetApp(ctx context.Context, client clientset.Interface, options metav1.ListOptions) error
- func DeleteService(ctx context.Context, client clientset.Interface, namespace string, ...) error
- func DeleteServiceAccounts(ctx context.Context, client clientset.Interface, namespace string, ...) error
- func GetClientset(masterEndpoint string, token string, caCert []byte) (*kubernetes.Clientset, error)
- func GetClusterRoleBinding(ctx context.Context, client clientset.Interface, name string) (*rbac.ClusterRoleBinding, error)
- func GetClusterVersion(client kubernetes.Interface) (string, error)
- func GetNodeByMachineIP(ctx context.Context, client clientset.Interface, ip string) (*corev1.Node, error)
- func GetNodeIPV6Label(ip string) string
- func GetService(ctx context.Context, client clientset.Interface, namespace string, name string) (*corev1.Service, error)
- func GetServiceAccount(ctx context.Context, client clientset.Interface, namespace string, name string) (*corev1.ServiceAccount, error)
- func IsPodReady(pod *corev1.Pod) bool
- func MarkNode(ctx context.Context, client clientset.Interface, nodeName string, ...) error
- func PatchNode(ctx context.Context, client clientset.Interface, nodeName string, ...) error
- func PatchNodeOnce(ctx context.Context, client clientset.Interface, nodeName string, ...) func() (bool, error)
- func PullImageWithPod(ctx context.Context, clientset kubernetes.Interface, pod *corev1.Pod) error
- func RemoveNodeTaints(ctx context.Context, client clientset.Interface, nodeName string, ...) error
- type PlatformLabel
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 label in node. LabelHostname = "kubernetes.io/hostname" // LabelMachineIPV4 specifies the label in node. LabelMachineIPV4 PlatformLabel = "platform.tkestack.io/machine-ip" // LabelMachineIPV6Head specifies the label in node. LabelMachineIPV6Head PlatformLabel = "platform.tkestack.io/machine-ipv6-head" // LabelMachineIPV6Tail specifies the label in node. LabelMachineIPV6Tail PlatformLabel = "platform.tkestack.io/machine-ipv6-tail" // LabelASNForCilium specifies the label in node when enable Cilium. LabelASNCilium PlatformLabel = "infra.tce.io/as" // LabelSwitchIPForCilium specifies the label in node when enable Cilium. LabelSwitchIPCilium PlatformLabel = "infra.tce.io/switch-ip" )
Variables ¶
This section is empty.
Functions ¶
func CheckAPIHealthz ¶
CheckAPIHealthz check healthz
func CheckClusterVersion ¶ added in v1.3.1
func CheckClusterVersion(client kubernetes.Interface, versionConstraint string) (bool, error)
func CheckDaemonset ¶
func CheckDaemonset(ctx context.Context, 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(ctx context.Context, client kubernetes.Interface, namespace string, name string) (bool, error)
CheckDeployment check Deployment current replicas is equal to desired and all pods are running
func CheckPodReady ¶ added in v1.3.1
func CheckPodReady(ctx context.Context, client kubernetes.Interface, namespace string, option metav1.ListOptions) (bool, error)
CheckPodReady checks if the pod is ready.
func CheckPodReadyWithLabel ¶ added in v1.3.1
func CheckPodReadyWithLabel(ctx context.Context, client kubernetes.Interface, namespace string, labelSelector string) (bool, error)
CheckPodReadyWithLabel checks if the pod is ready with label.
func CheckPodWithPredicate ¶ added in v1.3.1
func CheckPodWithPredicate(ctx context.Context, client kubernetes.Interface, namespace string, option metav1.ListOptions, predicate func(*corev1.Pod) bool) (bool, error)
CheckPodWithPredicate check pod with specify predicate.
func CheckStatefulSet ¶
func CheckStatefulSet(ctx context.Context, client kubernetes.Interface, namespace string, name string) (bool, error)
CheckStatefulSet check StatefulSet current replicas is equal to desired and all pods are running
func CheckVersion ¶ added in v1.3.1
func CheckVersionOrDie ¶ added in v1.3.1
func ClusterVersionIsBefore116 ¶ added in v1.3.1
func ClusterVersionIsBefore116(client kubernetes.Interface) bool
func ClusterVersionIsBefore118 ¶ added in v1.6.0
func ClusterVersionIsBefore118(client kubernetes.Interface) bool
func ClusterVersionIsBefore19 ¶ added in v1.3.1
func ClusterVersionIsBefore19(client kubernetes.Interface) bool
func CreateKAResourceWithFile ¶ added in v1.3.1
func CreateKAResourceWithFile(ctx context.Context, client kubernetes.Interface, kaClient kubeaggregator.Interface, filename string, option interface{}) error
CreateKAResourceWithFile create k8s and kube-aggregator resource with file
func CreateOrRetainConfigMap ¶
func CreateOrRetainConfigMap(ctx context.Context, 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 CreateOrUpdateAPIService ¶ added in v1.3.1
func CreateOrUpdateAPIService(ctx context.Context, client kubeaggregatorclientset.Interface, as *apiregistrationv1.APIService) error
CreateOrUpdateAPIService creates a APIService if the target resource doesn't exist. If the resource exists already, this function will update the resource instead.
func CreateOrUpdateClusterRole ¶
func CreateOrUpdateClusterRole(ctx context.Context, 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(ctx context.Context, 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(ctx context.Context, client clientset.Interface, cm *corev1.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(ctx context.Context, client clientset.Interface, cm *corev1.ConfigMap, pattern string) error
CreateOrUpdateConfigMapFromFile like kubectl apply configmap --from-file
func CreateOrUpdateCronJob ¶
func CreateOrUpdateCronJob(ctx context.Context, 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(ctx context.Context, 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(ctx context.Context, 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(ctx context.Context, 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(ctx context.Context, client clientset.Interface, ep *corev1.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(ctx context.Context, 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 ¶ added in v1.2.5
func CreateOrUpdateMutatingWebhookConfiguration(ctx context.Context, client clientset.Interface, obj *admissionv1beta1.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 ¶
func CreateOrUpdateNamespace(ctx context.Context, client clientset.Interface, ns *corev1.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 CreateOrUpdatePod ¶ added in v1.3.1
CreateOrUpdateService creates a service 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(ctx context.Context, 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(ctx context.Context, client clientset.Interface, secret *corev1.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(ctx context.Context, client clientset.Interface, svc *corev1.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(ctx context.Context, 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(ctx context.Context, 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 CreateOrUpdateValidatingWebhookConfiguration ¶ added in v1.2.5
func CreateOrUpdateValidatingWebhookConfiguration(ctx context.Context, client clientset.Interface, obj *admissionv1beta1.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 CreateResourceWiteContent ¶ added in v1.4.0
func CreateResourceWithDir ¶
func CreateResourceWithDir(ctx context.Context, client kubernetes.Interface, pattern string, option interface{}) error
CreateResourceWithDir create k8s resource with dir
func CreateResourceWithFile ¶
func CreateResourceWithFile(ctx context.Context, client kubernetes.Interface, filename string, option interface{}) error
CreateResourceWithFile create k8s resource with file
func DeleteClusterRoleBinding ¶
func DeleteClusterRoleBinding(ctx context.Context, client clientset.Interface, crbName string) error
DeleteClusterRoleBinding delete a clusterrolebinding
func DeleteDaemonSetForeground ¶
func DeleteDaemonSetForeground(ctx context.Context, 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 DeleteDeploymentForeground ¶
func DeleteDeploymentForeground(ctx context.Context, 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(ctx context.Context, client clientset.Interface, options metav1.ListOptions) error
DeleteReplicaSetApp delete the replicaset and pod additionally for deployment app with extension group
func DeleteService ¶
func DeleteService(ctx context.Context, client clientset.Interface, namespace string, svcName string) error
DeleteService delete a service
func DeleteServiceAccounts ¶
func DeleteServiceAccounts(ctx context.Context, 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(ctx context.Context, client clientset.Interface, name string) (*rbac.ClusterRoleBinding, error)
GetClusterRoleBinding get a cluster role binding.
func GetClusterVersion ¶ added in v1.3.1
func GetClusterVersion(client kubernetes.Interface) (string, error)
func GetNodeByMachineIP ¶ added in v1.4.0
func GetNodeByMachineIP(ctx context.Context, client clientset.Interface, ip string) (*corev1.Node, error)
GetNodeByMachineIP get node by machine ip.
func GetNodeIPV6Label ¶ added in v1.6.0
GetNodeIPV6Label split ip v6 address to head and tail ensure lable value less than 63 character, since k8s lable doesn't support ":" so that replace to "a", then return the consolidated label string Todo: add more check and corner case handle here later
func GetService ¶
func GetService(ctx context.Context, client clientset.Interface, namespace string, name string) (*corev1.Service, error)
GetService get a service.
func GetServiceAccount ¶
func GetServiceAccount(ctx context.Context, client clientset.Interface, namespace string, name string) (*corev1.ServiceAccount, error)
GetServiceAccount get a service.
func IsPodReady ¶
IsPodReady returns true if a pod is ready; false otherwise.
func MarkNode ¶ added in v1.2.5
func MarkNode(ctx context.Context, client clientset.Interface, nodeName string, labels map[string]string, taints []corev1.Taint) error
MarkNode mark node by adding labels and taints
func PatchNode ¶
func PatchNode(ctx context.Context, client clientset.Interface, nodeName string, patchFn func(*corev1.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(ctx context.Context, 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.
func PullImageWithPod ¶ added in v1.3.1
PullImageWithPod pull image for pod
Types ¶
type PlatformLabel ¶ added in v1.4.0
type PlatformLabel string
PlatformLabel represents the type of platform.tkestack.io related label.