k8s

package
v0.0.0-...-b3ec277 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2020 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 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 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 IpPool

type IpPool interface {
	// SelectAlcorIPPool get IPPool from kubernetes
	SelectAlcorIPPool() (string, error)
}

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

func NewIpPool

func NewIpPool(kubeClient client.Client, logger logr.Logger) IpPool

NewIpPool returns a new IpPool client.

type IpPoolOption

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

IpPoolOption is the IpPool client interface implementation that using API calls to kubernetes.

func (*IpPoolOption) SelectAlcorIPPool

func (i *IpPoolOption) SelectAlcorIPPool() (string, error)

SelectAlcorIPPool implement the IpPool.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)
	// ListPodsByLabels get set of pod on a given namespace by labels
	ListPodsByLabels(namespace, name, component string) (*corev1.PodList, error)
	GetRunningPodsNumber(podList *corev1.PodList) int
}

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

func (p *PodOption) GetRunningPodsNumber(podList *corev1.PodList) int

GetRunningPodsNumber implement the Pod.Interface

func (*PodOption) ListPods

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

ListPods implement the Pod.Interface

func (*PodOption) ListPodsByLabels

func (p *PodOption) ListPodsByLabels(namespace, name, component string) (*corev1.PodList, error)

ListPodsByLabels 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 Unit

type Unit interface {
	// GetUnitList get unitList from kubernetes with namespace and name
	GetUnitList(namespace, name, component string) (*elasticv1alpha1.UnitList, error)
	CreateUnit(namespace string, unit *elasticv1alpha1.Unit) error
}

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

func NewUnit

func NewUnit(kubeClient client.Client, logger logr.Logger) Unit

NewUnit returns a new Unit client.

type UnitOption

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

UnitOption is the unit client interface implementation that using API calls to kubernetes.

func (*UnitOption) CreateUnit

func (u *UnitOption) CreateUnit(namespace string, unit *elasticv1alpha1.Unit) error

CreateUnit implement the Unit.Interface

func (*UnitOption) GetUnitList

func (u *UnitOption) GetUnitList(namespace, name, component string) (*elasticv1alpha1.UnitList, error)

GetUnitList implement the Unit.Interface

Jump to

Keyboard shortcuts

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