utils

package
v0.0.0-...-5f555e2 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2021 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EMPTY_CONDITION = ""
	KAFKA_INSTANCE  = "kafka"
	ZK_INSTANCE     = "zookeeper-instance"
)
View Source
const (
	POD_NAME       = "kdc"
	CONTAINER_NAME = "kdc"
)
View Source
const (
	KAFKA_FRAMEWORK_DIR_ENV = "KAFKA_FRAMEWORK_DIR"
	ZK_FRAMEWORK_DIR_ENV    = "ZK_FRAMEWORK_DIR"
)
View Source
const (
	Alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
)

Variables

View Source
var (
	KClient       = &KubernetesTestClient{client, context.TODO()}
	KubeConfig, _ = BuildKubeConfig(kubeconfig)
)
View Source
var (
	DefaultStatefulReadyWaitSeconds = 300 * time.Second
)

Functions

func Apply

func Apply(resourcesAbsoluteDirectoryPath, namespace string)

func BuildKubeConfig

func BuildKubeConfig(kubeconfig string) (*rest.Config, error)

func Delete

func Delete(resourcesAbsoluteDirectoryPath, namespace string)

func DeleteInstances

func DeleteInstances(namespace, name string)

func DeletePVCs

func DeletePVCs(containsString string) error

func GetKafkaKeyTabs

func GetKafkaKeyTabs(brokers int, namespace string) []string

func GetKubernetesClient

func GetKubernetesClient() (*kubernetes.Clientset, error)

func GetRandString

func GetRandString(length int) (string, error)

func InstallKudoOperator

func InstallKudoOperator(namespace, name, operatorPathEnv string, parameters map[string]string)

func Retry

func Retry(attempts int, sleep time.Duration, condition string, f func() (string, error)) (resp string, err error)

func Setup

func Setup(namespace string)

func SetupWithKerberos

func SetupWithKerberos(namespace string, tlsEnabled bool)

func String

func String(s string) *string

func TearDown

func TearDown(namespace string)

Types

type KDCClient

type KDCClient struct {
	Namespace string
	// contains filtered or unexported fields
}

KDCClient Struct defining the KDC Client

func (*KDCClient) CreateKeytabSecret

func (k *KDCClient) CreateKeytabSecret(principals []string, serviceName string, secretName string) error

CreateKeytabSecret Pass it string array of principals and it will create a keytab secret

func (*KDCClient) Deploy

func (k *KDCClient) Deploy() error

Deploy Use it to deploy the kdc server

func (*KDCClient) SetNamespace

func (k *KDCClient) SetNamespace(Namespace string)

setNamespace Set Namespace

func (*KDCClient) TearDown

func (k *KDCClient) TearDown() error

TearDown Use it to destroy the kdc server

type KafkaClient

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

func NewKafkaClient

func NewKafkaClient(kuberentesTestClient *KubernetesTestClient, configuration *KafkaClientConfiguration) *KafkaClient

func (*KafkaClient) BrokerAddressIsRegistered

func (c *KafkaClient) BrokerAddressIsRegistered(podName, container string) bool

func (*KafkaClient) CheckForValueInFile

func (c *KafkaClient) CheckForValueInFile(expectedValue, filePath, ns, pod, containerName string) (string, error)

func (*KafkaClient) CreateTopic

func (c *KafkaClient) CreateTopic(podName, container, topicName, replicationAssignment string) (string, error)

func (*KafkaClient) DescribeTopic

func (c *KafkaClient) DescribeTopic(podName, container, topicName string) (string, error)

func (*KafkaClient) ExecInPod

func (c *KafkaClient) ExecInPod(namespace, name, container string, commands []string) (string, error)

func (*KafkaClient) GetPortForInstance

func (c *KafkaClient) GetPortForInstance() (string, error)

func (*KafkaClient) ReadFromTopic

func (c *KafkaClient) ReadFromTopic(podName, container, topicName, message string) (string, error)

func (*KafkaClient) WaitForBrokersToBeRegisteredWithService

func (c *KafkaClient) WaitForBrokersToBeRegisteredWithService(podName, container string, timeoutSeconds time.Duration) error

func (*KafkaClient) WriteInTopic

func (c *KafkaClient) WriteInTopic(podName, container, topicName, message string) (string, error)

type KafkaClientConfiguration

type KafkaClientConfiguration struct {
	Retry           *int
	RetryInterval   *time.Duration
	Namespace       *string
	InstanceName    *string
	KerberosEnabled bool
	TLSEnabled      bool
}

type KubernetesTestClient

type KubernetesTestClient struct {
	*kubernetes.Clientset
	Ctx context.Context
}

func (*KubernetesTestClient) CheckIfPodExists

func (c *KubernetesTestClient) CheckIfPodExists(name, namespace string) bool

func (*KubernetesTestClient) CreateNamespace

func (c *KubernetesTestClient) CreateNamespace(name string, updateIfExists bool) (*v1.Namespace, error)

func (*KubernetesTestClient) CreateTLSCertSecret

func (c *KubernetesTestClient) CreateTLSCertSecret(namespace, secretName, commonName string) (*v1.Secret, error)

func (*KubernetesTestClient) DeleteInstance

func (c *KubernetesTestClient) DeleteInstance(namespace, name string)

