kubectl

package
v0.0.0-...-8b8728f Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Condition

type Condition struct {
	Type   string `json:"type"`
	Status string `json:"status"`
}

type Kubectl

type Kubectl struct {
	ClusterName string
	// contains filtered or unexported fields
}

func New

func New() Kubectl

New creates a new kubectl.Kubectl

func (Kubectl) Apply

func (k Kubectl) Apply(yamlFile string) error

Apply applies the given yaml file to the cluster

func (Kubectl) ApplyString

func (k Kubectl) ApplyString(yamlString string) error

ApplyString applies the given yaml string to the cluster

func (Kubectl) ApplyWithLabels

func (k Kubectl) ApplyWithLabels(yamlFile, label string) error

ApplyWithLabels applies the given yaml file to the cluster with the given labels

func (Kubectl) CreateFromString

func (k Kubectl) CreateFromString(yamlString string) error

CreateFromString creates a resource from the given yaml string

func (Kubectl) CreateNamespace

func (k Kubectl) CreateNamespace(ns string) error

CreateNamespace creates a namespace If the namespace already exists, it will return nil

func (Kubectl) Delete

func (k Kubectl) Delete(kind, name string) error

Delete deletes a resource based on the namespace, kind and the name

func (Kubectl) DeleteCRDs

func (k Kubectl) DeleteCRDs(crds []string) error

DeleteCRDs deletes the CRDs by given list of crds names

func (Kubectl) DeleteFromFile

func (k Kubectl) DeleteFromFile(yamlFile string) error

DeleteFromFile deletes a resource from the given yaml file

func (Kubectl) DeleteNamespace

func (k Kubectl) DeleteNamespace(namespaces ...string) error

DeleteNamespace deletes a namespace and waits for it to be removed completely.

func (Kubectl) DeleteNamespaceNoWait

func (k Kubectl) DeleteNamespaceNoWait(namespaces ...string) error

DeleteNamespaceNoWait deletes a namespace and returns immediately (without waiting for the namespace to be removed).

func (Kubectl) Describe

func (k Kubectl) Describe(kind, name string) (string, error)

Describe returns the description of a resource

func (Kubectl) Exec

func (k Kubectl) Exec(pod, container, command string) (string, error)

Exec executes a command in the pod or specific container

func (Kubectl) ForceDelete

func (k Kubectl) ForceDelete(kind, name string) error

ForceDelete deletes a resource by removing its finalizers

func (Kubectl) GetEvents

func (k Kubectl) GetEvents() (string, error)

GetEvents returns the events of a namespace

func (Kubectl) GetInternalIP

func (k Kubectl) GetInternalIP(label string) (string, error)

GetInternalIP returns the internal IP of a node

func (Kubectl) GetPods

func (k Kubectl) GetPods(args ...string) (string, error)

GetPods returns the pods of a namespace

func (Kubectl) GetSecret

func (k Kubectl) GetSecret(secret string) (string, error)

GetSecret returns the secret of a namespace

func (Kubectl) GetYAML

func (k Kubectl) GetYAML(kind, name string) (string, error)

GetYAML returns the yaml of a resource

func (Kubectl) Label

func (k Kubectl) Label(kind, name, labelKey, labelValue string) error

Label adds a label to the specified resource

func (Kubectl) Logs

func (k Kubectl) Logs(pod string, since *time.Duration) (string, error)

Logs returns the logs of a deployment

func (Kubectl) Patch

func (k Kubectl) Patch(kind, name, patchType, patch string) error

Patch patches a resource

func (Kubectl) Wait

func (k Kubectl) Wait(waitFor, resource string, timeout time.Duration) error

Wait waits for a specific condition on one or many resources

func (Kubectl) WaitNamespaceDeleted

func (k Kubectl) WaitNamespaceDeleted(ns string) error

WaitNamespaceDeleted waits for a namespace to be deleted

func (Kubectl) WithBinary

func (k Kubectl) WithBinary(binary string) Kubectl

WithBinary returns a new Kubectl with the binary set to the given value; if the value is "", the binary is set to "kubectl"

func (Kubectl) WithClusterName

func (k Kubectl) WithClusterName(name string) Kubectl

WithClusterName sets the cluster clusterName on this Kubectl

func (Kubectl) WithKubeconfig

func (k Kubectl) WithKubeconfig(kubeconfig string) Kubectl

WithKubeconfig returns a new Kubectl with kubeconfig set to the given value

func (Kubectl) WithNamespace

func (k Kubectl) WithNamespace(ns string) Kubectl

WithNamespace returns a new Kubectl with the namespace set to the given value

type Metadata

type Metadata struct {
	ResourceVersion string `json:"resourceVersion"`
}

type Resource

type Resource struct {
	Status Status `json:"status"`
}

type ResourceList

type ResourceList struct {
	APIVersion string        `json:"apiVersion"`
	Items      []interface{} `json:"items"`
	Kind       string        `json:"kind"`
	Metadata   Metadata      `json:"metadata"`
}

type Status

type Status struct {
	Conditions []Condition `json:"conditions"`
	Phase      string      `json:"phase"`
}

Jump to

Keyboard shortcuts

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