k8s

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2022 License: Apache-2.0 Imports: 21 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRedisPassword

func GetRedisPassword(s Services, rf *redisfailoverv1.RedisFailover) (string, error)

GetRedisPassword retreives password from kubernetes secret or, if unspecified, returns a blank string

Types

type ConfigMap

type ConfigMap interface {
	GetConfigMap(namespace string, name string) (*corev1.ConfigMap, error)
	CreateConfigMap(namespace string, configMap *corev1.ConfigMap) error
	UpdateConfigMap(namespace string, configMap *corev1.ConfigMap) error
	CreateOrUpdateConfigMap(namespace string, np *corev1.ConfigMap) error
	DeleteConfigMap(namespace string, name string) error
	ListConfigMaps(namespace string) (*corev1.ConfigMapList, error)
}

ConfigMap the ServiceAccount service that knows how to interact with k8s to manage them

type ConfigMapService

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

ConfigMapService is the configMap service implementation using API calls to kubernetes.

func NewConfigMapService

func NewConfigMapService(kubeClient kubernetes.Interface, logger log.Logger, metricsRecorder metrics.Recorder) *ConfigMapService

NewConfigMapService returns a new ConfigMap KubeService.

func (*ConfigMapService) CreateConfigMap

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

func (*ConfigMapService) CreateOrUpdateConfigMap

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

func (*ConfigMapService) DeleteConfigMap

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

func (*ConfigMapService) GetConfigMap

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

func (*ConfigMapService) ListConfigMaps

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

func (*ConfigMapService) UpdateConfigMap

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

type Deployment

type Deployment interface {
	GetDeployment(namespace, name string) (*appsv1.Deployment, error)
	GetDeploymentPods(namespace, name string) (*corev1.PodList, error)
	CreateDeployment(namespace string, deployment *appsv1.Deployment) error
	UpdateDeployment(namespace string, deployment *appsv1.Deployment) error
	CreateOrUpdateDeployment(namespace string, deployment *appsv1.Deployment) error
	DeleteDeployment(namespace string, name string) error
	ListDeployments(namespace string) (*appsv1.DeploymentList, error)
}

Deployment the Deployment service that knows how to interact with k8s to manage them

type DeploymentService

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

DeploymentService is the service account service implementation using API calls to kubernetes.

func NewDeploymentService

func NewDeploymentService(kubeClient kubernetes.Interface, logger log.Logger, metricsRecorder metrics.Recorder) *DeploymentService

NewDeploymentService returns a new Deployment KubeService.

func (*DeploymentService) CreateDeployment

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

CreateDeployment will create the given deployment

func (*DeploymentService) CreateOrUpdateDeployment

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

CreateOrUpdateDeployment will update the given deployment or create it if does not exist

func (*DeploymentService) DeleteDeployment

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

DeleteDeployment will delete the given deployment

func (*DeploymentService) GetDeployment

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

GetDeployment will retrieve the requested deployment based on namespace and name

func (*DeploymentService) GetDeploymentPods

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

GetDeploymentPods will retrieve the pods managed by a given deployment

func (*DeploymentService) ListDeployments

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

ListDeployments will give all the deployments on a given namespace

func (*DeploymentService) UpdateDeployment

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

UpdateDeployment will update the given deployment

type PatchStringValue added in v1.2.0

type PatchStringValue struct {
	Op    string      `json:"op"`
	Path  string      `json:"path"`
	Value interface{} `json:"value"`
}

PatchStringValue specifies a patch operation for a string.

type Pod

type Pod interface {
	GetPod(namespace string, name string) (*corev1.Pod, error)
	CreatePod(namespace string, pod *corev1.Pod) error
	UpdatePod(namespace string, pod *corev1.Pod) error
	CreateOrUpdatePod(namespace string, pod *corev1.Pod) error
	DeletePod(namespace string, name string) error
	ListPods(namespace string) (*corev1.PodList, error)
	UpdatePodLabels(namespace, podName string, labels map[string]string) error
}

Pod the ServiceAccount service that knows how to interact with k8s to manage them

type PodDisruptionBudget

type PodDisruptionBudget interface {
	GetPodDisruptionBudget(namespace string, name string) (*policyv1.PodDisruptionBudget, error)
	CreatePodDisruptionBudget(namespace string, podDisruptionBudget *policyv1.PodDisruptionBudget) error
	UpdatePodDisruptionBudget(namespace string, podDisruptionBudget *policyv1.PodDisruptionBudget) error
	CreateOrUpdatePodDisruptionBudget(namespace string, podDisruptionBudget *policyv1.PodDisruptionBudget) error
	DeletePodDisruptionBudget(namespace string, name string) error
}

PodDisruptionBudget the ServiceAccount service that knows how to interact with k8s to manage them

type PodDisruptionBudgetService

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

PodDisruptionBudgetService is the podDisruptionBudget service implementation using API calls to kubernetes.

func NewPodDisruptionBudgetService

