kubectl

package
v2.2.0-pre Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2022 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrKubeconfigNotSet = errors.New("kubeconfig not set")

ErrKubeconfigNotSet is the error value returned by Kubectl.Apply when SetKubeconfig was not called first.

Functions

This section is empty.

Types

type Client

type Client interface {
	// ApplyOneObject applies a k8s resource similar to kubectl apply.
	ApplyOneObject(info *resource.Info, forceConflicts bool) error
	// GetObjects converts resources into prepared info fields for use in ApplyOneObject.
	GetObjects(resources kubernetes.Marshaler) ([]*resource.Info, error)
	CreateConfigMap(ctx context.Context, configMap corev1.ConfigMap) error
	AddTolerationsToDeployment(ctx context.Context, tolerations []corev1.Toleration, name string, namespace string) error
	AddNodeSelectorsToDeployment(ctx context.Context, selectors map[string]string, name string, namespace string) error
	// WaitForCRD waits for the given CRD to be established.
	WaitForCRD(ctx context.Context, crd string) error
}

Client wraps marshable k8s resources into resource.Info fields and applies them in a cluster.

type Kubectl

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

Kubectl implements kubernetes.Apply interface and acts like the Kubernetes "kubectl" tool.

func New

func New() *Kubectl

New creates a new kubectl using the real clientGenerator.

func (*Kubectl) AddNodeSelectorsToDeployment

func (k *Kubectl) AddNodeSelectorsToDeployment(ctx context.Context, selectors map[string]string, name string, namespace string) error

func (*Kubectl) AddTolerationsToDeployment

func (k *Kubectl) AddTolerationsToDeployment(ctx context.Context, tolerations []corev1.Toleration, name string, namespace string) error

func (*Kubectl) Apply

func (k *Kubectl) Apply(resources kubernetes.Marshaler, forceConflicts bool) error

Apply will apply the given resources using server-side-apply.

func (*Kubectl) CreateConfigMap

func (k *Kubectl) CreateConfigMap(ctx context.Context, configMap corev1.ConfigMap) error

func (*Kubectl) SetKubeconfig

func (k *Kubectl) SetKubeconfig(kubeconfig []byte)

SetKubeconfig will store the kubeconfig to generate Clients using the clientGenerator later.

func (*Kubectl) WaitForCRDs

func (k *Kubectl) WaitForCRDs(ctx context.Context, crds []string) error

WaitForCRD waits for a list of CRDs to be established.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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