kubernetes

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2021 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ConvertJobNameBase is the prefix of the convert ServantJob name
	ConvertJobNameBase = "yurtctl-servant-convert"
	// RevertJobNameBase is the prefix of the revert ServantJob name
	RevertJobNameBase = "yurtctl-servant-revert"
)

Variables

View Source
var (
	// PropagationPolicy defines the propagation policy used when deleting a resource
	PropagationPolicy = metav1.DeletePropagationForeground
	// WaitServantJobTimeout specifies the timeout value of waiting for the ServantJob to be succeeded
	WaitServantJobTimeout = time.Minute * 2
	// CheckServantJobPeriod defines the time interval between two successive ServantJob statu's inspection
	CheckServantJobPeriod = time.Second * 10
	// ValidServerVersion contains all compatable server version
	// yurtctl only support Kubernetes 1.12+ - 1.16+ for now
	ValidServerVersions = []string{
		"1.12", "1.12+",
		"1.13", "1.13+",
		"1.14", "1.14+",
		"1.16", "1.16+",
		"1.18", "1.18+"}
)

Functions

func AnnotateNode

func AnnotateNode(cliSet *kubernetes.Clientset, node *v1.Node, key, val string) (*v1.Node, error)

AnnotateNode add a new annotation (<key>=<val>) to the given node

func CreateClusterRoleBindingFromYaml added in v0.3.0

func CreateClusterRoleBindingFromYaml(cliSet *kubernetes.Clientset, crbTmpl string) error

CreateClusterRoleBindingFromYaml creates the ClusterRoleBinding from the yaml template.

func CreateClusterRoleFromYaml added in v0.3.0

func CreateClusterRoleFromYaml(cliSet *kubernetes.Clientset, crTmpl string) error

CreateClusterRoleFromYaml creates the ClusterRole from the yaml template.

func CreateConfigMapFromYaml added in v0.3.0

func CreateConfigMapFromYaml(cliSet *kubernetes.Clientset, ns, cmTmpl string) error

CreateConfigMapFromYaml creates the ConfigMap from the yaml template.

func CreateDaemonSetFromYaml added in v0.3.0

func CreateDaemonSetFromYaml(cliSet *kubernetes.Clientset, dsTmpl string, context interface{}) error

CreateDaemonSetFromYaml creates the DaemonSet from the yaml template.

func CreateDeployFromYaml added in v0.3.0

func CreateDeployFromYaml(cliSet *kubernetes.Clientset, ns, dplyTmpl string, context interface{}) error

CreateDeployFromYaml creates the Deployment from the yaml template.

func CreateServiceAccountFromYaml added in v0.3.0

func CreateServiceAccountFromYaml(cliSet *kubernetes.Clientset, ns, saTmpl string) error

CreateServiceAccountFromYaml creates the ServiceAccount from the yaml template.

func CreateServiceFromYaml added in v0.3.0

func CreateServiceFromYaml(cliSet *kubernetes.Clientset, svcTmpl string) error

CreateServiceFromYaml creates the Service from the yaml template.

func GenClientSet

func GenClientSet(flags *pflag.FlagSet) (*kubernetes.Clientset, error)

GenClientSet generates the clientset based on command option, environment variable or the default kubeconfig file

func GetOrCreateJoinTokenString added in v0.3.0

func GetOrCreateJoinTokenString(cliSet *kubernetes.Clientset) (string, error)

func LabelNode

func LabelNode(cliSet *kubernetes.Clientset, node *v1.Node, key, val string) (*v1.Node, error)

LabelNode add a new label (<key>=<val>) to the given node

func PrepareKubeConfigPath added in v0.3.0

func PrepareKubeConfigPath(flags *pflag.FlagSet) (string, error)

PrepareKubeConfigPath returns the path of cluster kubeconfig file

func RunJobAndCleanup

func RunJobAndCleanup(cliSet *kubernetes.Clientset, job *batchv1.Job, timeout, period time.Duration) error

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

func RunServantJobs

func RunServantJobs(cliSet *kubernetes.Clientset, tmplCtx map[string]string, edgeNodeNames []string) error

RunServantJobs launchs servant jobs on specified edge nodes

func ValidateServerVersion

func ValidateServerVersion(cliSet *kubernetes.Clientset) error

ValidateServerVersion checks if the target server's version is supported

func YamlToObject

func YamlToObject(yamlContent []byte) (runtime.Object, error)

YamlToObject deserializes object in yaml format to a runtime.Object

Types

This section is empty.

Jump to

Keyboard shortcuts

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