func (*KubernetesTestClient) DeleteNamespace

func (c *KubernetesTestClient) DeleteNamespace(name string) error

func (*KubernetesTestClient) DeletePVCs

func (c *KubernetesTestClient) DeletePVCs(containsString string) error

func (*KubernetesTestClient) ExecInPod

func (c *KubernetesTestClient) ExecInPod(namespace string, podName string, containerName string, commands []string) (string, error)

func (*KubernetesTestClient) GetInstancesInNamespace

func (c *KubernetesTestClient) GetInstancesInNamespace(namespace string) (*v1beta1.InstanceList, error)

func (*KubernetesTestClient) GetOperatorVersionForKudoInstance

func (c *KubernetesTestClient) GetOperatorVersionForKudoInstance(name, namespace string) (string, error)

func (*KubernetesTestClient) GetParamForKudoFrameworkVersion

func (c *KubernetesTestClient) GetParamForKudoFrameworkVersion(ref corev1.ObjectReference, namespace, param string) (string, error)

func (*KubernetesTestClient) GetParamForKudoInstance

func (c *KubernetesTestClient) GetParamForKudoInstance(name, namespace, param string) (string, error)

func (*KubernetesTestClient) GetPlanStatusForInstance

func (c *KubernetesTestClient) GetPlanStatusForInstance(name, namespace string) (v1beta1.ExecutionStatus, error)

func (*KubernetesTestClient) GetPod

func (c *KubernetesTestClient) GetPod(name, namespace string) (*v1.Pod, error)

func (*KubernetesTestClient) GetServices

func (c *KubernetesTestClient) GetServices(name string, namespace string) *v1.ServiceList

func (*KubernetesTestClient) GetServicesCount

func (c *KubernetesTestClient) GetServicesCount(name string, namespace string) int

func (*KubernetesTestClient) GetStatefulSet

func (c *KubernetesTestClient) GetStatefulSet(name, namespace string) *apps_v1.StatefulSet

func (*KubernetesTestClient) GetStatefulSetCount

func (c *KubernetesTestClient) GetStatefulSetCount(name, namespace string) int

func (*KubernetesTestClient) GetStatefulSetReadyReplicasCount

func (c *KubernetesTestClient) GetStatefulSetReadyReplicasCount(name, namespace string) int

func (*KubernetesTestClient) InstallOperatorFromPath

func (c *KubernetesTestClient) InstallOperatorFromPath(resourcesAbsoluteDirectoryPath, namespace, name string, params map[string]string)

func (*KubernetesTestClient) InstallOperatorFromRepository

func (c *KubernetesTestClient) InstallOperatorFromRepository(namespace, operatorName, instanceName, version string, params map[string]string)

func (*KubernetesTestClient) ListStatefulSets

func (c *KubernetesTestClient) ListStatefulSets(namespace string)

func (*KubernetesTestClient) LogObjectsOfKinds

func (c *KubernetesTestClient) LogObjectsOfKinds(namespace string, components []string)

func (*KubernetesTestClient) PrintLogsOfNamespace

func (c *KubernetesTestClient) PrintLogsOfNamespace(namespace string)

func (*KubernetesTestClient) PrintLogsOfPod

func (c *KubernetesTestClient) PrintLogsOfPod(containerName, podName, namespace string)

func (*KubernetesTestClient) UpdateInstanceParams

func (c *KubernetesTestClient) UpdateInstanceParams(name, namespace string, mapParam map[string]string) error

func (*KubernetesTestClient) UpdateInstancesCount

func (c *KubernetesTestClient) UpdateInstancesCount(name, namespace string, count int) error

func (*KubernetesTestClient) UpdateNamespace

func (c *KubernetesTestClient) UpdateNamespace(name string) (*v1.Namespace, error)

func (*KubernetesTestClient) UpgardeInstanceFromPath

func (c *KubernetesTestClient) UpgardeInstanceFromPath(resourcesAbsoluteDirectoryPath, namespace, name string, params map[string]string)

func (*KubernetesTestClient) UpgardeInstanceFromRepository

func (c *KubernetesTestClient) UpgardeInstanceFromRepository(namespace, operatorName, instanceName, version string, params map[string]string)

func (*KubernetesTestClient) WaitForContainerToBeReady

func (c *KubernetesTestClient) WaitForContainerToBeReady(containerName, podName, namespace string, timeoutSeconds time.Duration) error

func (*KubernetesTestClient) WaitForPod

func (c *KubernetesTestClient) WaitForPod(name, namespace string, timeoutSeconds time.Duration) error

func (*KubernetesTestClient) WaitForStatefulSetCount

func (c *KubernetesTestClient) WaitForStatefulSetCount(name, namespace string, count int, timeoutSeconds time.Duration) error

func (*KubernetesTestClient) WaitForStatefulSetReadyReplicasCount

func (c *KubernetesTestClient) WaitForStatefulSetReadyReplicasCount(name, namespace string, count int, timeoutSeconds time.Duration) error

func (*KubernetesTestClient) WaitForStatus

func (c *KubernetesTestClient) WaitForStatus(name, namespace string, expectedStatus v1beta1.ExecutionStatus, timeoutSeconds time.Duration) error

type TLSGenerator

type TLSGenerator struct{}

Jump to

Keyboard shortcuts

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