func NewPodDisruptionBudgetService(kubeClient kubernetes.Interface, logger log.Logger, metricsRecorder metrics.Recorder) *PodDisruptionBudgetService

NewPodDisruptionBudgetService returns a new PodDisruptionBudget KubeService.

func (*PodDisruptionBudgetService) CreateOrUpdatePodDisruptionBudget

func (p *PodDisruptionBudgetService) CreateOrUpdatePodDisruptionBudget(namespace string, podDisruptionBudget *policyv1.PodDisruptionBudget) error

func (*PodDisruptionBudgetService) CreatePodDisruptionBudget

func (p *PodDisruptionBudgetService) CreatePodDisruptionBudget(namespace string, podDisruptionBudget *policyv1.PodDisruptionBudget) error

func (*PodDisruptionBudgetService) DeletePodDisruptionBudget

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

func (*PodDisruptionBudgetService) GetPodDisruptionBudget

func (p *PodDisruptionBudgetService) GetPodDisruptionBudget(namespace string, name string) (*policyv1.PodDisruptionBudget, error)

func (*PodDisruptionBudgetService) UpdatePodDisruptionBudget

func (p *PodDisruptionBudgetService) UpdatePodDisruptionBudget(namespace string, podDisruptionBudget *policyv1.PodDisruptionBudget) error

type PodService

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

PodService is the pod service implementation using API calls to kubernetes.

func NewPodService

func NewPodService(kubeClient kubernetes.Interface, logger log.Logger, metricsRecorder metrics.Recorder) *PodService

NewPodService returns a new Pod KubeService.

func (*PodService) CreateOrUpdatePod

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

func (*PodService) CreatePod

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

func (*PodService) DeletePod

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

func (*PodService) GetPod

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

func (*PodService) ListPods

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

func (*PodService) UpdatePod

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

func (*PodService) UpdatePodLabels added in v1.2.0

func (p *PodService) UpdatePodLabels(namespace, podName string, labels map[string]string) error

type RBAC

type RBAC interface {
	GetClusterRole(name string) (*rbacv1.ClusterRole, error)
	GetRole(namespace, name string) (*rbacv1.Role, error)
	GetRoleBinding(namespace, name string) (*rbacv1.RoleBinding, error)
	CreateRole(namespace string, role *rbacv1.Role) error
	UpdateRole(namespace string, role *rbacv1.Role) error
	CreateOrUpdateRole(namespace string, binding *rbacv1.Role) error
	CreateRoleBinding(namespace string, binding *rbacv1.RoleBinding) error
	UpdateRoleBinding(namespace string, binding *rbacv1.RoleBinding) error
	CreateOrUpdateRoleBinding(namespace string, binding *rbacv1.RoleBinding) error
}

RBAC is the service that knows how to interact with k8s to manage RBAC related resources.

type RBACService

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

NamespaceService is the Namespace service implementation using API calls to kubernetes.

func NewRBACService

func NewRBACService(kubeClient kubernetes.Interface, logger log.Logger, metricsRecorder metrics.Recorder) *RBACService

NewRBACService returns a new RBAC KubeService.

func (*RBACService) CreateOrUpdateRole

func (r *RBACService) CreateOrUpdateRole(namespace string, role *rbacv1.Role) error

func (*RBACService) CreateOrUpdateRoleBinding

func (r *RBACService) CreateOrUpdateRoleBinding(namespace string, binding *rbacv1.RoleBinding) error

func (*RBACService) CreateRole

func (r *RBACService) CreateRole(namespace string, role *rbacv1.Role) error

func (*RBACService) CreateRoleBinding

func (r *RBACService) CreateRoleBinding(namespace string, binding *rbacv1.RoleBinding) error

func (*RBACService) DeleteRole

func (r *RBACService) DeleteRole(namespace, name string) error

func (*RBACService) DeleteRoleBinding

func (r *RBACService) DeleteRoleBinding(namespace, name string) error

func (*RBACService) GetClusterRole

func (r *RBACService) GetClusterRole(name string) (*rbacv1.ClusterRole, error)

func (*RBACService) GetRole

func (r *RBACService) GetRole(namespace, name string) (*rbacv1.Role, error)

func (*RBACService) GetRoleBinding

func (r *RBACService) GetRoleBinding(namespace, name string) (*rbacv1.RoleBinding, error)

func (*RBACService) UpdateRole

func (s *RBACService) UpdateRole(namespace string, role *rbacv1.Role) error

func (*RBACService) UpdateRoleBinding

func (r *RBACService) UpdateRoleBinding(namespace string, binding *rbacv1.RoleBinding) error

type RedisFailover

type RedisFailover interface {
	// ListRedisFailovers lists the redisfailovers on a cluster.
	ListRedisFailovers(ctx context.Context, namespace string, opts metav1.ListOptions) (*redisfailoverv1.RedisFailoverList, error)
	// WatchRedisFailovers watches the redisfailovers on a cluster.
	WatchRedisFailovers(ctx context.Context, namespace string, opts metav1.ListOptions) (watch.Interface, error)
}

