kubectl

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2024 License: AGPL-3.0 Imports: 19 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package kubectl provides a kubectl-like interface for Kubernetes. Functions defined here should not make use of os/exec.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Kubectl

type Kubectl struct {
	kubernetes.Interface
	// contains filtered or unexported fields
}

Kubectl implements functionality of the Kubernetes "kubectl" tool.

func NewFromConfig

func NewFromConfig(kubeconfig []byte) (*Kubectl, error)

NewFromConfig returns a Kubectl client using the given kubeconfig.

func NewUninitialized

func NewUninitialized() *Kubectl

NewUninitialized returns an empty Kubectl client. Initialize needs to be called before the client is usable.

func (*Kubectl) AddNodeSelectorsToDeployment

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

AddNodeSelectorsToDeployment adds K8s selectors to the deployment, identified by name and namespace.

func (*Kubectl) AnnotateNode

func (k *Kubectl) AnnotateNode(ctx context.Context, nodeName, annotationKey, annotationValue string) error

AnnotateNode adds the provided annotations to the node, identified by name.

func (*Kubectl) ApplyCRD

func (k *Kubectl) ApplyCRD(ctx context.Context, rawCRD []byte) error

ApplyCRD updates the given CRD by parsing it, querying it's version from the cluster and finally updating it.

func (*Kubectl) CreateConfigMap

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

CreateConfigMap creates the provided configmap.

func (*Kubectl) GetCR

GetCR retrieves a Custom Resource given it's name and group version resource.

func (*Kubectl) GetConfigMap

func (k *Kubectl) GetConfigMap(ctx context.Context, namespace, name string) (*corev1.ConfigMap, error)

GetConfigMap returns a ConfigMap given it's name and namespace.

func (*Kubectl) GetNodes

func (k *Kubectl) GetNodes(ctx context.Context) ([]corev1.Node, error)

GetNodes returns all nodes in the cluster.

func (*Kubectl) Initialize

func (k *Kubectl) Initialize(kubeconfig []byte) error

Initialize sets sets all required fields so the Kubectl client can be used.

func (*Kubectl) KubernetesVersion

func (k *Kubectl) KubernetesVersion() (string, error)

KubernetesVersion returns the Kubernetes version of the cluster.

func (*Kubectl) ListAllNamespaces

func (k *Kubectl) ListAllNamespaces(ctx context.Context) (*corev1.NamespaceList, error)

ListAllNamespaces returns all namespaces in the cluster.

func (*Kubectl) ListCRDs

ListCRDs retrieves all custom resource definitions currently installed in the cluster.

func (*Kubectl) ListCRs

ListCRs retrieves all objects for a given CRD.

func (*Kubectl) PatchFirstNodePodCIDR

func (k *Kubectl) PatchFirstNodePodCIDR(ctx context.Context, firstNodePodCIDR string) error

PatchFirstNodePodCIDR patches the firstNodePodCIDR of the first control-plane node for Cilium.

func (*Kubectl) UpdateCR

UpdateCR updates a Custom Resource given it's and group version resource.

func (*Kubectl) UpdateConfigMap

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

UpdateConfigMap updates the given ConfigMap.

Jump to

Keyboard shortcuts

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