k8sutil

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: May 22, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateSecret

func CreateSecret(client client.Client, secret *corev1.Secret, logger logr.Logger) error

func IsRequestRetryable

func IsRequestRetryable(err error) bool

Types

type ConfigMapController

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

func (*ConfigMapController) CreateConfigMap

func (s *ConfigMapController) CreateConfigMap(cm *corev1.ConfigMap) error

CreateConfigMap implement the IConfigMapControl.Interface.

func (*ConfigMapController) DeleteConfigMap

func (s *ConfigMapController) DeleteConfigMap(cm *corev1.ConfigMap) error

DeleteConfigMap implement the IConfigMapControl.Interface.

func (*ConfigMapController) GetConfigMap

func (s *ConfigMapController) GetConfigMap(namespace, name string) (*corev1.ConfigMap, error)

GetConfigMap implement the IConfigMapControl.Interface.

func (*ConfigMapController) UpdateConfigMap

func (s *ConfigMapController) UpdateConfigMap(cm *corev1.ConfigMap) error

UpdateConfigMap implement the IConfigMapControl.Interface.

type IConfigMapControl

type IConfigMapControl interface {
	// CreateConfigMap creates a ConfigMap in a DistributedRedisCluster.
	CreateConfigMap(*corev1.ConfigMap) error
	// UpdateConfigMap updates a ConfigMap in a DistributedRedisCluster.
	UpdateConfigMap(*corev1.ConfigMap) error
	// DeleteConfigMap deletes a ConfigMap in a DistributedRedisCluster.
	DeleteConfigMap(*corev1.ConfigMap) error
	// GetConfigMap get ConfigMap in a DistributedRedisCluster.
	GetConfigMap(namespace, name string) (*corev1.ConfigMap, error)
}

IConfigMapControl defines the interface that uses to create, update, and delete ConfigMaps.

func NewConfigMapController

func NewConfigMapController(client client.Client) IConfigMapControl

NewRealConfigMapControl creates a concrete implementation of the IConfigMapControl.

type ICustomResource

type ICustomResource interface {
	// UpdateCRStatus update the RedisCluster status
	UpdateCRStatus(runtime.Object) error
	UpdateCR(runtime.Object) error
	GetRedisClusterBackup(namespace, name string) (*redisv1alpha1.RedisClusterBackup, error)
	GetDistributedRedisCluster(namespace, name string) (*redisv1alpha1.DistributedRedisCluster, error)
}

ICustomResource defines the interface that uses to update cr status

func NewCRControl

func NewCRControl(client client.Client) ICustomResource

NewCRControl creates a concrete implementation of the ICustomResource.

type IJobControl

type IJobControl interface {
	CreateJob(*batchv1.Job) error
	UpdateJob(*batchv1.Job) error
	DeleteJob(*batchv1.Job) error
	GetJob(namespace, name string) (*batchv1.Job, error)
	ListJobByLabels(namespace string, labs client.MatchingLabels) (*batchv1.JobList, error)
}

IJobControl definej the interface that usej to create, update, and delete Jobs.

func NewJobController

func NewJobController(client client.Client) IJobControl

NewRealJobControl creates a concrete implementation of the IJobControl.

type IPodControl

type IPodControl interface {
	// CreatePod creates a Pod in a DistributedRedisCluster.
	CreatePod(*corev1.Pod) error
	// UpdatePod updates a Pod in a DistributedRedisCluster.
	UpdatePod(*corev1.Pod) error
	// DeletePod deletes a Pod in a DistributedRedisCluster.
	DeletePod(*corev1.Pod) error
	DeletePodByName(namespace, name string) error
	// GetPod get Pod in a DistributedRedisCluster.
	GetPod(namespace, name string) (*corev1.Pod, error)
}

IPodControl defines the interface that uses to create, update, and delete Pods.

func NewPodController

func NewPodController(client client.Client) IPodControl

NewPodController creates a concrete implementation of the IPodControl.

type IPodDisruptionBudgetControl

type IPodDisruptionBudgetControl interface {
	// CreatePodDisruptionBudget creates a PodDisruptionBudget in a DistributedRedisCluster.
	CreatePodDisruptionBudget(*policyv1beta1.PodDisruptionBudget) error
	// UpdatePodDisruptionBudget updates a PodDisruptionBudget in a DistributedRedisCluster.
	UpdatePodDisruptionBudget(*policyv1beta1.PodDisruptionBudget) error
	// DeletePodDisruptionBudget deletes a PodDisruptionBudget in a DistributedRedisCluster.
	DeletePodDisruptionBudget(*policyv1beta1.PodDisruptionBudget) error
	DeletePodDisruptionBudgetByName(namespace, name string) error
	// GetPodDisruptionBudget get PodDisruptionBudget in a DistributedRedisCluster.
	GetPodDisruptionBudget(namespace, name string) (*policyv1beta1.PodDisruptionBudget, error)
}

IPodDisruptionBudgetControl defines the interface that uses to create, update, and delete PodDisruptionBudgets.

func NewPodDisruptionBudgetController

func NewPodDisruptionBudgetController(client client.Client) IPodDisruptionBudgetControl

NewRealPodDisruptionBudgetControl creates a concrete implementation of the IPodDisruptionBudgetControl.

type IPvcControl added in v0.2.0

type IPvcControl interface {
	DeletePvc(claim *corev1.PersistentVolumeClaim) error
	DeletePvcByLabels(namespace string, labels map[string]string) error
	GetPvc(namespace, name string) (*corev1.PersistentVolumeClaim, error)
}

