k8s

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// PropagationPolicy defines the propagation policy used when deleting a resource
	PropagationPolicy = metav1.DeletePropagationBackground
	// CheckServantJobPeriod defines the time interval between two successive ServantJob statu's inspection
	CheckServantJobPeriod = time.Second * 10
)
View Source
var (
	DefaultEdgeFarmEdgeWorkerLabel = metav1.LabelSelector{
		MatchLabels: map[string]string{
			"openyurt.io/is-edge-worker": "true",
		},
	}

	DefaultEdgeNodeTaint = v1.Taint{
		Key:    "edgefarm.io",
		Value:  "",
		Effect: v1.TaintEffectNoSchedule,
	}
)

Functions

func AnnotateNodes added in v1.6.0

func AnnotateNodes(kubeconfig *rest.Config, nodes []v1.Node, annotations map[string]string) error

func Apply added in v1.1.0

func Apply(config *rest.Config, manifest string) error

func CheckNodeTaint

func CheckNodeTaint(node v1.Node, taint v1.Taint) bool

func CrdEstablished added in v1.6.1

func CrdEstablished(kubeconfig *rest.Config, name string) (bool, error)

func CrdExists added in v1.6.0

func CrdExists(kubeconfig *rest.Config, name string) (bool, error)

func CreateClusterRoleBindingFromYaml added in v1.3.0

func CreateClusterRoleBindingFromYaml(cliSet kubeclientset.Interface, crbTmpl string) error

CreateClusterRoleBindingFromYaml creates the ClusterRoleBinding from the yaml template.

func CreateClusterRoleFromYaml added in v1.3.0

func CreateClusterRoleFromYaml(cliSet kubeclientset.Interface, crTmpl string) error

CreateClusterRoleFromYaml creates the ClusterRole from the yaml template.

func CreateConfigMapFromYaml added in v1.3.0

func CreateConfigMapFromYaml(cliSet kubeclientset.Interface, ns, cmTmpl string) error

CreateConfigMapFromYaml creates the ConfigMap from the yaml template.

func CreateDeployFromYaml added in v1.3.0

func CreateDeployFromYaml(cliSet kubeclientset.Interface, ns, dplyTmpl string, ctx interface{}) error

CreateDeployFromYaml creates the Deployment from the yaml template.

func CreateEdgeNodepools added in v1.8.0

func CreateEdgeNodepools(kubeconfig *rest.Config) error

func CreateNamespace

func CreateNamespace(kubeconfig *rest.Config, name string) (*v1.Namespace, error)

func CreateNamespaceIfNotExist

func CreateNamespaceIfNotExist(kubeconfig *rest.Config, name string) (*v1.Namespace, error)

func CreateRoleBindingFromYaml added in v1.3.0

func CreateRoleBindingFromYaml(cliSet kubeclientset.Interface, crbTmpl string) error

CreateRoleBindingFromYaml creates the RoleBinding from the yaml template.

func CreateSecretFromYaml added in v1.3.0

func CreateSecretFromYaml(cliSet kubeclientset.Interface, ns, saTmpl string) error

CreateSecretFromYaml creates the Secret from the yaml template.

func CreateServiceAccountFromYaml added in v1.3.0

func CreateServiceAccountFromYaml(cliSet kubeclientset.Interface, ns, saTmpl string) error

CreateServiceAccountFromYaml creates the ServiceAccount from the yaml template.

func CreateServiceFromYaml added in v1.3.0

func CreateServiceFromYaml(cliSet kubeclientset.Interface, ns, svcTmpl string) error

CreateServiceFromYaml creates the Service from the yaml template.

func DeleteCluster added in v1.8.0

func DeleteCluster(name, namespace string, config *rest.Config) error

func DeleteClusterRole added in v1.3.0

func DeleteClusterRole(kubeconfig *rest.Config, name string) error

func DeleteClusterRoleBinding added in v1.3.0

func DeleteClusterRoleBinding(kubeconfig *rest.Config, name string) error

func DeleteNode added in v1.1.0

func DeleteNode(kubeconfig *rest.Config, name string) error

func DeleteNodepool added in v1.1.0

func DeleteNodepool(kubeconfig *rest.Config, name string) error

func DeleteServiceAccount added in v1.3.0

func DeleteServiceAccount(kubeconfig *rest.Config, name, namespace string) error

func DeploymentsReadyByLabels added in v1.8.0

func DeploymentsReadyByLabels(kubeconfig *rest.Config, namespace string, labels map[string]string) (bool, error)

