k8s

package
v0.0.0-...-11a0874 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigMap

type ConfigMap interface {
	// GetConfigMap get ConfigMap from kubernetes with namespace and name
	GetConfigMap(namespace string, name string) (*corev1.ConfigMap, error)
	// CreateConfigMap create the given ConfigMap
	CreateConfigMap(namespace string, configMap *corev1.ConfigMap) error
	// UpdateConfigMap update the given ConfigMap
	UpdateConfigMap(namespace string, configMap *corev1.ConfigMap) error
	// CreateOrUpdateConfigMap if the ConfigMap Already exists, create it, otherwise update it
	CreateOrUpdateConfigMap(namespace string, np *corev1.ConfigMap) error
	// DeleteConfigMap delete ConfigMap from kubernetes with namespace and name
	DeleteConfigMap(namespace string, name string) error
	// ListConfigMaps get set of ConfigMaps on a given namespace
	ListConfigMaps(namespace string) (*corev1.ConfigMapList, error)
	CreateIfNotExistsConfigMap(namespace string, configMap *corev1.ConfigMap) error
}

ConfigMap the client that knows how to interact with kubernetes to manage them

func NewConfigMap

func NewConfigMap(kubeClient client.Client, logger logr.Logger) ConfigMap

NewConfigMap returns a new ConfigMap client.

type ConfigMapOption

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

ConfigMapOption is the configMap client interface implementation that using API calls to kubernetes.

func (*ConfigMapOption) CreateConfigMap

func (p *ConfigMapOption) CreateConfigMap(namespace string, configMap *corev1.ConfigMap) error

CreateConfigMap implement the ConfigMap.Interface

func (*ConfigMapOption) CreateIfNotExistsConfigMap

func (p *ConfigMapOption) CreateIfNotExistsConfigMap(namespace string, configMap *corev1.ConfigMap) error

CreateIfNotExistsConfigMap implement the ConfigMap.Interface

func (*ConfigMapOption) CreateOrUpdateConfigMap

func (p *ConfigMapOption) CreateOrUpdateConfigMap(namespace string, configMap *corev1.ConfigMap) error

CreateOrUpdateConfigMap implement the ConfigMap.Interface

func (*ConfigMapOption) DeleteConfigMap

func (p *ConfigMapOption) DeleteConfigMap(namespace string, name string) error

DeleteConfigMap implement the ConfigMap.Interface

func (*ConfigMapOption) GetConfigMap

func (p *ConfigMapOption) GetConfigMap(namespace string, name string) (*corev1.ConfigMap, error)

GetConfigMap implement the ConfigMap.Interface

func (*ConfigMapOption) ListConfigMaps

func (p *ConfigMapOption) ListConfigMaps(namespace string) (*corev1.ConfigMapList, error)

ListConfigMaps implement the ConfigMap.Interface

func (*ConfigMapOption) UpdateConfigMap

func (p *ConfigMapOption) UpdateConfigMap(namespace string, configMap *corev1.ConfigMap) error

UpdateConfigMap implement the ConfigMap.Interface

type Deployment

type Deployment interface {
	// GetDeployment get deployment from kubernetes with namespace and name
	GetDeployment(namespace, name string) (*appsv1.Deployment, error)
	// GetDeploymentPods will retrieve the pods managed by a given deployment
	GetDeploymentPods(namespace, name string) (*corev1.PodList, error)
	// CreateDeployment will create the given deployment
	CreateDeployment(namespace string, deployment *appsv1.Deployment) error
	// UpdateDeployment will update the given deployment
	UpdateDeployment(namespace string, deployment *appsv1.Deployment) error
	// CreateOrUpdateDeployment will update the given deployment or create it if does not exist
	CreateOrUpdateDeployment(namespace string, deployment *appsv1.Deployment) error
	// DeleteDeployment will delete the given deployment
	DeleteDeployment(namespace string, name string) error
	// ListDeployments get set of deployment on a given namespace
	ListDeployments(namespace string) (*appsv1.DeploymentList, error)
	RolloutRestartDeployment(namespace, name string) (*appsv1.Deployment, error)
}

