testutil

package
v1.0.93 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 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 added in v0.0.37

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 added in v0.0.23

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 added in v0.0.60

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 added in v0.0.26

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 added in v0.0.52

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 CreateDeploymentWithTypedAutoAnnotation added in v1.0.76

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

CreateDeploymentWithTypedAutoAnnotation creates a deployment in given namespace and returns the Deployment with typed auto annotation

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 added in v0.0.37

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 added in v0.0.22

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 added in v0.0.37

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

GetDeploymentConfig provides deployment for testing

func GetDeploymentConfigWithEnvVars added in v0.0.37

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

func GetDeploymentWithEnvVarSources added in v0.0.23

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

func GetDeploymentWithEnvVars added in v0.0.22

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

func GetDeploymentWithInitContainer added in v0.0.26

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

GetDeploymentWithInitContainer provides deployment with init container and volumeMounts

func GetDeploymentWithInitContainerAndEnv added in v0.0.26

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

GetDeploymentWithInitContainerAndEnv provides deployment with init container and EnvSource

func GetDeploymentWithPodAnnotations added in v0.0.52

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

func GetDeploymentWithTypedAutoAnnotation added in v1.0.76

func GetDeploymentWithTypedAutoAnnotation(namespace string, deploymentName string, resourceType string) *appsv1.Deployment

func GetResourceSHAFromAnnotation added in v0.0.103

func GetResourceSHAFromAnnotation(podAnnotations map[string]string) string

GetResourceSHAFromAnnotation returns the SHA value of given environment variable

func GetResourceSHAFromEnvVar added in v0.0.103

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 added in v0.0.22

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 added in v0.0.103

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

VerifyResourceAnnotationUpdate verifies whether the rolling upgrade happened or not

func VerifyResourceEnvVarUpdate added in v0.0.103

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