testutil

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

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

Go to latest
Published: Jul 6, 2023 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ConfigmapResourceType is a resource type which controller watches for changes
	ConfigmapResourceType = "configMaps"
	// SecretResourceType is a resource type which controller watches for changes
	SecretResourceType = "secrets"
)
View Source
var (
	Clients             = kube.GetClients()
	Pod                 = "test-reloader-" + RandSeq(5)
	Namespace           = "test-reloader-" + RandSeq(5)
	ConfigmapNamePrefix = "testconfigmap-reloader"
	SecretNamePrefix    = "testsecret-reloader"
	Data                = "dGVzdFNlY3JldEVuY29kaW5nRm9yUmVsb2FkZXI="
	NewData             = "dGVzdE5ld1NlY3JldEVuY29kaW5nRm9yUmVsb2FkZXI="
	UpdatedData         = "dGVzdFVwZGF0ZWRTZWNyZXRFbmNvZGluZ0ZvclJlbG9hZGVy"
	Collectors          = metrics.NewCollectors()
	SleepDuration       = 3 * time.Second
)

Functions

func ConvertResourceToSHA

func ConvertResourceToSHA(resourceType string, namespace string, resourceName string, data string) string

ConvertResourceToSHA generates SHA from secret or configmap data

func CreateConfigMap

func CreateConfigMap(client kubernetes.Interface, namespace string, configmapName string, data string) (core_v1.ConfigMapInterface, error)

CreateConfigMap creates a configmap in given namespace and returns the ConfigMapInterface

func CreateDaemonSet

func CreateDaemonSet(client kubernetes.Interface, daemonsetName string, namespace string, volumeMount bool) (*appsv1.DaemonSet, error)

CreateDaemonSet creates a deployment in given namespace and returns the DaemonSet

func CreateDeployment

func CreateDeployment(client kubernetes.Interface, deploymentName string, namespace string, volumeMount bool) (*appsv1.Deployment, error)

CreateDeployment creates a deployment in given namespace and returns the Deployment

func CreateDeploymentConfig

func CreateDeploymentConfig(client appsclient.Interface, deploymentName string, namespace string, volumeMount bool) (*openshiftv1.DeploymentConfig, error)

CreateDeploymentConfig creates a deploymentConfig in given namespace and returns the DeploymentConfig

func CreateDeploymentWithEnvVarSource

func CreateDeploymentWithEnvVarSource(client kubernetes.Interface, deploymentName string, namespace string) (*appsv1.Deployment, error)

CreateDeploymentWithEnvVarSource creates a deployment in given namespace and returns the Deployment

func CreateDeploymentWithEnvVarSourceAndAnnotations

func CreateDeploymentWithEnvVarSourceAndAnnotations(client kubernetes.Interface, deploymentName string, namespace string, annotations map[string]string) (*appsv1.Deployment, error)

CreateDeploymentWithEnvVarSourceAndAnnotations returns a deployment in given namespace with given annotations.

func CreateDeploymentWithInitContainer

func CreateDeploymentWithInitContainer(client kubernetes.Interface, deploymentName string, namespace string, volumeMount bool) (*appsv1.Deployment, error)

CreateDeploymentWithInitContainer creates a deployment in given namespace with init container and returns the Deployment

func CreateDeploymentWithPodAnnotations

func CreateDeploymentWithPodAnnotations(client kubernetes.Interface, deploymentName string, namespace string, both bool) (*appsv1.Deployment, error)

CreateDeploymentWithPodAnnotations creates a deployment in given namespace and returns the Deployment

func CreateNamespace

func CreateNamespace(namespace string, client kubernetes.Interface)

CreateNamespace creates namespace for testing

func CreateSecret

func CreateSecret(client kubernetes.Interface, namespace string, secretName string, data string) (core_v1.SecretInterface, error)

CreateSecret creates a secret in given namespace and returns the SecretInterface

func CreateStatefulSet

func CreateStatefulSet(client kubernetes.Interface, statefulsetName string, namespace string, volumeMount bool) (*appsv1.StatefulSet, error)

CreateStatefulSet creates a deployment in given namespace and returns the StatefulSet

func DeleteConfigMap

func DeleteConfigMap(client kubernetes.Interface, namespace string, configmapName string) error

DeleteConfigMap deletes a configmap in given namespace and returns the error if any

func DeleteDaemonSet

func DeleteDaemonSet(client kubernetes.Interface, namespace string, daemonsetName string) error

DeleteDaemonSet creates a daemonset in given namespace and returns the error if any

func DeleteDeployment

func DeleteDeployment(client kubernetes.Interface, namespace string, deploymentName string) error

DeleteDeployment creates a deployment in given namespace and returns the error if any

func DeleteDeploymentConfig

func DeleteDeploymentConfig(client appsclient.Interface, namespace string, deploymentConfigName string) error

