Documentation ¶
Overview ¶
Package kubectl provides function for using the kubectl commands
Index ¶
- type Kubectl
- func (k *Kubectl) KubectlAnnotate(resource, resourceName, annotation string) error
- func (k *Kubectl) KubectlApply(manifest, namespace string) error
- func (k *Kubectl) KubectlApplyString(str, namespace string) error
- func (k *Kubectl) KubectlDeleteManifest(manifest, namespace string) error
- func (k *Kubectl) KubectlDeleteResource(resource, resourceName, namespace string) error
- func (k *Kubectl) KubectlDescribe(resource, resourceName, namespace string) error
- func (k *Kubectl) KubectlDrain(nodeName string) error
- func (k *Kubectl) KubectlExecEtcd(etcdPod, etcdctlCmd string) ([]byte, error)
- func (k *Kubectl) KubectlGet(resource, namespace string) ([]byte, error)
- func (k *Kubectl) KubectlGetEtcdPods(masterNodeName string) ([]byte, error)
- func (k *Kubectl) KubectlGetNodeNames() ([]byte, error)
- func (k *Kubectl) KubectlLabel(resource, resourceName, label string, overwrite bool) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Kubectl ¶
Kubeconfig - the kubeconfig of the cluster as a string when left empty, kuber uses default kubeconfig
func (*Kubectl) KubectlAnnotate ¶
KubectlAnnotate runs kubectl annotate in k.Directory, with the specified annotation on a specified resource and resource name example: kubectl annotate node node-1 node.longhorn.io/default-node-tags='["zone2"]' -> k.KubectlAnnotate("node","node-1","node.longhorn.io/default-node-tags='["zone2"]")
func (*Kubectl) KubectlApply ¶
KubectlApply runs kubectl apply in k.Directory directory, with specified manifest and specified namespace if namespace is empty string, the kubectl apply will not use -n flag example: kubectl apply -f test.yaml -> k.KubectlApply("test.yaml", "") example: kubectl apply -f test.yaml -n test -> k.KubectlApply("test.yaml", "test")
func (*Kubectl) KubectlApplyString ¶
KubectlApplyString runs kubectl apply in k.Directory directory, with specified string data and specified namespace if namespace is empty string, the kubectl apply will not use -n flag example: echo 'Kind: Pod ...' | kubectl apply -f - -> k.KubectlApply("Kind: Pod ...", "")
func (*Kubectl) KubectlDeleteManifest ¶
KubectlDeleteManifest runs kubectl delete in k.Directory, with specified manifest and specified namespace if namespace is empty string, the kubectl apply will not use -n flag example: kubectl delete -f test.yaml -> k.KubectlDelete("test.yaml", "") example: kubectl delete -f test.yaml -n test -> k.KubectlDelete("test.yaml", "test")
func (*Kubectl) KubectlDeleteResource ¶
KubectlDeleteResource runs kubectl delete in k.Directory, with specified resource, resource name and specified namespace if namespace is empty string, the kubectl apply will not use -n flag example: kubectl delete ns test -> k.KubectlDeleteResource("ns","test", "") example: kubectl delete pod busy-box -n test -> k.KubectlDeleteResource("pod","busy-box", "test")
func (*Kubectl) KubectlDescribe ¶
KubectlDescribe runs kubectl describe in k.Directory, on a specified resource, resource name and specified namespace if namespace is empty string, the kubectl apply will not use -n flag example: kubectl describe pod test -> k.KubectlDescribe("pod","test", "") example: kubectl describe pod busy-box -n test -> k.KubectlDescribe("pod","busy-box", "test")
func (*Kubectl) KubectlDrain ¶
KubectlDrain runs kubectl drain in k.Directory, on a specified node with flags --ignore-daemonsets --delete-emptydir-data example: kubectl drain node1 -> k.KubectlDrain("node1")
func (*Kubectl) KubectlExecEtcd ¶
func (*Kubectl) KubectlGet ¶
KubectlGet runs kubectl get in k.Directory, on a specified resource and specified namespace if namespace is empty string, the kubectl apply will not use -n flag example: kubectl get ns -> k.KubectlGet("ns", "") example: kubectl get pods -n test -> k.KubectlGet("pods", "test")
func (*Kubectl) KubectlGetEtcdPods ¶
getEtcdPods finds all etcd pods in cluster returns slice of pod names and nil if successful, nil and error otherwise
func (*Kubectl) KubectlGetNodeNames ¶
KubectlGetNodeNames will find a node names for a particular cluster return slice of node names and nil if successful, nil and error otherwise
func (*Kubectl) KubectlLabel ¶
KubectlLabel runs kubectl label in k.Directory, with the specified label on a specified resource and resource name example: kubectl label node node-1 label=value -> k.KubectlLabel("node","node-1","label=value")