IPvcControl defines the interface that uses to create, update, and delete PersistentVolumeClaim.

func NewPvcController added in v0.2.0

func NewPvcController(client client.Client) IPvcControl

NewPvcController creates a concrete implementation of the IPvcControl.

type IServiceControl

type IServiceControl interface {
	// CreateService creates a Service in a DistributedRedisCluster.
	CreateService(*corev1.Service) error
	// UpdateService updates a Service in a DistributedRedisCluster.
	UpdateService(*corev1.Service) error
	// DeleteService deletes a Service in a DistributedRedisCluster.
	DeleteService(*corev1.Service) error
	DeleteServiceByName(namespace, name string) error
	// GetService get Service in a DistributedRedisCluster.
	GetService(namespace, name string) (*corev1.Service, error)
}

IServiceControl defines the interface that uses to create, update, and delete Services.

func NewServiceController

func NewServiceController(client client.Client) IServiceControl

NewRealServiceControl creates a concrete implementation of the IServiceControl.

type IStatefulSetControl

type IStatefulSetControl interface {
	// CreateStatefulSet creates a StatefulSet in a DistributedRedisCluster.
	CreateStatefulSet(*appsv1.StatefulSet) error
	// UpdateStatefulSet updates a StatefulSet in a DistributedRedisCluster.
	UpdateStatefulSet(*appsv1.StatefulSet) error
	// DeleteStatefulSet deletes a StatefulSet in a DistributedRedisCluster.
	DeleteStatefulSet(*appsv1.StatefulSet) error
	DeleteStatefulSetByName(namespace, name string) error
	// GetStatefulSet get StatefulSet in a DistributedRedisCluster.
	GetStatefulSet(namespace, name string) (*appsv1.StatefulSet, error)
	ListStatefulSetByLabels(namespace string, labels map[string]string) (*appsv1.StatefulSetList, error)
	// GetStatefulSetPods will retrieve the pods managed by a given StatefulSet.
	GetStatefulSetPods(namespace, name string) (*corev1.PodList, error)
	GetStatefulSetPodsByLabels(namespace string, labels map[string]string) (*corev1.PodList, error)
}

IStatefulSetControl defines the interface that uses to create, update, and delete StatefulSets.

func NewStatefulSetController

func NewStatefulSetController(client client.Client) IStatefulSetControl

NewRealStatefulSetControl creates a concrete implementation of the IStatefulSetControl.

type JobController

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

func (*JobController) CreateJob

func (j *JobController) CreateJob(job *batchv1.Job) error

CreateJob implement the IJobControl.Interface.

func (*JobController) DeleteJob

func (j *JobController) DeleteJob(job *batchv1.Job) error

DeleteJob implement the IJobControl.Interface.

func (*JobController) GetJob

func (j *JobController) GetJob(namespace, name string) (*batchv1.Job, error)

GetJob implement the IJobControl.Interface.

func (*JobController) ListJobByLabels

func (j *JobController) ListJobByLabels(namespace string, labs client.MatchingLabels) (*batchv1.JobList, error)

func (*JobController) UpdateJob

func (j *JobController) UpdateJob(job *batchv1.Job) error

UpdateJob implement the IJobControl.Interface.

type PodController

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

func (*PodController) CreatePod

func (p *PodController) CreatePod(pod *corev1.Pod) error

CreatePod implement the IPodControl.Interface.

func (*PodController) DeletePod

func (p *PodController) DeletePod(pod *corev1.Pod) error

DeletePod implement the IPodControl.Interface.

func (*PodController) DeletePodByName

func (p *PodController) DeletePodByName(namespace, name string) error

DeletePod implement the IPodControl.Interface.

func (*PodController) GetPod

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

GetPod implement the IPodControl.Interface.

func (*PodController) UpdatePod

func (p *PodController) UpdatePod(pod *corev1.Pod) error

UpdatePod implement the IPodControl.Interface.

type PodDisruptionBudgetController

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

func (*PodDisruptionBudgetController) CreatePodDisruptionBudget

func (s *PodDisruptionBudgetController) CreatePodDisruptionBudget(pb *policyv1beta1.PodDisruptionBudget) error

CreatePodDisruptionBudget implement the IPodDisruptionBudgetControl.Interface.

func (*PodDisruptionBudgetController) DeletePodDisruptionBudget

func (s *PodDisruptionBudgetController) DeletePodDisruptionBudget(pb *policyv1beta1.PodDisruptionBudget) error

DeletePodDisruptionBudget implement the IPodDisruptionBudgetControl.Interface.

func (*PodDisruptionBudgetController) DeletePodDisruptionBudgetByName added in v0.2.0

func (s *PodDisruptionBudgetController) DeletePodDisruptionBudgetByName(namespace, name string) error

func (*PodDisruptionBudgetController) GetPodDisruptionBudget

func (s *PodDisruptionBudgetController) GetPodDisruptionBudget(namespace, name string) (*policyv1beta1.PodDisruptionBudget, error)

GetPodDisruptionBudget implement the IPodDisruptionBudgetControl.Interface.

func (*PodDisruptionBudgetController) UpdatePodDisruptionBudget

func (s *PodDisruptionBudgetController) UpdatePodDisruptionBudget(pb *policyv1beta1.PodDisruptionBudget) error

UpdatePodDisruptionBudget implement the IPodDisruptionBudgetControl.Interface.

Jump to

Keyboard shortcuts

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