Deployment the client that knows how to interact with kubernetes to manage them

func NewDeployment

func NewDeployment(kubeClient client.Client, logger logr.Logger) Deployment

NewDeployment returns a new Deployment client.

type DeploymentOption

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

DeploymentOption is the deployment client interface implementation that using API calls to kubernetes.

func (*DeploymentOption) CreateDeployment

func (d *DeploymentOption) CreateDeployment(namespace string, deployment *appsv1.Deployment) error

CreateDeployment implement the Deployment.Interface

func (*DeploymentOption) CreateOrUpdateDeployment

func (d *DeploymentOption) CreateOrUpdateDeployment(namespace string, deployment *appsv1.Deployment) error

CreateOrUpdateDeployment implement the Deployment.Interface

func (*DeploymentOption) DeleteDeployment

func (d *DeploymentOption) DeleteDeployment(namespace, name string) error

DeleteDeployment implement the Deployment.Interface

func (*DeploymentOption) GetDeployment

func (d *DeploymentOption) GetDeployment(namespace, name string) (*appsv1.Deployment, error)

GetDeployment implement the Deployment.Interface

func (*DeploymentOption) GetDeploymentPods

func (d *DeploymentOption) GetDeploymentPods(namespace, name string) (*corev1.PodList, error)

GetDeploymentPods implement the Deployment.Interface

func (*DeploymentOption) ListDeployments

func (d *DeploymentOption) ListDeployments(namespace string) (*appsv1.DeploymentList, error)

ListDeployments implement the Deployment.Interface

func (*DeploymentOption) RolloutRestartDeployment

func (d *DeploymentOption) RolloutRestartDeployment(namespace, name string) (*appsv1.Deployment, error)

func (*DeploymentOption) UpdateDeployment

func (d *DeploymentOption) UpdateDeployment(namespace string, deployment *appsv1.Deployment) error

UpdateDeployment implement the Deployment.Interface

type NameSpaces

type NameSpaces interface {
	// GetNameSpace get namespace info form kubernetes
	GetNameSpace(namespace string) (*corev1.Namespace, error)
}

NameSpaces the client that knows how to interact with kubernetes to manage them

func NewNameSpaces

func NewNameSpaces(logger logr.Logger) NameSpaces

NewNameSpaces returns a new NameSpaces client.

type NameSpacesOption

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

NameSpacesOption is the NameSpaces client implementation using API calls to kubernetes.

func (*NameSpacesOption) GetNameSpace

func (n *NameSpacesOption) GetNameSpace(namespace string) (*corev1.Namespace, error)

GetNameSpace implement the NameSpaces.Interface

type Pod

type Pod interface {
	// GetPod get pod from kubernetes with namespace and name
	GetPod(namespace string, name string) (*corev1.Pod, error)
	// CreatePod will create the given pod
	CreatePod(namespace string, pod *corev1.Pod) error
	// UpdatePod will update the given pod
	UpdatePod(namespace string, pod *corev1.Pod) error
	// CreateOrUpdatePod will update the given pod or create it if does not exist
	CreateOrUpdatePod(namespace string, pod *corev1.Pod) error
	// DeletePod will delete the given pod
	DeletePod(namespace string, name string) error
	// ListPods get set of pod on a given namespace
	ListPods(namespace string) (*corev1.PodList, error)
}

Pod the client that knows how to interact with kubernetes to manage them

func NewPod

func NewPod(kubeClient client.Client, logger logr.Logger) Pod

NewPod returns a new Pod client.

type PodDisruptionBudget

