Help us shape the future of Go! Take the 2026 Go Developer Survey

k8s

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2020 License: Apache-2.0 Imports: 14 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cluster

type Cluster interface {
	// UpdateCluster update the RedisCluster
	UpdateCluster(namespace string, cluster *redisv1beta1.RedisCluster) error
}

Cluster the client that knows how to interact with kubernetes to manage RedisCluster

func NewCluster

func NewCluster(kubeClient client.Client, logger logr.Logger) Cluster

NewCluster returns a new RedisCluster client.

type ClusterOption

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

ClusterOption is the RedisCluster client that using API calls to kubernetes.

func (*ClusterOption) UpdateCluster

func (c *ClusterOption) UpdateCluster(namespace string, cluster *redisv1beta1.RedisCluster) error

UpdateCluster implement the Cluster.Interface

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)
}

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) UpdateDeployment

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

UpdateDeployment implement the Deployment.Interface

type Event

type Event interface {
	// NewSlaveAdd event ClusterScaling
	NewSlaveAdd(object runtime.Object, message string)
	// SlaveRemove event ClusterScalingDown
	SlaveRemove(object runtime.Object, message string)
	// CreateCluster event ClusterCreating
	CreateCluster(object runtime.Object)
	// UpdateCluster event ClusterUpdating
	UpdateCluster(object runtime.Object, message string)
	// UpgradedCluster event ClusterUpgrading
	UpgradedCluster(object runtime.Object, message string)
	// EnsureCluster event Ensure
	EnsureCluster(object runtime.Object)
	// CheckCluster event CheckAndHeal
	CheckCluster(object runtime.Object)
	// FailedCluster event ClusterFailed
	FailedCluster(object runtime.Object, message string)
	// HealthCluster event ClusterHealthy
	HealthCluster(object runtime.Object)
}

Event the client that push event to kubernetes

func NewEvent

func NewEvent(eventCli record.EventRecorder, logger logr.Logger) Event

NewEvent returns a new Event client

type EventOption

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

EventOption is the Event client interface implementation that using API calls to kubernetes.

func (*EventOption) CheckCluster

func (e *EventOption) CheckCluster(object runtime.Object)

CheckCluster implement the Event.Interface

func (*EventOption) CreateCluster

func (e *EventOption) CreateCluster(object runtime.Object)

CreateCluster implement the Event.Interface

func (*EventOption) EnsureCluster

func (e *EventOption) EnsureCluster(object runtime.Object)

EnsureCluster implement the Event.Interface

func (*EventOption) FailedCluster

func (e *EventOption) FailedCluster(object runtime.Object, message string)

FailedCluster implement the Event.Interface

func (*EventOption) HealthCluster

func (e *EventOption) HealthCluster(object runtime.Object)

HealthCluster implement the Event.Interface

func (*EventOption) NewSlaveAdd

func (e *EventOption) NewSlaveAdd(object runtime.Object, message string)

NewSlaveAdd implement the Event.Interface

func (*EventOption) SlaveRemove

func (e *EventOption) SlaveRemove(object runtime.Object, message string)

SlaveRemove implement the Event.Interface

func (*EventOption) UpdateCluster

func (e *EventOption) UpdateCluster(object runtime.Object, message string)

UpdateCluster implement the Event.Interface

func (*EventOption) UpgradedCluster

func (e *EventOption) UpgradedCluster(object runtime.Object, message string)

UpgradedCluster implement the Event.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 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