kube

package
v1.0.1-0...-1280aca Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetKubeConfig

func GetKubeConfig() (*kubernetes.Clientset, error)

GetKubeConfig return kubernetes Clientset

func GetKubeConfigfromFile

func GetKubeConfigfromFile() (*kubernetes.Clientset, error)

GetKubeConfigfromFile return kubernetes Clientset

func GetKubev1alpha1Config

func GetKubev1alpha1Config() (*k8sv1alpha1.K8sV1alpha1Client, error)

GetKubev1alpha1Config return k8s v1alpha1 Clientset

Types

type Interface

type Interface interface {
	SetAnnotationOnPod(pod *kapi.Pod, key, value string) error
	SetAnnotationOnNode(node *kapi.Node, key, value string) error
	SetAnnotationOnNamespace(ns *kapi.Namespace, key, value string) error
	GetAnnotationsOnPod(namespace, name string) (map[string]string, error)
	GetPod(namespace, name string) (*kapi.Pod, error)
	GetPods(namespace string) (*kapi.PodList, error)
	GetPodsByLabels(namespace string, selector labels.Selector) (*kapi.PodList, error)
	GetNodes() (*kapi.NodeList, error)
	GetNode(name string) (*kapi.Node, error)
	GetService(namespace, name string) (*kapi.Service, error)
	GetEndpoints(namespace string) (*kapi.EndpointsList, error)
	GetNamespace(name string) (*kapi.Namespace, error)
	GetNamespaces() (*kapi.NamespaceList, error)
	GetNetworkPolicies(namespace string) (*kapisnetworking.NetworkPolicyList, error)
	GetCertManagerClient() (*cm.CertmanagerV1Client, error)
	GetSecret(namespace, name string) (*kapi.Secret, error)
	GetSecrets(namespace string) (*kapi.SecretList, error)
	GetCertificates(client *cm.CertmanagerV1Client, name string)
}

Interface represents the exported methods for dealing with getting/setting kubernetes resources

type Kube

type Kube struct {
	KClient kubernetes.Interface
}

Kube is the structure object upon which the Interface is implemented

func (*Kube) AppendAnnotationOnPod

func (k *Kube) AppendAnnotationOnPod(pod *kapi.Pod, key, value string) error

AppendAnnotationOnPod takes the pod object and key/value string pair to set it as an annotation

func (*Kube) GetAnnotationsOnPod

func (k *Kube) GetAnnotationsOnPod(namespace, name string) (map[string]string, error)

GetAnnotationsOnPod obtains the pod annotations from kubernetes apiserver, given the name and namespace

func (*Kube) GetCertManagerClient

func (k *Kube) GetCertManagerClient() (*cm.CertmanagerV1Client, error)

GetCertManagerClient returns a client for cert-manager

func (*Kube) GetCertificate

func (k *Kube) GetCertificate(client *cm.CertmanagerV1Client, namespace, name string) (*cmv1.Certificate, error)

func (*Kube) GetControlPlaneServiceIPRange

func (k *Kube) GetControlPlaneServiceIPRange() (kubeadmtypes.Networking, error)

GetControlPlaneServiceIPRange return the service IP

func (*Kube) GetEndpoints

func (k *Kube) GetEndpoints(namespace string) (*kapi.EndpointsList, error)

GetEndpoints returns all the Endpoint resources from kubernetes apiserver, given namespace

func (*Kube) GetNamespace

func (k *Kube) GetNamespace(name string) (*kapi.Namespace, error)

GetNamespace returns the Namespace resource from kubernetes apiserver, given its name

func (*Kube) GetNamespaces

func (k *Kube) GetNamespaces() (*kapi.NamespaceList, error)

GetNamespaces returns all Namespace resource from kubernetes apiserver

func (*Kube) GetNetworkPolicies

func (k *Kube) GetNetworkPolicies(namespace string) (*kapisnetworking.NetworkPolicyList, error)

GetNetworkPolicies returns all network policy objects from kubernetes

func (*Kube) GetNode

func (k *Kube) GetNode(name string) (*kapi.Node, error)

GetNode returns the Node resource from kubernetes apiserver, given its name

func (*Kube) GetNodes

func (k *Kube) GetNodes() (*kapi.NodeList, error)

GetNodes returns the list of all Node objects from kubernetes

func (*Kube) GetPod

func (k *Kube) GetPod(namespace, name string) (*kapi.Pod, error)

GetPod obtains the Pod resource from kubernetes apiserver, given the name and namespace

func (*Kube) GetPods

func (k *Kube) GetPods(namespace string) (*kapi.PodList, error)

GetPods obtains the Pod resource from kubernetes apiserver, given the name and namespace

func (*Kube) GetPodsByLabels

func (k *Kube) GetPodsByLabels(namespace string, selector labels.Selector) (*kapi.PodList, error)

GetPodsByLabels obtains the Pod resources from kubernetes apiserver, given the namespace and label

func (*Kube) GetSecret

func (k *Kube) GetSecret(namespace, name string) (*kapi.Secret, error)

GetSecret returns selected secret in the provided namespace

func (*Kube) GetSecrets

func (k *Kube) GetSecrets(namespace string) (*kapi.SecretList, error)

GetSecrets returns list of all secrets within the namespace

func (*Kube) GetService

func (k *Kube) GetService(namespace, name string) (*kapi.Service, error)

GetService returns the Service resource from kubernetes apiserver, given its name and namespace

func (*Kube) SetAnnotationOnNamespace

func (k *Kube) SetAnnotationOnNamespace(ns *kapi.Namespace, key,
	value string) error

SetAnnotationOnNamespace takes the Namespace object and key/value pair to set it as an annotation

func (*Kube) SetAnnotationOnNode

func (k *Kube) SetAnnotationOnNode(node *kapi.Node, key, value string) error

SetAnnotationOnNode takes the node object and key/value string pair to set it as an annotation

func (*Kube) SetAnnotationOnPod

func (k *Kube) SetAnnotationOnPod(pod *kapi.Pod, key, value string) error

SetAnnotationOnPod takes the pod object and key/value string pair to set it as an annotation

Jump to

Keyboard shortcuts

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