artifacts

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2019 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IngressName     string = "siddhi"
	NATSClusterName string = "siddhi-nats"
	STANClusterName string = "siddhi-stan"
	NATSAPIVersion  string = "nats.io/v1alpha2"
	STANAPIVersion  string = "streaming.nats.io/v1alpha1"
	NATSKind        string = "NatsCluster"
	STANKind        string = "NatsStreamingCluster"
	NATSClusterSize int    = 1
	STANClusterSize int32  = 1
)

Constants for the Kubernetes artifacts

View Source
const (
	HealthPath                 string = "/health"
	HealthPortName             string = "hport"
	HealthPort                 int32  = 9090
	ReadyPrPeriodSeconds       int32  = 10
	ReadyPrInitialDelaySeconds int32  = 10
	LivePrPeriodSeconds        int32  = 70
	LivePrInitialDelaySeconds  int32  = 20
)

Constants for K8s deployment

View Source
const (
	Int intstr.Type = iota
	String
)

Int - Type

Variables

This section is empty.

Functions

func ConfigMapMutateFunc

func ConfigMapMutateFunc(data map[string]string) controllerutil.MutateFn

ConfigMapMutateFunc is the function for update k8s config maps gracefully

func DeploymentMutateFunc

func DeploymentMutateFunc(
	replicas int32,
	labels map[string]string,
	image string,
	containerName string,
	command []string,
	args []string,
	ports []corev1.ContainerPort,
	volumeMounts []corev1.VolumeMount,
	envs []corev1.EnvVar,
	sc corev1.SecurityContext,
	ipp corev1.PullPolicy,
	secrets []corev1.LocalObjectReference,
	volumes []corev1.Volume,
	readyProbe corev1.Probe,
	liveProbe corev1.Probe,
	strategy appsv1.DeploymentStrategy,
) controllerutil.MutateFn

DeploymentMutateFunc is the function for update k8s deployments gracefully

func IngressMutateFunc

func IngressMutateFunc(
	namespace string,
	serviceName string,
	tls string,
	containerPorts []corev1.ContainerPort,
) controllerutil.MutateFn

IngressMutateFunc is the function for update k8s ingress gracefully

func PVCMutateFunc

func PVCMutateFunc(
	pvcSpec corev1.PersistentVolumeClaimSpec,
) controllerutil.MutateFn

PVCMutateFunc is the function for update k8s persistence volumes claims gracefully

func ServiceMutateFunc

func ServiceMutateFunc(selectors map[string]string, servicePorts []corev1.ServicePort) controllerutil.MutateFn

ServiceMutateFunc is the function for update k8s services gracefully.

Types

type KubeClient

type KubeClient struct {
	Client client.Client
	Scheme *runtime.Scheme
}

KubeClient performs CRUD operations in the K8s cluster

func (*KubeClient) CreateNATS

func (k *KubeClient) CreateNATS(namespace string) error

CreateNATS function creates a NATS cluster and a NATS streaming cluster More about NATS cluster - https://github.com/nats-io/nats-operator More about NATS streaming cluster - https://github.com/nats-io/nats-streaming-operator

func (*KubeClient) CreateOrUpdateCM

func (k *KubeClient) CreateOrUpdateCM(
	name string,
	namespace string,
	data map[string]string,
	owner metav1.Object,
) error

CreateOrUpdateCM creates a k8s config map for the given set of data. This function initializes the config map object, set the controller reference, and then creates the config map.

func (*KubeClient) CreateOrUpdateDeployment

func (k *KubeClient) CreateOrUpdateDeployment(
	name string,
	namespace string,
	replicas int32,
	labels map[string]string,
	image string,
	containerName string,
	command []string,
	args []string,
	ports []corev1.ContainerPort,
	volumeMounts []corev1.VolumeMount,
	envs []corev1.EnvVar,
	sc corev1.SecurityContext,
	ipp corev1.PullPolicy,
	secrets []corev1.LocalObjectReference,
	volumes []corev1.Volume,
	strategy appsv1.DeploymentStrategy,
	owner metav1.Object,
) (operationResult controllerutil.OperationResult, err error)

CreateOrUpdateDeployment creates a deployment for a given set of configuration data

func (*KubeClient) CreateOrUpdateIngress

func (k *KubeClient) CreateOrUpdateIngress(
	namespace string,
	serviceName string,
	tls string,
	containerPorts []corev1.ContainerPort,
) (operationResult controllerutil.OperationResult, err error)

CreateOrUpdateIngress creates an NGINX Ingress load balancer object called siddhi

func (*KubeClient) CreateOrUpdatePVC

func (k *KubeClient) CreateOrUpdatePVC(
	name string,
	namespace string,
	pvcSpec corev1.PersistentVolumeClaimSpec,
	owner metav1.Object,
) error

CreateOrUpdatePVC function creates a persistence volume claim in a K8s cluster

func (*KubeClient) CreateOrUpdateService

func (k *KubeClient) CreateOrUpdateService(
	name string,
	namespace string,
	containerPorts []corev1.ContainerPort,
	selectors map[string]string,
	owner metav1.Object,
) (operationResult controllerutil.OperationResult, err error)

CreateOrUpdateService returns a Service object for deployment

func (*KubeClient) DeleteConfigMap

func (k *KubeClient) DeleteConfigMap(
	name string,
	namespace string,
) (err error)

DeleteConfigMap deletes the CM specify by the user

func (*KubeClient) DeleteDeployment

func (k *KubeClient) DeleteDeployment(
	name string,
	namespace string,
) (err error)

DeleteDeployment deletes the deployment specify by the user

func (*KubeClient) DeletePVC

func (k *KubeClient) DeletePVC(
	name string,
	namespace string,
) (err error)

DeletePVC deletes the PVC specify by the user

func (*KubeClient) DeleteService

func (k *KubeClient) DeleteService(
	name string,
	namespace string,
) (err error)

DeleteService deletes the service specified by the user

func (*KubeClient) GetDeployment added in v0.2.1

func (k *KubeClient) GetDeployment(
	name string,
	namespace string,
) (*appsv1.Deployment, bool)

GetDeployment return the deployment struct if it is exists along with a flag indicating whether it is exists or not

Jump to

Keyboard shortcuts

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