type PodDisruptionBudget interface {
	// GetPodDisruptionBudget get podDisruptionBudget from kubernetes with namespace and name
	GetPodDisruptionBudget(namespace string, name string) (*policyv1beta1.PodDisruptionBudget, error)
	// CreatePodDisruptionBudget will create the given podDisruptionBudget
	CreatePodDisruptionBudget(namespace string, podDisruptionBudget *policyv1beta1.PodDisruptionBudget) error
	// UpdatePodDisruptionBudget will update the given podDisruptionBudget
	UpdatePodDisruptionBudget(namespace string, podDisruptionBudget *policyv1beta1.PodDisruptionBudget) error
	// CreateOrUpdatePodDisruptionBudget will update the given podDisruptionBudget or create it if does not exist
	CreateOrUpdatePodDisruptionBudget(namespace string, podDisruptionBudget *policyv1beta1.PodDisruptionBudget) error
	// DeletePodDisruptionBudget will delete the given podDisruptionBudget
	DeletePodDisruptionBudget(namespace string, name string) error
	CreateIfNotExistsPodDisruptionBudget(namespace string, podDisruptionBudget *policyv1beta1.PodDisruptionBudget) error
}

PodDisruptionBudget the client that knows how to interact with kubernetes to manage them

func NewPodDisruptionBudget

func NewPodDisruptionBudget(kubeClient client.Client, logger logr.Logger) PodDisruptionBudget

NewPodDisruptionBudget returns a new PodDisruptionBudget client.

type PodDisruptionBudgetOption

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

PodDisruptionBudgetOption is the podDisruptionBudget client implementation using API calls to kubernetes.

func (*PodDisruptionBudgetOption) CreateIfNotExistsPodDisruptionBudget

func (p *PodDisruptionBudgetOption) CreateIfNotExistsPodDisruptionBudget(namespace string, podDisruptionBudget *policyv1beta1.PodDisruptionBudget) error

CreateIfNotExistsPodDisruptionBudget implement the PodDisruptionBudget.Interface

func (*PodDisruptionBudgetOption) CreateOrUpdatePodDisruptionBudget

func (p *PodDisruptionBudgetOption) CreateOrUpdatePodDisruptionBudget(namespace string, podDisruptionBudget *policyv1beta1.PodDisruptionBudget) error

CreateOrUpdatePodDisruptionBudget implement the PodDisruptionBudget.Interface

func (*PodDisruptionBudgetOption) CreatePodDisruptionBudget

func (p *PodDisruptionBudgetOption) CreatePodDisruptionBudget(namespace string, podDisruptionBudget *policyv1beta1.PodDisruptionBudget) error

CreatePodDisruptionBudget implement the PodDisruptionBudget.Interface

func (*PodDisruptionBudgetOption) DeletePodDisruptionBudget

func (p *PodDisruptionBudgetOption) DeletePodDisruptionBudget(namespace string, name string) error

DeletePodDisruptionBudget implement the PodDisruptionBudget.Interface

func (*PodDisruptionBudgetOption) GetPodDisruptionBudget

func (p *PodDisruptionBudgetOption) GetPodDisruptionBudget(namespace string, name string) (*policyv1beta1.PodDisruptionBudget, error)

GetPodDisruptionBudget implement the PodDisruptionBudget.Interface

func (*PodDisruptionBudgetOption) UpdatePodDisruptionBudget

func (p *PodDisruptionBudgetOption) UpdatePodDisruptionBudget(namespace string, podDisruptionBudget *policyv1beta1.PodDisruptionBudget) error

UpdatePodDisruptionBudget implement the PodDisruptionBudget.Interface

type PodOption

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

PodOption is the pod client interface implementation using API calls to kubernetes.

func (*PodOption) CreateOrUpdatePod

func (p *PodOption) CreateOrUpdatePod(namespace string, pod *corev1.Pod) error

CreateOrUpdatePod implement the Pod.Interface

func (*PodOption) CreatePod

func (p *PodOption) CreatePod(namespace string, pod *corev1.Pod) error

CreatePod implement the Pod.Interface

func (*PodOption) DeletePod

func (p *PodOption) DeletePod(namespace string, name string) error

DeletePod implement the Pod.Interface

func (*PodOption) GetPod

