k8sutil

package
v0.0.0-...-1ea1a29 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2019 License: BSD-3-Clause Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetESURL

func GetESURL(esHost string, useSSL *bool) string

GetESURL Returns Elasticsearch URL

func TemplateImagePullSecrets

func TemplateImagePullSecrets(ips []myspec.ImagePullSecrets) []v1.LocalObjectReference

Types

type K8sutil

type K8sutil struct {
	Config                 *rest.Config
	CrdClient              genclient.Interface
	Kclient                kubernetes.Interface
	KubeExt                apiextensionsclient.Interface
	K8sVersion             []int
	MasterHost             string
	EnableInitDaemonset    bool
	InitDaemonsetNamespace string
	BusyboxImage           string
}

K8sutil defines the kube object

func New

func New(kubeCfgFile, masterHost string, enableInitDaemonset bool, initDaemonsetNamespace, busyboxImage string) (*K8sutil, error)

New creates a new instance of k8sutil

func (*K8sutil) CertsSecretExists

func (k *K8sutil) CertsSecretExists(namespace, clusterName string) bool

CertsSecretExists returms true if secret exists

func (*K8sutil) ConfigmapExists

func (k *K8sutil) ConfigmapExists(namespace, name string) bool

ConfigmapExists returns true if configmap exists

func (*K8sutil) CreateCerebroConfiguration

func (k *K8sutil) CreateCerebroConfiguration(esHost string, useSSL *bool) map[string]string

CreateCerebroConfiguration creates Cerebro configuration

func (*K8sutil) CreateCerebroDeployment

func (k *K8sutil) CreateCerebroDeployment(baseImage, clusterName, namespace, cert string, imagePullSecrets []myspec.ImagePullSecrets, imagePullPolicy string, serviceAccountName string, useSSL *bool) error

CreateCerebroDeployment creates a deployment of Cerebro

func (*K8sutil) CreateCertsSecret

func (k *K8sutil) CreateCertsSecret(namespace, clusterName, certsDir string) error

CreateCertsSecret creates the certs secrets

func (*K8sutil) CreateClientDeployment

func (k *K8sutil) CreateClientDeployment(baseImage string, replicas *int32, javaOptions, clientJavaOptions string,
	resources myspec.Resources, imagePullSecrets []myspec.ImagePullSecrets, imagePullPolicy, serviceAccountName, clusterName, statsdEndpoint, networkHost, namespace string, useSSL *bool, affinity v1.Affinity) error

CreateClientDeployment creates the client deployment

func (*K8sutil) CreateClientService

func (k *K8sutil) CreateClientService(clusterName, namespace string, nodePort int32) error

CreateClientService creates the client service

func (*K8sutil) CreateConfigMap

func (k *K8sutil) CreateConfigMap(namespace string, name string, data map[string]string) error

CreateConfigMap creates a new configMap

func (*K8sutil) CreateDataNodeDeployment

func (k *K8sutil) CreateDataNodeDeployment(deploymentType string, replicas *int32, baseImage, storageClass string, dataDiskSize string, resources myspec.Resources,
	imagePullSecrets []myspec.ImagePullSecrets, imagePullPolicy, serviceAccountName, clusterName, statsdEndpoint, networkHost, namespace, javaOptions, masterJavaOptions, dataJavaOptions string, useSSL *bool, esUrl string, nodeSelector map[string]string, tolerations []v1.Toleration) error

CreateDataNodeDeployment creates the data node deployment

func (*K8sutil) CreateDataService

func (k *K8sutil) CreateDataService(clusterName, namespace string) error

CreateDataService creates the data service

func (*K8sutil) CreateDiscoveryService

func (k *K8sutil) CreateDiscoveryService(clusterName, namespace string) error

CreateDiscoveryService creates the discovery service

func (*K8sutil) CreateKibanaDeployment

func (k *K8sutil) CreateKibanaDeployment(baseImage, clusterName, namespace string, imagePullSecrets []myspec.ImagePullSecrets, imagePullPolicy string, serviceAccountName string, useSSL *bool) error

CreateKibanaDeployment creates a deployment of Kibana

func (*K8sutil) CreateKubernetesCustomResourceDefinition

func (k *K8sutil) CreateKubernetesCustomResourceDefinition() error

CreateKubernetesCustomResourceDefinition checks if ElasticSearch CRD exists. If not, create

func (*K8sutil) CreateMgmtService

func (k *K8sutil) CreateMgmtService(service string, clusterName, namespace string) error

CreateMgmtServices creates service for kibana or cerebro

func (*K8sutil) CreateNodeInitDaemonset

func (k *K8sutil) CreateNodeInitDaemonset() error

CreateNodeInitDaemonset creates the node init daemonset

func (*K8sutil) CreateStorageClass

func (k *K8sutil) CreateStorageClass(zone, storageClassProvisioner, storageType string, clusterName string, useEncryption string) error

CreateStorageClass creates a storage class NOTE: Right now only creating AWS EBS volumes type gp2

func (*K8sutil) DeleteCertsSecret

func (k *K8sutil) DeleteCertsSecret(namespace, clusterName string) error

DeleteCertsSecret deletes the certs secret

func (*K8sutil) DeleteDeployment

func (k *K8sutil) DeleteDeployment(clusterName, namespace, deploymentType string) error

TODO just mount the secret needed by each deployment DeleteDeployment deletes a deployment

func (*K8sutil) DeleteServices

func (k *K8sutil) DeleteServices(clusterName, namespace string) error

DeleteServices creates the discovery service

func (*K8sutil) DeleteStatefulSet

func (k *K8sutil) DeleteStatefulSet(deploymentType, clusterName, namespace string) error

DeleteStatefulSet deletes the data statefulset

func (*K8sutil) DeleteStorageClasses

func (k *K8sutil) DeleteStorageClasses(clusterName string) error

DeleteStorageClasses removes storage classes tied to the operator

func (*K8sutil) GenerateCerts

func (k *K8sutil) GenerateCerts(configDir, certsDir, namespace, clusterName string) error

GenerateCerts creates certs

func (*K8sutil) GetClientServiceName

func (k *K8sutil) GetClientServiceName(clusterName string) string

GetClientServiceName return the name of the client service

func (*K8sutil) GetClientServiceNameFullDNS

func (k *K8sutil) GetClientServiceNameFullDNS(clusterName, namespace string) string

GetClientServiceNameFullDNS return the full DNS name of the client service

func (*K8sutil) GetMasterNodes

func (k *K8sutil) GetMasterNodes(namespace string, name string) (*v1.PodList, error)

GetMasterNodes returns all master node pods

func (*K8sutil) MonitorDataPods

func (k *K8sutil) MonitorDataPods(stopchan chan struct{}) (<-chan *v1.Pod, <-chan error)

MonitorDataPods watches for new or changed data node pods

func (*K8sutil) MonitorElasticSearchEvents

func (k *K8sutil) MonitorElasticSearchEvents(stopchan chan struct{}) (<-chan *myspec.ElasticsearchCluster, <-chan error)

MonitorElasticSearchEvents watches for new or removed clusters

func (*K8sutil) UpdateConfigMap

func (k *K8sutil) UpdateConfigMap(namespace string, name string, data map[string]string) error

UpdateConfigMap update a existent configmap

func (*K8sutil) UpdateVolumeReclaimPolicy

func (k *K8sutil) UpdateVolumeReclaimPolicy(policy, namespace string, name string)

UpdateVolumeReclaimPolicy updates the policy of the volume after it's created: See: https://github.com/kubernetes/kubernetes/issues/38192

Jump to

Keyboard shortcuts

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