k8s

package
v0.0.0-...-f45d039 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2020 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultRetries          = 5
	DefaultSleepSeconds     = 5
	DefaultTimeout          = 30
	K8sWrapTransportTimeout = 30
)
View Source
const (
	HostnameLabel             = "kubernetes.io/hostname"
	InternalAddressAnnotation = "zdnscloud.cn/internal-ip"
	ExternalAddressAnnotation = "zdnscloud.cn/external-ip"
)

Variables

This section is empty.

Functions

func ApplyK8sSystemJob

func ApplyK8sSystemJob(ctx context.Context, jobYaml string, k8sClient *kubernetes.Clientset, timeout int, addonUpdated bool) error

func CordonUncordon

func CordonUncordon(ctx context.Context, k8sClient *kubernetes.Clientset, nodeName string, cordoned bool) error

func DeleteConfigMap

func DeleteConfigMap(k8sClient *kubernetes.Clientset, configMapName string) error

func DeleteK8sSystemJob

func DeleteK8sSystemJob(jobYaml string, k8sClient *kubernetes.Clientset, timeout int) error

func DeleteNode

func DeleteNode(k8sClient *kubernetes.Clientset, nodeName, cloudProvider string) error

func DeletePods

func DeletePods(k8sClient *kubernetes.Clientset, podList *v1.PodList) error

func DoCreateFromTemplate

func DoCreateFromTemplate(cli client.Client, template string, templateConfig interface{}) error

func DoUpdateFromTemplate

func DoUpdateFromTemplate(cli client.Client, template string, templateConfig interface{}) error

func GetConfigMap

func GetConfigMap(k8sClient *kubernetes.Clientset, configMapName string) (*v1.ConfigMap, error)

func GetK8sClientFromConfig

func GetK8sClientFromConfig(kubeConfigPath string) (client.Client, error)

func GetK8sClientFromYaml

func GetK8sClientFromYaml(kubeConfig string) (client.Client, error)

func GetNode

func GetNode(k8sClient *kubernetes.Clientset, nodeName string) (*v1.Node, error)

func GetNodeList

func GetNodeList(k8sClient *kubernetes.Clientset) (*v1.NodeList, error)

func GetSecret

func GetSecret(k8sClient *kubernetes.Clientset, secretName string) (*v1.Secret, error)

func IsNodeReady

func IsNodeReady(node v1.Node) bool

func ListPodsByLabel

func ListPodsByLabel(k8sClient *kubernetes.Clientset, label string) (*v1.PodList, error)

func NewClient

func NewClient(kubeConfigPath string, k8sWrapTransport transport.WrapperFunc) (*kubernetes.Clientset, error)

func RemoveTaintFromNodeByKey

func RemoveTaintFromNodeByKey(ctx context.Context, k8sClient *kubernetes.Clientset, nodeName, taintKey string) error

func SetNodeAddressesAnnotations

func SetNodeAddressesAnnotations(node *v1.Node, internalAddress, externalAddress string)

func SyncNodeLabels

func SyncNodeLabels(node *v1.Node, toAddLabels, toDelLabels map[string]string)

func SyncNodeTaints

func SyncNodeTaints(node *v1.Node, toAddTaints, toDelTaints []string)

func UpdateClusterRoleBindingFromYaml

func UpdateClusterRoleBindingFromYaml(k8sClient *kubernetes.Clientset, clusterRoleBindingYaml string) error

func UpdateClusterRoleFromYaml

func UpdateClusterRoleFromYaml(k8sClient *kubernetes.Clientset, clusterRoleYaml string) error

func UpdateConfigMap

func UpdateConfigMap(k8sClient *kubernetes.Clientset, configYaml []byte, configMapName string) (bool, error)

func UpdatePodSecurityPolicyFromYaml

func UpdatePodSecurityPolicyFromYaml(k8sClient *kubernetes.Clientset, pspYaml string) error

func UpdateRoleBindingFromYaml

func UpdateRoleBindingFromYaml(k8sClient *kubernetes.Clientset, roleBindingYaml string) error

func UpdateRoleFromYaml

func UpdateRoleFromYaml(k8sClient *kubernetes.Clientset, roleYaml string) error

func UpdateSecret

func UpdateSecret(k8sClient *kubernetes.Clientset, secretDataMap map[string][]byte, secretName string) error

func UpdateServiceAccountFromYaml

func UpdateServiceAccountFromYaml(k8sClient *kubernetes.Clientset, serviceAccountYaml string) error

Types

type JobStatus

type JobStatus struct {
	Completed bool
	Created   bool
}

func GetK8sJobStatus

func GetK8sJobStatus(k8sClient *kubernetes.Clientset, name, namespace string) (JobStatus, error)

type WrapTransport

type WrapTransport func(rt http.RoundTripper) http.RoundTripper

Jump to

Keyboard shortcuts

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