func (p *PodOption) GetPod(namespace string, name string) (*corev1.Pod, error)

GetPod implement the Pod.Interface

func (*PodOption) ListPods

func (p *PodOption) ListPods(namespace string) (*corev1.PodList, error)

ListPods implement the Pod.Interface

func (*PodOption) UpdatePod

func (p *PodOption) UpdatePod(namespace string, pod *corev1.Pod) error

UpdatePod implement the Pod.Interface

type Secret

type Secret interface {
	GetSecret(namespace string, name string) (*v1.Secret, error)
	CreateSecret(namespace string, secret *v1.Secret) error
	UpdateSecret(namespace string, secret *v1.Secret) error
	CreateOrUpdateSecret(namespace string, secret *v1.Secret) error
	DeleteSecret(namespace string, name string) error
	ListSecret(namespace string) (*v1.SecretList, error)
	CreateIfNotExistsSecret(namespace string, secret *v1.Secret) error
}

func NewSecret

func NewSecret(kubeClient client.Client, logger logr.Logger) Secret

type SecretOption

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

func (*SecretOption) CreateIfNotExistsSecret

func (s *SecretOption) CreateIfNotExistsSecret(namespace string, secret *v1.Secret) error

func (*SecretOption) CreateOrUpdateSecret

func (s *SecretOption) CreateOrUpdateSecret(namespace string, secret *v1.Secret) error

func (*SecretOption) CreateSecret

func (s *SecretOption) CreateSecret(namespace string, secret *v1.Secret) error

func (*SecretOption) DeleteSecret

func (s *SecretOption) DeleteSecret(namespace string, name string) error

func (*SecretOption) GetSecret

func (s *SecretOption) GetSecret(namespace string, name string) (*v1.Secret, error)

func (*SecretOption) ListSecret

func (s *SecretOption) ListSecret(namespace string) (*v1.SecretList, error)

func (*SecretOption) UpdateSecret

func (s *SecretOption) UpdateSecret(namespace string, secret *v1.Secret) error

type Service

type Service interface {
	// GetService get service from kubernetes with namespace and name
	GetService(namespace string, name string) (*corev1.Service, error)
	// CreateService will create the given service
	CreateService(namespace string, service *corev1.Service) error
	//CreateIfNotExistsService create service if it does not exist
	CreateIfNotExistsService(namespace string, service *corev1.Service) error
	// UpdateService will update the given service
	UpdateService(namespace string, service *corev1.Service) error
	// CreateOrUpdateService will update the given service or create it if does not exist
	CreateOrUpdateService(namespace string, service *corev1.Service) error
	// DeleteService will delete the given service
	DeleteService(namespace string, name string) error
	// ListServices get set of service on a given namespace
	ListServices(namespace string) (*corev1.ServiceList, error)
}

Service the client that knows how to interact with kubernetes to manage them

func NewService

func NewService(kubeClient client.Client, logger logr.Logger) Service

NewService returns a new Service client.

type ServiceOption

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

ServiceOption is the service client implementation using API calls to kubernetes.

func (*ServiceOption) CreateIfNotExistsService

func (s *ServiceOption) CreateIfNotExistsService(namespace string, service *corev1.Service) error

CreateIfNotExistsService implement the Service.Interface

func (*ServiceOption) CreateOrUpdateService

func (s *ServiceOption) CreateOrUpdateService(namespace string, service *corev1.Service) error

CreateOrUpdateService implement the Service.Interface

func (*ServiceOption) CreateService

func (s *ServiceOption) CreateService(namespace string, service *corev1.Service) error

CreateService implement the Service.Interface

func (*ServiceOption) DeleteService

func (s *ServiceOption) DeleteService(namespace string, name string) error

DeleteService implement the Service.Interface

func (*ServiceOption) GetService

func (s *ServiceOption) GetService(namespace string, name string) (*corev1.Service, error)

GetService implement the Service.Interface

func (*ServiceOption) ListServices

func (s *ServiceOption) ListServices(namespace string) (*corev1.ServiceList, error)