RedisFailover the RF service that knows how to interact with k8s to get them

type RedisFailoverService

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

RedisFailoverService is the RedisFailover service implementation using API calls to kubernetes.

func NewRedisFailoverService

func NewRedisFailoverService(k8scli redisfailoverclientset.Interface, logger log.Logger, metricsRecorder metrics.Recorder) *RedisFailoverService

NewRedisFailoverService returns a new Workspace KubeService.

func (*RedisFailoverService) ListRedisFailovers

func (r *RedisFailoverService) ListRedisFailovers(ctx context.Context, namespace string, opts metav1.ListOptions) (*redisfailoverv1.RedisFailoverList, error)

ListRedisFailovers satisfies redisfailover.Service interface.

func (*RedisFailoverService) WatchRedisFailovers

func (r *RedisFailoverService) WatchRedisFailovers(ctx context.Context, namespace string, opts metav1.ListOptions) (watch.Interface, error)

WatchRedisFailovers satisfies redisfailover.Service interface.

type Secret

type Secret interface {
	GetSecret(namespace, name string) (*corev1.Secret, error)
}

Secret interacts with k8s to get secrets

type SecretService

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

SecretService is the secret service implementation using API calls to kubernetes.

func NewSecretService

func NewSecretService(kubeClient kubernetes.Interface, logger log.Logger, metricsRecorder metrics.Recorder) *SecretService

func (*SecretService) GetSecret

func (s *SecretService) GetSecret(namespace, name string) (*corev1.Secret, error)

type Service

type Service interface {
	GetService(namespace string, name string) (*corev1.Service, error)
	CreateService(namespace string, service *corev1.Service) error
	CreateIfNotExistsService(namespace string, service *corev1.Service) error
	UpdateService(namespace string, service *corev1.Service) error
	CreateOrUpdateService(namespace string, service *corev1.Service) error
	DeleteService(namespace string, name string) error
	ListServices(namespace string) (*corev1.ServiceList, error)
}

Service the ServiceAccount service that knows how to interact with k8s to manage them

type ServiceService

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

ServiceService is the service service implementation using API calls to kubernetes.

func NewServiceService

func NewServiceService(kubeClient kubernetes.Interface, logger log.Logger, metricsRecorder metrics.Recorder) *ServiceService

NewServiceService returns a new Service KubeService.

func (*ServiceService) CreateIfNotExistsService

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

func (*ServiceService) CreateOrUpdateService

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

func (*ServiceService) CreateService

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

func (*ServiceService) DeleteService

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

func (*ServiceService) GetService

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

func (*ServiceService) ListServices

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

func (*ServiceService) UpdateService

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

type Services

Service is the K8s service entrypoint.

func New

func New(kubecli kubernetes.Interface, crdcli redisfailoverclientset.Interface, apiextcli apiextensionscli.Interface, logger log.Logger, metricsRecorder metrics.Recorder) Services

New returns a new Kubernetes service.

type StatefulSet

type StatefulSet interface {
	GetStatefulSet(namespace, name string) (*appsv1.StatefulSet, error)
	GetStatefulSetPods(namespace, name string) (*corev1.PodList, error)
	CreateStatefulSet(namespace string, statefulSet *appsv1.StatefulSet) error
	UpdateStatefulSet(namespace string, statefulSet *appsv1.StatefulSet) error
	CreateOrUpdateStatefulSet(namespace string, statefulSet *appsv1.StatefulSet) error
	DeleteStatefulSet(namespace string, name string) error
	ListStatefulSets(namespace string) (*appsv1.StatefulSetList, error)
}

StatefulSet the StatefulSet service that knows how to interact with k8s to manage them

type StatefulSetService

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

StatefulSetService is the service account service implementation using API calls to kubernetes.

func NewStatefulSetService

func NewStatefulSetService(kubeClient kubernetes.Interface, logger log.Logger, metricsRecorder metrics.Recorder) *StatefulSetService

NewStatefulSetService returns a new StatefulSet KubeService.

func (*StatefulSetService) CreateOrUpdateStatefulSet

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

CreateOrUpdateStatefulSet will update the statefulset or create it if does not exist

func (*StatefulSetService) CreateStatefulSet

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

CreateStatefulSet will create the given statefulset

func (*StatefulSetService) DeleteStatefulSet

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

DeleteStatefulSet will delete the statefulset

func (*StatefulSetService) GetStatefulSet

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

GetStatefulSet will retrieve the requested statefulset based on namespace and name

func (*StatefulSetService) GetStatefulSetPods

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

GetStatefulSetPods will give a list of pods that are managed by the statefulset

func (*StatefulSetService) ListStatefulSets

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

ListStatefulSets will retrieve a list of statefulset in the given namespace

func (*StatefulSetService) UpdateStatefulSet

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

UpdateStatefulSet will update the given statefulset

Jump to

Keyboard shortcuts

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