|
|
|
|
@@ -26,48 +26,52 @@ import (
|
|
|
|
|
var (
|
|
|
|
|
clients = kube.Clients{KubernetesClient: testclient.NewSimpleClientset()}
|
|
|
|
|
|
|
|
|
|
arsNamespace = "test-handler-" + testutil.RandSeq(5)
|
|
|
|
|
arsConfigmapName = "testconfigmap-handler-" + testutil.RandSeq(5)
|
|
|
|
|
arsSecretName = "testsecret-handler-" + testutil.RandSeq(5)
|
|
|
|
|
arsProjectedConfigMapName = "testprojectedconfigmap-handler-" + testutil.RandSeq(5)
|
|
|
|
|
arsProjectedSecretName = "testprojectedsecret-handler-" + testutil.RandSeq(5)
|
|
|
|
|
arsConfigmapWithInitContainer = "testconfigmapInitContainerhandler-" + testutil.RandSeq(5)
|
|
|
|
|
arsSecretWithInitContainer = "testsecretWithInitContainer-handler-" + testutil.RandSeq(5)
|
|
|
|
|
arsProjectedConfigMapWithInitContainer = "testProjectedConfigMapWithInitContainer-handler" + testutil.RandSeq(5)
|
|
|
|
|
arsProjectedSecretWithInitContainer = "testProjectedSecretWithInitContainer-handler" + testutil.RandSeq(5)
|
|
|
|
|
arsConfigmapWithInitEnv = "configmapWithInitEnv-" + testutil.RandSeq(5)
|
|
|
|
|
arsSecretWithInitEnv = "secretWithInitEnv-handler-" + testutil.RandSeq(5)
|
|
|
|
|
arsConfigmapWithEnvName = "testconfigmapWithEnv-handler-" + testutil.RandSeq(5)
|
|
|
|
|
arsConfigmapWithEnvFromName = "testconfigmapWithEnvFrom-handler-" + testutil.RandSeq(5)
|
|
|
|
|
arsSecretWithEnvName = "testsecretWithEnv-handler-" + testutil.RandSeq(5)
|
|
|
|
|
arsSecretWithEnvFromName = "testsecretWithEnvFrom-handler-" + testutil.RandSeq(5)
|
|
|
|
|
arsConfigmapWithPodAnnotations = "testconfigmapPodAnnotations-handler-" + testutil.RandSeq(5)
|
|
|
|
|
arsConfigmapWithBothAnnotations = "testconfigmapBothAnnotations-handler-" + testutil.RandSeq(5)
|
|
|
|
|
arsConfigmapAnnotated = "testconfigmapAnnotated-handler-" + testutil.RandSeq(5)
|
|
|
|
|
arsConfigMapWithNonAnnotatedDeployment = "testconfigmapNonAnnotatedDeployment-handler-" + testutil.RandSeq(5)
|
|
|
|
|
arsSecretWithSecretAutoAnnotation = "testsecretwithsecretautoannotationdeployment-handler-" + testutil.RandSeq(5)
|
|
|
|
|
arsConfigmapWithConfigMapAutoAnnotation = "testconfigmapwithconfigmapautoannotationdeployment-handler-" + testutil.RandSeq(5)
|
|
|
|
|
arsNamespace = "test-handler-" + testutil.RandSeq(5)
|
|
|
|
|
arsConfigmapName = "testconfigmap-handler-" + testutil.RandSeq(5)
|
|
|
|
|
arsSecretName = "testsecret-handler-" + testutil.RandSeq(5)
|
|
|
|
|
arsProjectedConfigMapName = "testprojectedconfigmap-handler-" + testutil.RandSeq(5)
|
|
|
|
|
arsProjectedSecretName = "testprojectedsecret-handler-" + testutil.RandSeq(5)
|
|
|
|
|
arsConfigmapWithInitContainer = "testconfigmapInitContainerhandler-" + testutil.RandSeq(5)
|
|
|
|
|
arsSecretWithInitContainer = "testsecretWithInitContainer-handler-" + testutil.RandSeq(5)
|
|
|
|
|
arsProjectedConfigMapWithInitContainer = "testProjectedConfigMapWithInitContainer-handler" + testutil.RandSeq(5)
|
|
|
|
|
arsProjectedSecretWithInitContainer = "testProjectedSecretWithInitContainer-handler" + testutil.RandSeq(5)
|
|
|
|
|
arsConfigmapWithInitEnv = "configmapWithInitEnv-" + testutil.RandSeq(5)
|
|
|
|
|
arsSecretWithInitEnv = "secretWithInitEnv-handler-" + testutil.RandSeq(5)
|
|
|
|
|
arsConfigmapWithEnvName = "testconfigmapWithEnv-handler-" + testutil.RandSeq(5)
|
|
|
|
|
arsConfigmapWithEnvFromName = "testconfigmapWithEnvFrom-handler-" + testutil.RandSeq(5)
|
|
|
|
|
arsSecretWithEnvName = "testsecretWithEnv-handler-" + testutil.RandSeq(5)
|
|
|
|
|
arsSecretWithEnvFromName = "testsecretWithEnvFrom-handler-" + testutil.RandSeq(5)
|
|
|
|
|
arsConfigmapWithPodAnnotations = "testconfigmapPodAnnotations-handler-" + testutil.RandSeq(5)
|
|
|
|
|
arsConfigmapWithBothAnnotations = "testconfigmapBothAnnotations-handler-" + testutil.RandSeq(5)
|
|
|
|
|
arsConfigmapAnnotated = "testconfigmapAnnotated-handler-" + testutil.RandSeq(5)
|
|
|
|
|
arsConfigMapWithNonAnnotatedDeployment = "testconfigmapNonAnnotatedDeployment-handler-" + testutil.RandSeq(5)
|
|
|
|
|
arsSecretWithSecretAutoAnnotation = "testsecretwithsecretautoannotationdeployment-handler-" + testutil.RandSeq(5)
|
|
|
|
|
arsConfigmapWithConfigMapAutoAnnotation = "testconfigmapwithconfigmapautoannotationdeployment-handler-" + testutil.RandSeq(5)
|
|
|
|
|
arsSecretWithExcludeSecretAnnotation = "testsecretwithsecretexcludeannotationdeployment-handler-" + testutil.RandSeq(5)
|
|
|
|
|
arsConfigmapWithExcludeConfigMapAnnotation = "testconfigmapwithconfigmapexcludeannotationdeployment-handler-" + testutil.RandSeq(5)
|
|
|
|
|
|
|
|
|
|
ersNamespace = "test-handler-" + testutil.RandSeq(5)
|
|
|
|
|
ersConfigmapName = "testconfigmap-handler-" + testutil.RandSeq(5)
|
|
|
|
|
ersSecretName = "testsecret-handler-" + testutil.RandSeq(5)
|
|
|
|
|
ersProjectedConfigMapName = "testprojectedconfigmap-handler-" + testutil.RandSeq(5)
|
|
|
|
|
ersProjectedSecretName = "testprojectedsecret-handler-" + testutil.RandSeq(5)
|
|
|
|
|
ersConfigmapWithInitContainer = "testconfigmapInitContainerhandler-" + testutil.RandSeq(5)
|
|
|
|
|
ersSecretWithInitContainer = "testsecretWithInitContainer-handler-" + testutil.RandSeq(5)
|
|
|
|
|
ersProjectedConfigMapWithInitContainer = "testProjectedConfigMapWithInitContainer-handler" + testutil.RandSeq(5)
|
|
|
|
|
ersProjectedSecretWithInitContainer = "testProjectedSecretWithInitContainer-handler" + testutil.RandSeq(5)
|
|
|
|
|
ersConfigmapWithInitEnv = "configmapWithInitEnv-" + testutil.RandSeq(5)
|
|
|
|
|
ersSecretWithInitEnv = "secretWithInitEnv-handler-" + testutil.RandSeq(5)
|
|
|
|
|
ersConfigmapWithEnvName = "testconfigmapWithEnv-handler-" + testutil.RandSeq(5)
|
|
|
|
|
ersConfigmapWithEnvFromName = "testconfigmapWithEnvFrom-handler-" + testutil.RandSeq(5)
|
|
|
|
|
ersSecretWithEnvName = "testsecretWithEnv-handler-" + testutil.RandSeq(5)
|
|
|
|
|
ersSecretWithEnvFromName = "testsecretWithEnvFrom-handler-" + testutil.RandSeq(5)
|
|
|
|
|
ersConfigmapWithPodAnnotations = "testconfigmapPodAnnotations-handler-" + testutil.RandSeq(5)
|
|
|
|
|
ersConfigmapWithBothAnnotations = "testconfigmapBothAnnotations-handler-" + testutil.RandSeq(5)
|
|
|
|
|
ersConfigmapAnnotated = "testconfigmapAnnotated-handler-" + testutil.RandSeq(5)
|
|
|
|
|
ersSecretWithSecretAutoAnnotation = "testsecretwithsecretautoannotationdeployment-handler-" + testutil.RandSeq(5)
|
|
|
|
|
ersConfigmapWithConfigMapAutoAnnotation = "testconfigmapwithconfigmapautoannotationdeployment-handler-" + testutil.RandSeq(5)
|
|
|
|
|
ersNamespace = "test-handler-" + testutil.RandSeq(5)
|
|
|
|
|
ersConfigmapName = "testconfigmap-handler-" + testutil.RandSeq(5)
|
|
|
|
|
ersSecretName = "testsecret-handler-" + testutil.RandSeq(5)
|
|
|
|
|
ersProjectedConfigMapName = "testprojectedconfigmap-handler-" + testutil.RandSeq(5)
|
|
|
|
|
ersProjectedSecretName = "testprojectedsecret-handler-" + testutil.RandSeq(5)
|
|
|
|
|
ersConfigmapWithInitContainer = "testconfigmapInitContainerhandler-" + testutil.RandSeq(5)
|
|
|
|
|
ersSecretWithInitContainer = "testsecretWithInitContainer-handler-" + testutil.RandSeq(5)
|
|
|
|
|
ersProjectedConfigMapWithInitContainer = "testProjectedConfigMapWithInitContainer-handler" + testutil.RandSeq(5)
|
|
|
|
|
ersProjectedSecretWithInitContainer = "testProjectedSecretWithInitContainer-handler" + testutil.RandSeq(5)
|
|
|
|
|
ersConfigmapWithInitEnv = "configmapWithInitEnv-" + testutil.RandSeq(5)
|
|
|
|
|
ersSecretWithInitEnv = "secretWithInitEnv-handler-" + testutil.RandSeq(5)
|
|
|
|
|
ersConfigmapWithEnvName = "testconfigmapWithEnv-handler-" + testutil.RandSeq(5)
|
|
|
|
|
ersConfigmapWithEnvFromName = "testconfigmapWithEnvFrom-handler-" + testutil.RandSeq(5)
|
|
|
|
|
ersSecretWithEnvName = "testsecretWithEnv-handler-" + testutil.RandSeq(5)
|
|
|
|
|
ersSecretWithEnvFromName = "testsecretWithEnvFrom-handler-" + testutil.RandSeq(5)
|
|
|
|
|
ersConfigmapWithPodAnnotations = "testconfigmapPodAnnotations-handler-" + testutil.RandSeq(5)
|
|
|
|
|
ersConfigmapWithBothAnnotations = "testconfigmapBothAnnotations-handler-" + testutil.RandSeq(5)
|
|
|
|
|
ersConfigmapAnnotated = "testconfigmapAnnotated-handler-" + testutil.RandSeq(5)
|
|
|
|
|
ersSecretWithSecretAutoAnnotation = "testsecretwithsecretautoannotationdeployment-handler-" + testutil.RandSeq(5)
|
|
|
|
|
ersConfigmapWithConfigMapAutoAnnotation = "testconfigmapwithconfigmapautoannotationdeployment-handler-" + testutil.RandSeq(5)
|
|
|
|
|
ersSecretWithSecretExcludeAnnotation = "testsecretwithsecretexcludeannotationdeployment-handler-" + testutil.RandSeq(5)
|
|
|
|
|
ersConfigmapWithConfigMapExcludeAnnotation = "testconfigmapwithconfigmapexcludeannotationdeployment-handler-" + testutil.RandSeq(5)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func TestMain(m *testing.M) {
|
|
|
|
|
@@ -196,6 +200,18 @@ func setupArs() {
|
|
|
|
|
logrus.Errorf("Error in configmap creation: %v", err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Creating secret used with secret auto annotation
|
|
|
|
|
_, err = testutil.CreateSecret(clients.KubernetesClient, arsNamespace, arsSecretWithExcludeSecretAnnotation, data)
|
|
|
|
|
if err != nil {
|
|
|
|
|
logrus.Errorf("Error in secret creation: %v", err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Creating configmap used with configmap auto annotation
|
|
|
|
|
_, err = testutil.CreateConfigMap(clients.KubernetesClient, arsNamespace, arsConfigmapWithExcludeConfigMapAnnotation, "www.google.com")
|
|
|
|
|
if err != nil {
|
|
|
|
|
logrus.Errorf("Error in configmap creation: %v", err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Creating Deployment with configmap
|
|
|
|
|
_, err = testutil.CreateDeployment(clients.KubernetesClient, arsConfigmapName, arsNamespace, true)
|
|
|
|
|
if err != nil {
|
|
|
|
|
@@ -309,6 +325,18 @@ func setupArs() {
|
|
|
|
|
logrus.Errorf("Error in Deployment with configmap and with configmap auto annotation: %v", err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Creating Deployment with secret and exclude secret annotation
|
|
|
|
|
_, err = testutil.CreateDeploymentWithExcludeAnnotation(clients.KubernetesClient, arsSecretWithExcludeSecretAnnotation, arsNamespace, testutil.SecretResourceType)
|
|
|
|
|
if err != nil {
|
|
|
|
|
logrus.Errorf("Error in Deployment with secret and with secret exclude annotation: %v", err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Creating Deployment with secret and exclude configmap annotation
|
|
|
|
|
_, err = testutil.CreateDeploymentWithExcludeAnnotation(clients.KubernetesClient, arsConfigmapWithExcludeConfigMapAnnotation, arsNamespace, testutil.ConfigmapResourceType)
|
|
|
|
|
if err != nil {
|
|
|
|
|
logrus.Errorf("Error in Deployment with configmap and with configmap exclude annotation: %v", err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Creating DaemonSet with configmap
|
|
|
|
|
_, err = testutil.CreateDaemonSet(clients.KubernetesClient, arsConfigmapName, arsNamespace, true)
|
|
|
|
|
if err != nil {
|
|
|
|
|
@@ -510,6 +538,18 @@ func teardownArs() {
|
|
|
|
|
logrus.Errorf("Error while deleting deployment with configmap auto annotation %v", deploymentError)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Deleting Deployment with secret and exclude secret annotation
|
|
|
|
|
deploymentError = testutil.DeleteDeployment(clients.KubernetesClient, arsNamespace, arsSecretWithExcludeSecretAnnotation)
|
|
|
|
|
if deploymentError != nil {
|
|
|
|
|
logrus.Errorf("Error while deleting deployment with secret auto annotation %v", deploymentError)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Deleting Deployment with configmap and exclude configmap annotation
|
|
|
|
|
deploymentError = testutil.DeleteDeployment(clients.KubernetesClient, arsNamespace, arsConfigmapWithExcludeConfigMapAnnotation)
|
|
|
|
|
if deploymentError != nil {
|
|
|
|
|
logrus.Errorf("Error while deleting deployment with configmap auto annotation %v", deploymentError)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Deleting DaemonSet with configmap
|
|
|
|
|
daemonSetError := testutil.DeleteDaemonSet(clients.KubernetesClient, arsNamespace, arsConfigmapName)
|
|
|
|
|
if daemonSetError != nil {
|
|
|
|
|
@@ -683,6 +723,18 @@ func teardownArs() {
|
|
|
|
|
logrus.Errorf("Error while deleting the configmap used with configmap auto annotations: %v", err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Deleting Secret used with exclude secret annotation
|
|
|
|
|
err = testutil.DeleteSecret(clients.KubernetesClient, arsNamespace, arsSecretWithExcludeSecretAnnotation)
|
|
|
|
|
if err != nil {
|
|
|
|
|
logrus.Errorf("Error while deleting the secret used with secret auto annotations: %v", err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Deleting ConfigMap used with exclude configmap annotation
|
|
|
|
|
err = testutil.DeleteConfigMap(clients.KubernetesClient, arsNamespace, arsConfigmapWithExcludeConfigMapAnnotation)
|
|
|
|
|
if err != nil {
|
|
|
|
|
logrus.Errorf("Error while deleting the configmap used with configmap auto annotations: %v", err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Deleting namespace
|
|
|
|
|
testutil.DeleteNamespace(arsNamespace, clients.KubernetesClient)
|
|
|
|
|
|
|
|
|
|
@@ -787,6 +839,18 @@ func setupErs() {
|
|
|
|
|
logrus.Errorf("Error in configmap creation: %v", err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Creating secret used with secret exclude annotation
|
|
|
|
|
_, err = testutil.CreateSecret(clients.KubernetesClient, ersNamespace, ersSecretWithSecretExcludeAnnotation, data)
|
|
|
|
|
if err != nil {
|
|
|
|
|
logrus.Errorf("Error in secret creation: %v", err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Creating configmap used with configmap exclude annotation
|
|
|
|
|
_, err = testutil.CreateConfigMap(clients.KubernetesClient, ersNamespace, ersConfigmapWithConfigMapExcludeAnnotation, "www.google.com")
|
|
|
|
|
if err != nil {
|
|
|
|
|
logrus.Errorf("Error in configmap creation: %v", err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Creating Deployment with configmap
|
|
|
|
|
_, err = testutil.CreateDeployment(clients.KubernetesClient, ersConfigmapName, ersNamespace, true)
|
|
|
|
|
if err != nil {
|
|
|
|
|
@@ -894,6 +958,18 @@ func setupErs() {
|
|
|
|
|
logrus.Errorf("Error in Deployment with configmap and with configmap auto annotation: %v", err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Creating Deployment with secret and with secret exclude annotation
|
|
|
|
|
_, err = testutil.CreateDeploymentWithExcludeAnnotation(clients.KubernetesClient, ersSecretWithSecretExcludeAnnotation, ersNamespace, testutil.SecretResourceType)
|
|
|
|
|
if err != nil {
|
|
|
|
|
logrus.Errorf("Error in Deployment with secret and with secret exclude annotation: %v", err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Creating Deployment with secret and with secret exclude annotation
|
|
|
|
|
_, err = testutil.CreateDeploymentWithExcludeAnnotation(clients.KubernetesClient, ersConfigmapWithConfigMapExcludeAnnotation, ersNamespace, testutil.ConfigmapResourceType)
|
|
|
|
|
if err != nil {
|
|
|
|
|
logrus.Errorf("Error in Deployment with configmap and with configmap exclude annotation: %v", err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Creating DaemonSet with configmap
|
|
|
|
|
_, err = testutil.CreateDaemonSet(clients.KubernetesClient, ersConfigmapName, ersNamespace, true)
|
|
|
|
|
if err != nil {
|
|
|
|
|
@@ -1094,6 +1170,18 @@ func teardownErs() {
|
|
|
|
|
logrus.Errorf("Error while deleting deployment with configmap auto annotation %v", deploymentError)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Deleting Deployment with secret and secret exclude annotation
|
|
|
|
|
deploymentError = testutil.DeleteDeployment(clients.KubernetesClient, ersNamespace, ersSecretWithSecretExcludeAnnotation)
|
|
|
|
|
if deploymentError != nil {
|
|
|
|
|
logrus.Errorf("Error while deleting deployment with secret exclude annotation %v", deploymentError)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Deleting Deployment with configmap and configmap exclude annotation
|
|
|
|
|
deploymentError = testutil.DeleteDeployment(clients.KubernetesClient, ersNamespace, ersConfigmapWithConfigMapExcludeAnnotation)
|
|
|
|
|
if deploymentError != nil {
|
|
|
|
|
logrus.Errorf("Error while deleting deployment with configmap exclude annotation %v", deploymentError)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Deleting DaemonSet with configmap
|
|
|
|
|
daemonSetError := testutil.DeleteDaemonSet(clients.KubernetesClient, ersNamespace, ersConfigmapName)
|
|
|
|
|
if daemonSetError != nil {
|
|
|
|
|
@@ -1267,6 +1355,18 @@ func teardownErs() {
|
|
|
|
|
logrus.Errorf("Error while deleting the configmap used with configmap auto annotation: %v", err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Deleting Secret used with secret exclude annotation
|
|
|
|
|
err = testutil.DeleteSecret(clients.KubernetesClient, ersNamespace, ersSecretWithSecretExcludeAnnotation)
|
|
|
|
|
if err != nil {
|
|
|
|
|
logrus.Errorf("Error while deleting the secret used with secret exclude annotation: %v", err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Deleting ConfigMap used with configmap exclude annotation
|
|
|
|
|
err = testutil.DeleteConfigMap(clients.KubernetesClient, ersNamespace, ersConfigmapWithConfigMapExcludeAnnotation)
|
|
|
|
|
if err != nil {
|
|
|
|
|
logrus.Errorf("Error while deleting the configmap used with configmap exclude annotation: %v", err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Deleting namespace
|
|
|
|
|
testutil.DeleteNamespace(ersNamespace, clients.KubernetesClient)
|
|
|
|
|
|
|
|
|
|
@@ -1337,8 +1437,8 @@ func TestRollingUpgradeForDeploymentWithConfigmapUsingArs(t *testing.T) {
|
|
|
|
|
if promtestutil.ToFloat64(collectors.Reloaded.With(labelSucceeded)) != 1 {
|
|
|
|
|
t.Errorf("Counter was not increased")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if promtestutil.ToFloat64(collectors.ReloadedByNamespace.With(prometheus.Labels{"success": "true", "namespace": arsNamespace})) != 1 {
|
|
|
|
|
|
|
|
|
|
if promtestutil.ToFloat64(collectors.ReloadedByNamespace.With(prometheus.Labels{"success": "true", "namespace": arsNamespace})) != 1 {
|
|
|
|
|
t.Errorf("Counter by namespace was not increased")
|
|
|
|
|
}
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyArs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
@@ -1403,9 +1503,9 @@ func TestRollingUpgradeForDeploymentWithConfigmapWithoutReloadAnnotationButWithA
|
|
|
|
|
|
|
|
|
|
if promtestutil.ToFloat64(collectors.ReloadedByNamespace.With(prometheus.Labels{"success": "true", "namespace": arsNamespace})) != 1 {
|
|
|
|
|
t.Errorf("Counter by namespace was not increased")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyArs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyArs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRollingUpgradeForDeploymentWithConfigmapInProjectedVolumeUsingArs(t *testing.T) {
|
|
|
|
|
@@ -1432,11 +1532,11 @@ func TestRollingUpgradeForDeploymentWithConfigmapInProjectedVolumeUsingArs(t *te
|
|
|
|
|
t.Errorf("Counter was not increased")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if promtestutil.ToFloat64(collectors.ReloadedByNamespace.With(prometheus.Labels{"success": "true", "namespace": arsNamespace})) != 1 {
|
|
|
|
|
if promtestutil.ToFloat64(collectors.ReloadedByNamespace.With(prometheus.Labels{"success": "true", "namespace": arsNamespace})) != 1 {
|
|
|
|
|
t.Errorf("Counter by namespace was not increased")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyArs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyArs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRollingUpgradeForDeploymentWithConfigmapViaSearchAnnotationUsingArs(t *testing.T) {
|
|
|
|
|
@@ -1468,7 +1568,7 @@ func TestRollingUpgradeForDeploymentWithConfigmapViaSearchAnnotationUsingArs(t *
|
|
|
|
|
t.Errorf("Counter by namespace was not increased")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyArs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyArs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRollingUpgradeForDeploymentWithConfigmapViaSearchAnnotationNoTriggersUsingArs(t *testing.T) {
|
|
|
|
|
@@ -1575,7 +1675,7 @@ func TestRollingUpgradeForDeploymentWithConfigmapInInitContainerUsingArs(t *test
|
|
|
|
|
t.Errorf("Counter by namespace was not increased")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyArs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyArs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRollingUpgradeForDeploymentWithConfigmapInProjectVolumeInInitContainerUsingArs(t *testing.T) {
|
|
|
|
|
@@ -1607,7 +1707,7 @@ func TestRollingUpgradeForDeploymentWithConfigmapInProjectVolumeInInitContainerU
|
|
|
|
|
t.Errorf("Counter by namespace was not increased")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyArs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyArs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRollingUpgradeForDeploymentWithConfigmapAsEnvVarUsingArs(t *testing.T) {
|
|
|
|
|
@@ -1639,7 +1739,7 @@ func TestRollingUpgradeForDeploymentWithConfigmapAsEnvVarUsingArs(t *testing.T)
|
|
|
|
|
t.Errorf("Counter by namespace was not increased")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyArs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyArs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRollingUpgradeForDeploymentWithConfigmapAsEnvVarInInitContainerUsingArs(t *testing.T) {
|
|
|
|
|
@@ -1670,8 +1770,8 @@ func TestRollingUpgradeForDeploymentWithConfigmapAsEnvVarInInitContainerUsingArs
|
|
|
|
|
if promtestutil.ToFloat64(collectors.ReloadedByNamespace.With(prometheus.Labels{"success": "true", "namespace": arsNamespace})) != 1 {
|
|
|
|
|
t.Errorf("Counter by namespace was not increased")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyArs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyArs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRollingUpgradeForDeploymentWithConfigmapAsEnvVarFromUsingArs(t *testing.T) {
|
|
|
|
|
@@ -1703,7 +1803,7 @@ func TestRollingUpgradeForDeploymentWithConfigmapAsEnvVarFromUsingArs(t *testing
|
|
|
|
|
t.Errorf("Counter by namespace was not increased")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyArs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyArs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRollingUpgradeForDeploymentWithSecretUsingArs(t *testing.T) {
|
|
|
|
|
@@ -1735,7 +1835,7 @@ func TestRollingUpgradeForDeploymentWithSecretUsingArs(t *testing.T) {
|
|
|
|
|
t.Errorf("Counter by namespace was not increased")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyArs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyArs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRollingUpgradeForDeploymentWithSecretInProjectedVolumeUsingArs(t *testing.T) {
|
|
|
|
|
@@ -1767,7 +1867,7 @@ func TestRollingUpgradeForDeploymentWithSecretInProjectedVolumeUsingArs(t *testi
|
|
|
|
|
t.Errorf("Counter by namespace was not increased")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyArs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyArs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRollingUpgradeForDeploymentWithSecretinInitContainerUsingArs(t *testing.T) {
|
|
|
|
|
@@ -1799,7 +1899,7 @@ func TestRollingUpgradeForDeploymentWithSecretinInitContainerUsingArs(t *testing
|
|
|
|
|
t.Errorf("Counter by namespace was not increased")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyArs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyArs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRollingUpgradeForDeploymentWithSecretInProjectedVolumeinInitContainerUsingArs(t *testing.T) {
|
|
|
|
|
@@ -1831,7 +1931,7 @@ func TestRollingUpgradeForDeploymentWithSecretInProjectedVolumeinInitContainerUs
|
|
|
|
|
t.Errorf("Counter by namespace was not increased")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyArs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyArs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRollingUpgradeForDeploymentWithSecretAsEnvVarUsingArs(t *testing.T) {
|
|
|
|
|
@@ -1863,7 +1963,7 @@ func TestRollingUpgradeForDeploymentWithSecretAsEnvVarUsingArs(t *testing.T) {
|
|
|
|
|
t.Errorf("Counter by namespace was not increased")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyArs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyArs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRollingUpgradeForDeploymentWithSecretAsEnvVarFromUsingArs(t *testing.T) {
|
|
|
|
|
@@ -1926,7 +2026,28 @@ func TestRollingUpgradeForDeploymentWithSecretAsEnvVarInInitContainerUsingArs(t
|
|
|
|
|
t.Errorf("Counter by namespace was not increased")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyArs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyArs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRollingUpgradeForDeploymentWithSecretExcludeAnnotationUsingArs(t *testing.T) {
|
|
|
|
|
options.ReloadStrategy = constants.AnnotationsReloadStrategy
|
|
|
|
|
envVarPostfix := constants.SecretEnvVarPostfix
|
|
|
|
|
|
|
|
|
|
shaData := testutil.ConvertResourceToSHA(testutil.SecretResourceType, arsNamespace, arsSecretWithExcludeSecretAnnotation, "dGVzdFVwZGF0ZWRTZWNyZXRFbmNvZGluZ0ZvclJlbG9hZGVy")
|
|
|
|
|
config := getConfigWithAnnotations(envVarPostfix, arsSecretWithExcludeSecretAnnotation, shaData, "", options.SecretReloaderAutoAnnotation)
|
|
|
|
|
deploymentFuncs := GetDeploymentRollingUpgradeFuncs()
|
|
|
|
|
collectors := getCollectors()
|
|
|
|
|
|
|
|
|
|
err := PerformAction(clients, config, deploymentFuncs, collectors, nil, invokeReloadStrategy)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Errorf("Rolling upgrade failed for Deployment with Secret")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
logrus.Infof("Verifying deployment did not update")
|
|
|
|
|
updated := testutil.VerifyResourceAnnotationUpdate(clients, config, deploymentFuncs)
|
|
|
|
|
if updated {
|
|
|
|
|
t.Errorf("Deployment which had to be exluded was updated")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRollingUpgradeForDeploymentWithSecretAutoAnnotationUsingArs(t *testing.T) {
|
|
|
|
|
@@ -1958,9 +2079,29 @@ func TestRollingUpgradeForDeploymentWithSecretAutoAnnotationUsingArs(t *testing.
|
|
|
|
|
t.Errorf("Counter by namespace was not increased")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyArs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyArs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRollingUpgradeForDeploymentWithExcludeConfigMapAnnotationUsingArs(t *testing.T) {
|
|
|
|
|
options.ReloadStrategy = constants.AnnotationsReloadStrategy
|
|
|
|
|
envVarPostfix := constants.ConfigmapEnvVarPostfix
|
|
|
|
|
|
|
|
|
|
shaData := testutil.ConvertResourceToSHA(testutil.ConfigmapResourceType, arsNamespace, arsConfigmapWithExcludeConfigMapAnnotation, "www.facebook.com")
|
|
|
|
|
config := getConfigWithAnnotations(envVarPostfix, arsConfigmapWithExcludeConfigMapAnnotation, shaData, "", options.ConfigmapReloaderAutoAnnotation)
|
|
|
|
|
deploymentFuncs := GetDeploymentRollingUpgradeFuncs()
|
|
|
|
|
collectors := getCollectors()
|
|
|
|
|
|
|
|
|
|
err := PerformAction(clients, config, deploymentFuncs, collectors, nil, invokeReloadStrategy)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Errorf("Rolling upgrade failed for Deployment with exclude ConfigMap")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
logrus.Infof("Verifying deployment did update")
|
|
|
|
|
updated := testutil.VerifyResourceAnnotationUpdate(clients, config, deploymentFuncs)
|
|
|
|
|
if updated {
|
|
|
|
|
t.Errorf("Deployment which had to be excluded was updated")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
func TestRollingUpgradeForDeploymentWithConfigMapAutoAnnotationUsingArs(t *testing.T) {
|
|
|
|
|
options.ReloadStrategy = constants.AnnotationsReloadStrategy
|
|
|
|
|
envVarPostfix := constants.ConfigmapEnvVarPostfix
|
|
|
|
|
@@ -1990,7 +2131,7 @@ func TestRollingUpgradeForDeploymentWithConfigMapAutoAnnotationUsingArs(t *testi
|
|
|
|
|
t.Errorf("Counter by namespace was not increased")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyArs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyArs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRollingUpgradeForDaemonSetWithConfigmapUsingArs(t *testing.T) {
|
|
|
|
|
@@ -2021,8 +2162,8 @@ func TestRollingUpgradeForDaemonSetWithConfigmapUsingArs(t *testing.T) {
|
|
|
|
|
if promtestutil.ToFloat64(collectors.ReloadedByNamespace.With(prometheus.Labels{"success": "true", "namespace": arsNamespace})) != 1 {
|
|
|
|
|
t.Errorf("Counter by namespace was not increased")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyArs(t, clients, config, daemonSetFuncs, collectors, envVarPostfix)
|
|
|
|
|
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyArs(t, clients, config, daemonSetFuncs, collectors, envVarPostfix)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRollingUpgradeForDaemonSetWithConfigmapInProjectedVolumeUsingArs(t *testing.T) {
|
|
|
|
|
@@ -2054,7 +2195,7 @@ func TestRollingUpgradeForDaemonSetWithConfigmapInProjectedVolumeUsingArs(t *tes
|
|
|
|
|
t.Errorf("Counter by namespace was not increased")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyArs(t, clients, config, daemonSetFuncs, collectors, envVarPostfix)
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyArs(t, clients, config, daemonSetFuncs, collectors, envVarPostfix)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRollingUpgradeForDaemonSetWithConfigmapAsEnvVarUsingArs(t *testing.T) {
|
|
|
|
|
@@ -2118,7 +2259,7 @@ func TestRollingUpgradeForDaemonSetWithSecretUsingArs(t *testing.T) {
|
|
|
|
|
t.Errorf("Counter by namespace was not increased")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyArs(t, clients, config, daemonSetFuncs, collectors, envVarPostfix)
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyArs(t, clients, config, daemonSetFuncs, collectors, envVarPostfix)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRollingUpgradeForDaemonSetWithSecretInProjectedVolumeUsingArs(t *testing.T) {
|
|
|
|
|
@@ -2150,7 +2291,7 @@ func TestRollingUpgradeForDaemonSetWithSecretInProjectedVolumeUsingArs(t *testin
|
|
|
|
|
t.Errorf("Counter by namespace was not increased")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyArs(t, clients, config, daemonSetFuncs, collectors, envVarPostfix)
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyArs(t, clients, config, daemonSetFuncs, collectors, envVarPostfix)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRollingUpgradeForStatefulSetWithConfigmapUsingArs(t *testing.T) {
|
|
|
|
|
@@ -2182,7 +2323,7 @@ func TestRollingUpgradeForStatefulSetWithConfigmapUsingArs(t *testing.T) {
|
|
|
|
|
t.Errorf("Counter by namespace was not increased")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyArs(t, clients, config, statefulSetFuncs, collectors, envVarPostfix)
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyArs(t, clients, config, statefulSetFuncs, collectors, envVarPostfix)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRollingUpgradeForStatefulSetWithConfigmapInProjectedVolumeUsingArs(t *testing.T) {
|
|
|
|
|
@@ -2214,7 +2355,7 @@ func TestRollingUpgradeForStatefulSetWithConfigmapInProjectedVolumeUsingArs(t *t
|
|
|
|
|
t.Errorf("Counter by namespace was not increased")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyArs(t, clients, config, statefulSetFuncs, collectors, envVarPostfix)
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyArs(t, clients, config, statefulSetFuncs, collectors, envVarPostfix)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRollingUpgradeForStatefulSetWithSecretUsingArs(t *testing.T) {
|
|
|
|
|
@@ -2246,7 +2387,7 @@ func TestRollingUpgradeForStatefulSetWithSecretUsingArs(t *testing.T) {
|
|
|
|
|
t.Errorf("Counter by namespace was not increased")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyArs(t, clients, config, statefulSetFuncs, collectors, envVarPostfix)
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyArs(t, clients, config, statefulSetFuncs, collectors, envVarPostfix)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRollingUpgradeForStatefulSetWithSecretInProjectedVolumeUsingArs(t *testing.T) {
|
|
|
|
|
@@ -2278,7 +2419,7 @@ func TestRollingUpgradeForStatefulSetWithSecretInProjectedVolumeUsingArs(t *test
|
|
|
|
|
t.Errorf("Counter by namespace was not increased")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyArs(t, clients, config, statefulSetFuncs, collectors, envVarPostfix)
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyArs(t, clients, config, statefulSetFuncs, collectors, envVarPostfix)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRollingUpgradeForDeploymentWithPodAnnotationsUsingArs(t *testing.T) {
|
|
|
|
|
@@ -2437,7 +2578,7 @@ func TestRollingUpgradeForDeploymentWithConfigmapInProjectedVolumeUsingErs(t *te
|
|
|
|
|
t.Errorf("Counter by namespace was not increased")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyErs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyErs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRollingUpgradeForDeploymentWithConfigmapViaSearchAnnotationUsingErs(t *testing.T) {
|
|
|
|
|
@@ -2469,7 +2610,7 @@ func TestRollingUpgradeForDeploymentWithConfigmapViaSearchAnnotationUsingErs(t *
|
|
|
|
|
t.Errorf("Counter by namespace was not increased")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyErs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyErs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRollingUpgradeForDeploymentWithConfigmapViaSearchAnnotationNoTriggersUsingErs(t *testing.T) {
|
|
|
|
|
@@ -2576,7 +2717,7 @@ func TestRollingUpgradeForDeploymentWithConfigmapInInitContainerUsingErs(t *test
|
|
|
|
|
t.Errorf("Counter by namespace was not increased")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyErs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyErs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRollingUpgradeForDeploymentWithConfigmapInProjectVolumeInInitContainerUsingErs(t *testing.T) {
|
|
|
|
|
@@ -2640,7 +2781,7 @@ func TestRollingUpgradeForDeploymentWithConfigmapAsEnvVarUsingErs(t *testing.T)
|
|
|
|
|
t.Errorf("Counter by namespace was not increased")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyErs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyErs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRollingUpgradeForDeploymentWithConfigmapAsEnvVarInInitContainerUsingErs(t *testing.T) {
|
|
|
|
|
@@ -2704,7 +2845,7 @@ func TestRollingUpgradeForDeploymentWithConfigmapAsEnvVarFromUsingErs(t *testing
|
|
|
|
|
t.Errorf("Counter by namespace was not increased")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyErs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyErs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRollingUpgradeForDeploymentWithSecretUsingErs(t *testing.T) {
|
|
|
|
|
@@ -2736,7 +2877,7 @@ func TestRollingUpgradeForDeploymentWithSecretUsingErs(t *testing.T) {
|
|
|
|
|
t.Errorf("Counter by namespace was not increased")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyErs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyErs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRollingUpgradeForDeploymentWithSecretInProjectedVolumeUsingErs(t *testing.T) {
|
|
|
|
|
@@ -2800,7 +2941,7 @@ func TestRollingUpgradeForDeploymentWithSecretinInitContainerUsingErs(t *testing
|
|
|
|
|
t.Errorf("Counter by namespace was not increased")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyErs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyErs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRollingUpgradeForDeploymentWithSecretInProjectedVolumeinInitContainerUsingErs(t *testing.T) {
|
|
|
|
|
@@ -2832,7 +2973,7 @@ func TestRollingUpgradeForDeploymentWithSecretInProjectedVolumeinInitContainerUs
|
|
|
|
|
t.Errorf("Counter by namespace was not increased")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyErs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyErs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRollingUpgradeForDeploymentWithSecretAsEnvVarUsingErs(t *testing.T) {
|
|
|
|
|
@@ -2864,7 +3005,7 @@ func TestRollingUpgradeForDeploymentWithSecretAsEnvVarUsingErs(t *testing.T) {
|
|
|
|
|
t.Errorf("Counter by namespace was not increased")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyErs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyErs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRollingUpgradeForDeploymentWithSecretAsEnvVarFromUsingErs(t *testing.T) {
|
|
|
|
|
@@ -2896,7 +3037,7 @@ func TestRollingUpgradeForDeploymentWithSecretAsEnvVarFromUsingErs(t *testing.T)
|
|
|
|
|
t.Errorf("Counter by namespace was not increased")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyErs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyErs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRollingUpgradeForDeploymentWithSecretAsEnvVarInInitContainerUsingErs(t *testing.T) {
|
|
|
|
|
@@ -2928,7 +3069,29 @@ func TestRollingUpgradeForDeploymentWithSecretAsEnvVarInInitContainerUsingErs(t
|
|
|
|
|
t.Errorf("Counter by namespace was not increased")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyErs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyErs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRollingUpgradeForDeploymentWithSecretExcludeAnnotationUsingErs(t *testing.T) {
|
|
|
|
|
options.ReloadStrategy = constants.EnvVarsReloadStrategy
|
|
|
|
|
envVarPostfix := constants.SecretEnvVarPostfix
|
|
|
|
|
|
|
|
|
|
shaData := testutil.ConvertResourceToSHA(testutil.SecretResourceType, ersNamespace, ersSecretWithSecretExcludeAnnotation, "dGVzdFVwZGF0ZWRTZWNyZXRFbmNvZGluZ0ZvclJlbG9hZGVy")
|
|
|
|
|
config := getConfigWithAnnotations(envVarPostfix, ersSecretWithSecretExcludeAnnotation, shaData, "", options.SecretReloaderAutoAnnotation)
|
|
|
|
|
deploymentFuncs := GetDeploymentRollingUpgradeFuncs()
|
|
|
|
|
collectors := getCollectors()
|
|
|
|
|
|
|
|
|
|
err := PerformAction(clients, config, deploymentFuncs, collectors, nil, invokeReloadStrategy)
|
|
|
|
|
time.Sleep(5 * time.Second)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Errorf("Rolling upgrade failed for Deployment with exclude Secret")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
logrus.Infof("Verifying deployment did not update")
|
|
|
|
|
updated := testutil.VerifyResourceEnvVarUpdate(clients, config, envVarPostfix, deploymentFuncs)
|
|
|
|
|
if updated {
|
|
|
|
|
t.Errorf("Deployment that had to be excluded was updated")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRollingUpgradeForDeploymentWithSecretAutoAnnotationUsingErs(t *testing.T) {
|
|
|
|
|
@@ -2956,12 +3119,33 @@ func TestRollingUpgradeForDeploymentWithSecretAutoAnnotationUsingErs(t *testing.
|
|
|
|
|
t.Errorf("Counter was not increased")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if promtestutil.ToFloat64(collectors.ReloadedByNamespace.With(prometheus.Labels{"success": "true", "namespace": ersNamespace})) != 1 {
|
|
|
|
|
if promtestutil.ToFloat64(collectors.ReloadedByNamespace.With(prometheus.Labels{"success": "true", "namespace": ersNamespace})) != 1 {
|
|
|
|
|
t.Errorf("Counter by namespace was not increased")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyErs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyErs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRollingUpgradeForDeploymentWithConfigMapExcludeAnnotationUsingErs(t *testing.T) {
|
|
|
|
|
options.ReloadStrategy = constants.EnvVarsReloadStrategy
|
|
|
|
|
envVarPostfix := constants.ConfigmapEnvVarPostfix
|
|
|
|
|
|
|
|
|
|
shaData := testutil.ConvertResourceToSHA(testutil.ConfigmapResourceType, ersNamespace, ersConfigmapWithConfigMapExcludeAnnotation, "www.facebook.com")
|
|
|
|
|
config := getConfigWithAnnotations(envVarPostfix, ersConfigmapWithConfigMapExcludeAnnotation, shaData, "", options.ConfigmapReloaderAutoAnnotation)
|
|
|
|
|
deploymentFuncs := GetDeploymentRollingUpgradeFuncs()
|
|
|
|
|
collectors := getCollectors()
|
|
|
|
|
|
|
|
|
|
err := PerformAction(clients, config, deploymentFuncs, collectors, nil, invokeReloadStrategy)
|
|
|
|
|
time.Sleep(5 * time.Second)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Errorf("Rolling upgrade failed for Deployment with exclude ConfigMap")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
logrus.Infof("Verifying deployment did not update")
|
|
|
|
|
updated := testutil.VerifyResourceEnvVarUpdate(clients, config, envVarPostfix, deploymentFuncs)
|
|
|
|
|
if updated {
|
|
|
|
|
t.Errorf("Deployment which had to be excluded was updated")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRollingUpgradeForDeploymentWithConfigMapAutoAnnotationUsingErs(t *testing.T) {
|
|
|
|
|
@@ -2993,7 +3177,7 @@ func TestRollingUpgradeForDeploymentWithConfigMapAutoAnnotationUsingErs(t *testi
|
|
|
|
|
t.Errorf("Counter by namespace was not increased")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyErs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyErs(t, clients, config, deploymentFuncs, collectors, envVarPostfix)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRollingUpgradeForDaemonSetWithConfigmapUsingErs(t *testing.T) {
|
|
|
|
|
@@ -3025,7 +3209,7 @@ func TestRollingUpgradeForDaemonSetWithConfigmapUsingErs(t *testing.T) {
|
|
|
|
|
t.Errorf("Counter by namespace was not increased")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyErs(t, clients, config, daemonSetFuncs, collectors, envVarPostfix)
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyErs(t, clients, config, daemonSetFuncs, collectors, envVarPostfix)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRollingUpgradeForDaemonSetWithConfigmapInProjectedVolumeUsingErs(t *testing.T) {
|
|
|
|
|
@@ -3057,7 +3241,7 @@ func TestRollingUpgradeForDaemonSetWithConfigmapInProjectedVolumeUsingErs(t *tes
|
|
|
|
|
t.Errorf("Counter by namespace was not increased")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyErs(t, clients, config, daemonSetFuncs, collectors, envVarPostfix)
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyErs(t, clients, config, daemonSetFuncs, collectors, envVarPostfix)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRollingUpgradeForDaemonSetWithConfigmapAsEnvVarUsingErs(t *testing.T) {
|
|
|
|
|
@@ -3089,7 +3273,7 @@ func TestRollingUpgradeForDaemonSetWithConfigmapAsEnvVarUsingErs(t *testing.T) {
|
|
|
|
|
t.Errorf("Counter by namespace was not increased")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyErs(t, clients, config, daemonSetFuncs, collectors, envVarPostfix)
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyErs(t, clients, config, daemonSetFuncs, collectors, envVarPostfix)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRollingUpgradeForDaemonSetWithSecretUsingErs(t *testing.T) {
|
|
|
|
|
@@ -3121,7 +3305,7 @@ func TestRollingUpgradeForDaemonSetWithSecretUsingErs(t *testing.T) {
|
|
|
|
|
t.Errorf("Counter by namespace was not increased")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyErs(t, clients, config, daemonSetFuncs, collectors, envVarPostfix)
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyErs(t, clients, config, daemonSetFuncs, collectors, envVarPostfix)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRollingUpgradeForDaemonSetWithSecretInProjectedVolumeUsingErs(t *testing.T) {
|
|
|
|
|
@@ -3153,7 +3337,7 @@ func TestRollingUpgradeForDaemonSetWithSecretInProjectedVolumeUsingErs(t *testin
|
|
|
|
|
t.Errorf("Counter by namespace was not increased")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyErs(t, clients, config, daemonSetFuncs, collectors, envVarPostfix)
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyErs(t, clients, config, daemonSetFuncs, collectors, envVarPostfix)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRollingUpgradeForStatefulSetWithConfigmapUsingErs(t *testing.T) {
|
|
|
|
|
@@ -3185,7 +3369,7 @@ func TestRollingUpgradeForStatefulSetWithConfigmapUsingErs(t *testing.T) {
|
|
|
|
|
t.Errorf("Counter by namespace was not increased")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyErs(t, clients, config, statefulSetFuncs, collectors, envVarPostfix)
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyErs(t, clients, config, statefulSetFuncs, collectors, envVarPostfix)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRollingUpgradeForStatefulSetWithConfigmapInProjectedVolumeUsingErs(t *testing.T) {
|
|
|
|
|
@@ -3217,7 +3401,7 @@ func TestRollingUpgradeForStatefulSetWithConfigmapInProjectedVolumeUsingErs(t *t
|
|
|
|
|
t.Errorf("Counter by namespace was not increased")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyErs(t, clients, config, statefulSetFuncs, collectors, envVarPostfix)
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyErs(t, clients, config, statefulSetFuncs, collectors, envVarPostfix)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRollingUpgradeForStatefulSetWithSecretUsingErs(t *testing.T) {
|
|
|
|
|
@@ -3281,7 +3465,7 @@ func TestRollingUpgradeForStatefulSetWithSecretInProjectedVolumeUsingErs(t *test
|
|
|
|
|
t.Errorf("Counter by namespace was not increased")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyErs(t, clients, config, statefulSetFuncs, collectors, envVarPostfix)
|
|
|
|
|
testRollingUpgradeInvokeDeleteStrategyErs(t, clients, config, statefulSetFuncs, collectors, envVarPostfix)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRollingUpgradeForDeploymentWithPodAnnotationsUsingErs(t *testing.T) {
|
|
|
|
|
|