func GetAllNodes added in v1.3.0

func GetAllNodes(kubeconfig *rest.Config) ([]v1.Node, error)

GetAllNodes returns a slice with all nodes

func GetClientset

func GetClientset(config *rest.Config) (*kubernetes.Clientset, error)

GetClientset returns a clientset for the current cluster.

func GetCloudNodes added in v1.8.0

func GetCloudNodes(kubeconfig *rest.Config) ([]v1.Node, error)

func GetCluster added in v1.8.0

func GetCluster(name, namespace string, config *rest.Config) (*unstructured.Unstructured, error)

func GetConfigFromKubeconfig added in v1.8.0

func GetConfigFromKubeconfig(kubeconfig string) *rest.Config

func GetConfigMapValue added in v1.3.0

func GetConfigMapValue(kubeconfig *rest.Config, namespace, name, key string) (string, error)

func GetDiscoveryClient added in v1.1.0

func GetDiscoveryClient(config *rest.Config) (*discovery.DiscoveryClient, error)

func GetDynamicClient

func GetDynamicClient(config *rest.Config) (dynamic.Interface, error)

GetClientset returns a clientset for the current cluster.

func GetEdgeNodes

func GetEdgeNodes(kubeconfig *rest.Config) ([]v1.Node, error)

func GetNamespace

func GetNamespace(kubeconfig *rest.Config, name string) (*v1.Namespace, error)

func GetNodes

func GetNodes(kubeconfig *rest.Config, selector *metav1.LabelSelector) ([]v1.Node, error)

GetNodes returns a slice of nodes matching the given selector.

func GetPods

func GetPods(kubeconfig *rest.Config, namespace string, selector string) ([]v1.Pod, error)

func GetSecret added in v1.8.0

func GetSecret(kubeconfig *rest.Config, name, namespace string) (*v1.Secret, error)

func HandleNodePool

func HandleNodePool(kubeconfig *rest.Config, node v1.Node) error

HandleNodePool creates a nodepool resource and create the corresponding label on the node

func LabelNodes added in v1.6.0

func LabelNodes(kubeconfig *rest.Config, nodes []v1.Node, labels map[string]string) error

func ListCRDs added in v1.6.0

func ListCRDs(kubeconfig *rest.Config) (*v1.CustomResourceDefinitionList, error)

func NodeExists added in v1.1.0

func NodeExists(kubeconfig *rest.Config, name string) (bool, error)

func NodePoolResourceExists added in v1.8.0

func NodePoolResourceExists(kubeconfig *rest.Config) (bool, error)

func PollForConfigMap added in v1.3.0

func PollForConfigMap(kubeconfig *rest.Config, namespace, name string, timeout time.Duration) error

func PrepareEdgeNodes

func PrepareEdgeNodes(kubeconfig *rest.Config) error

func PrintPodLog added in v1.3.0

func PrintPodLog(client kubeclientset.Interface, pod *corev1.Pod, w io.Writer) error

func RunJobAndCleanup added in v1.3.0

func RunJobAndCleanup(cliSet kubeclientset.Interface, job *batchv1.Job, timeout, period time.Duration, waitForTimeout bool) error

RunJobAndCleanup runs the job, wait for it to be complete, and delete it

func SecretValue added in v1.8.0

func SecretValue(secret *v1.Secret, key string) (string, error)

func TaintNodes

func TaintNodes(kubeconfig *rest.Config, nodes []v1.Node, taint v1.Taint) error

func UpdateConfigMapValue added in v1.3.0

func UpdateConfigMapValue(kubeconfig *rest.Config, namespace, name, key, value string) error

func ValidatePhysicalNodeName added in v1.1.0

func ValidatePhysicalNodeName(name string) error

ValidatePhysicalNodeName validates the given name not to be anything like regex `edgefarm-control-plane` or `edgefarm-worker.*`

func WaitForClusterDeleted added in v1.8.0

func WaitForClusterDeleted(name, namespace string, timeout time.Duration, config *rest.Config) (bool, error)

func WaitForCrdEstablished added in v1.8.0

func WaitForCrdEstablished(kubeconfig *rest.Config, name string, timeout time.Duration) (bool, error)

func WaitForDeploymentOrError added in v1.8.0

func WaitForDeploymentOrError(config *rest.Config, namespace string, labels map[string]string, timeout time.Duration) error

func WaitForDeploymentReady added in v1.8.0

func WaitForDeploymentReady(kubeconfig *rest.Config, namespace string, labels map[string]string, timeout time.Duration) (bool, error)

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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