ListServices implement the Service.Interface

func (*ServiceOption) UpdateService

func (s *ServiceOption) UpdateService(namespace string, service *corev1.Service) error

UpdateService implement the Service.Interface

type Services

Service is the kubernetes service entrypoint.

func New

func New(kubecli client.Client, logger logr.Logger) Services

New returns a new Kubernetes client set.

type StatefulSet

type StatefulSet interface {
	// GetStatefulSet get StatefulSet from kubernetes with namespace and name
	GetStatefulSet(namespace, name string) (*appsv1.StatefulSet, error)
	// GetStatefulSetPods will retrieve the pods managed by a given StatefulSet
	GetStatefulSetPods(namespace, name string) (*corev1.PodList, error)
	// CreateStatefulSet will create the given StatefulSet
	CreateStatefulSet(namespace string, statefulSet *appsv1.StatefulSet) error
	// UpdateStatefulSet will update the given StatefulSet
	UpdateStatefulSet(namespace string, statefulSet *appsv1.StatefulSet) error
	// CreateOrUpdateStatefulSet will update the given StatefulSet or create it if does not exist
	CreateOrUpdateStatefulSet(namespace string, StatefulSet *appsv1.StatefulSet) error
	// DeleteStatefulSet will delete the given StatefulSet
	DeleteStatefulSet(namespace string, name string) error
	// ListStatefulSets get set of StatefulSet on a given namespace
	ListStatefulSets(namespace string) (*appsv1.StatefulSetList, error)
	CreateIfNotExistsStatefulSet(namespace string, statefulSet *appsv1.StatefulSet) error
}

StatefulSet the StatefulSet client that knows how to interact with kubernetes to manage them

func NewStatefulSet

func NewStatefulSet(kubeClient client.Client, logger logr.Logger) StatefulSet

NewStatefulSet returns a new StatefulSet client.

type StatefulSetOption

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

StatefulSetOption is the StatefulSet client implementation using API calls to kubernetes.

func (*StatefulSetOption) CreateIfNotExistsStatefulSet

func (s *StatefulSetOption) CreateIfNotExistsStatefulSet(namespace string, statefulSet *appsv1.StatefulSet) error

CreateIfNotExistsStatefulSet implement the StatefulSet.Interface

func (*StatefulSetOption) CreateOrUpdateStatefulSet

func (s *StatefulSetOption) CreateOrUpdateStatefulSet(namespace string, statefulSet *appsv1.StatefulSet) error

CreateOrUpdateStatefulSet implement the StatefulSet.Interface

func (*StatefulSetOption) CreateStatefulSet

func (s *StatefulSetOption) CreateStatefulSet(namespace string, statefulSet *appsv1.StatefulSet) error

CreateStatefulSet implement the StatefulSet.Interface

func (*StatefulSetOption) DeleteStatefulSet

func (s *StatefulSetOption) DeleteStatefulSet(namespace, name string) error

DeleteStatefulSet implement the StatefulSet.Interface

func (*StatefulSetOption) GetStatefulSet

func (s *StatefulSetOption) GetStatefulSet(namespace, name string) (*appsv1.StatefulSet, error)

GetStatefulSet implement the StatefulSet.Interface

func (*StatefulSetOption) GetStatefulSetPods

func (s *StatefulSetOption) GetStatefulSetPods(namespace, name string) (*corev1.PodList, error)

GetStatefulSetPods implement the StatefulSet.Interface

func (*StatefulSetOption) ListStatefulSets

func (s *StatefulSetOption) ListStatefulSets(namespace string) (*appsv1.StatefulSetList, error)

ListStatefulSets implement the StatefulSet.Interface

func (*StatefulSetOption) UpdateStatefulSet

func (s *StatefulSetOption) UpdateStatefulSet(namespace string, statefulSet *appsv1.StatefulSet) error

UpdateStatefulSet implement the StatefulSet.Interface

Jump to

Keyboard shortcuts

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