DeleteDeploymentConfig deletes a deploymentConfig in given namespace and returns the error if any

func DeleteNamespace

func DeleteNamespace(namespace string, client kubernetes.Interface)

DeleteNamespace deletes namespace for testing

func DeleteSecret

func DeleteSecret(client kubernetes.Interface, namespace string, secretName string) error

DeleteSecret deletes a secret in given namespace and returns the error if any

func DeleteStatefulSet

func DeleteStatefulSet(client kubernetes.Interface, namespace string, statefulsetName string) error

DeleteStatefulSet creates a statefulset in given namespace and returns the error if any

func GetConfigmap

func GetConfigmap(namespace string, configmapName string, testData string) *v1.ConfigMap

GetConfigmap provides configmap for testing

func GetConfigmapWithUpdatedLabel

func GetConfigmapWithUpdatedLabel(namespace string, configmapName string, testLabel string, testData string) *v1.ConfigMap

GetConfigmapWithUpdatedLabel provides configmap for testing

func GetDaemonSet

func GetDaemonSet(namespace string, daemonsetName string) *appsv1.DaemonSet

GetDaemonSet provides daemonset for testing

func GetDaemonSetWithEnvVars

func GetDaemonSetWithEnvVars(namespace string, daemonSetName string) *appsv1.DaemonSet

func GetDeployment

func GetDeployment(namespace string, deploymentName string) *appsv1.Deployment

GetDeployment provides deployment for testing

func GetDeploymentConfig

func GetDeploymentConfig(namespace string, deploymentConfigName string) *openshiftv1.DeploymentConfig

GetDeploymentConfig provides deployment for testing

func GetDeploymentConfigWithEnvVars

func GetDeploymentConfigWithEnvVars(namespace string, deploymentConfigName string) *openshiftv1.DeploymentConfig

func GetDeploymentWithEnvVarSources

func GetDeploymentWithEnvVarSources(namespace string, deploymentName string) *appsv1.Deployment

func GetDeploymentWithEnvVars

func GetDeploymentWithEnvVars(namespace string, deploymentName string) *appsv1.Deployment

func GetDeploymentWithInitContainer

func GetDeploymentWithInitContainer(namespace string, deploymentName string) *appsv1.Deployment

GetDeploymentWithInitContainer provides deployment with init container and volumeMounts

func GetDeploymentWithInitContainerAndEnv

func GetDeploymentWithInitContainerAndEnv(namespace string, deploymentName string) *appsv1.Deployment

GetDeploymentWithInitContainerAndEnv provides deployment with init container and EnvSource

func GetDeploymentWithPodAnnotations

func GetDeploymentWithPodAnnotations(namespace string, deploymentName string, both bool) *appsv1.Deployment

func GetResourceSHAFromAnnotation

func GetResourceSHAFromAnnotation(podAnnotations map[string]string) string

GetResourceSHAFromAnnotation returns the SHA value of given environment variable

func GetResourceSHAFromEnvVar

func GetResourceSHAFromEnvVar(containers []v1.Container, envVar string) string

GetResourceSHAFromEnvVar returns the SHA value of given environment variable

func GetSecret

func GetSecret(namespace string, secretName string, data string) *v1.Secret

GetSecret provides secret for testing

func GetSecretWithUpdatedLabel

func GetSecretWithUpdatedLabel(namespace string, secretName string, label string, data string) *v1.Secret

GetSecretWithUpdatedLabel provides secret for testing

func GetStatefulSet

func GetStatefulSet(namespace string, statefulsetName string) *appsv1.StatefulSet

GetStatefulSet provides statefulset for testing

func GetStatefulSetWithEnvVar

func GetStatefulSetWithEnvVar(namespace string, statefulsetName string) *appsv1.StatefulSet

GetStatefulSet provides statefulset for testing

func RandSeq

func RandSeq(n int) string

RandSeq generates a random sequence

func UpdateConfigMap

func UpdateConfigMap(configmapClient core_v1.ConfigMapInterface, namespace string, configmapName string, label string, data string) error

UpdateConfigMap updates a configmap in given namespace and returns the error if any

func UpdateSecret

func UpdateSecret(secretClient core_v1.SecretInterface, namespace string, secretName string, label string, data string) error

UpdateSecret updates a secret in given namespace and returns the error if any

func VerifyResourceAnnotationUpdate

func VerifyResourceAnnotationUpdate(clients kube.Clients, config util.Config, upgradeFuncs callbacks.RollingUpgradeFuncs) bool

VerifyResourceAnnotationUpdate verifies whether the rolling upgrade happened or not

func VerifyResourceEnvVarUpdate

func VerifyResourceEnvVarUpdate(clients kube.Clients, config util.Config, envVarPostfix string, upgradeFuncs callbacks.RollingUpgradeFuncs) bool

VerifyResourceEnvVarUpdate verifies whether the rolling upgrade happened or not

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