ignore case when checking for envVar existence but do not change it (#1889)
This commit is contained in:
parent
2fcfac7ed4
commit
c6f2c68588
|
|
@ -940,7 +940,6 @@ func (c *Cluster) generateSpiloPodEnvVars(
|
||||||
func appendEnvVars(envs []v1.EnvVar, appEnv ...v1.EnvVar) []v1.EnvVar {
|
func appendEnvVars(envs []v1.EnvVar, appEnv ...v1.EnvVar) []v1.EnvVar {
|
||||||
collectedEnvs := envs
|
collectedEnvs := envs
|
||||||
for _, env := range appEnv {
|
for _, env := range appEnv {
|
||||||
env.Name = strings.ToUpper(env.Name)
|
|
||||||
if !isEnvVarPresent(collectedEnvs, env.Name) {
|
if !isEnvVarPresent(collectedEnvs, env.Name) {
|
||||||
collectedEnvs = append(collectedEnvs, env)
|
collectedEnvs = append(collectedEnvs, env)
|
||||||
}
|
}
|
||||||
|
|
@ -950,7 +949,7 @@ func appendEnvVars(envs []v1.EnvVar, appEnv ...v1.EnvVar) []v1.EnvVar {
|
||||||
|
|
||||||
func isEnvVarPresent(envs []v1.EnvVar, key string) bool {
|
func isEnvVarPresent(envs []v1.EnvVar, key string) bool {
|
||||||
for _, env := range envs {
|
for _, env := range envs {
|
||||||
if env.Name == key {
|
if strings.EqualFold(env.Name, key) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -504,7 +504,7 @@ func TestGenerateSpiloPodEnvVars(t *testing.T) {
|
||||||
expectedS3BucketConfigMap := []ExpectedValue{
|
expectedS3BucketConfigMap := []ExpectedValue{
|
||||||
{
|
{
|
||||||
envIndex: 17,
|
envIndex: 17,
|
||||||
envVarConstant: "WAL_S3_BUCKET",
|
envVarConstant: "wal_s3_bucket",
|
||||||
envVarValue: "global-s3-bucket-configmap",
|
envVarValue: "global-s3-bucket-configmap",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
@ -518,7 +518,7 @@ func TestGenerateSpiloPodEnvVars(t *testing.T) {
|
||||||
expectedCustomVariableSecret := []ExpectedValue{
|
expectedCustomVariableSecret := []ExpectedValue{
|
||||||
{
|
{
|
||||||
envIndex: 16,
|
envIndex: 16,
|
||||||
envVarConstant: "CUSTOM_VARIABLE",
|
envVarConstant: "custom_variable",
|
||||||
envVarValueRef: &v1.EnvVarSource{
|
envVarValueRef: &v1.EnvVarSource{
|
||||||
SecretKeyRef: &v1.SecretKeySelector{
|
SecretKeyRef: &v1.SecretKeySelector{
|
||||||
LocalObjectReference: v1.LocalObjectReference{
|
LocalObjectReference: v1.LocalObjectReference{
|
||||||
|
|
@ -532,7 +532,7 @@ func TestGenerateSpiloPodEnvVars(t *testing.T) {
|
||||||
expectedCustomVariableConfigMap := []ExpectedValue{
|
expectedCustomVariableConfigMap := []ExpectedValue{
|
||||||
{
|
{
|
||||||
envIndex: 16,
|
envIndex: 16,
|
||||||
envVarConstant: "CUSTOM_VARIABLE",
|
envVarConstant: "custom_variable",
|
||||||
envVarValue: "configmap-test",
|
envVarValue: "configmap-test",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
@ -573,14 +573,14 @@ func TestGenerateSpiloPodEnvVars(t *testing.T) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
envIndex: 20,
|
envIndex: 20,
|
||||||
envVarConstant: "CLONE_AWS_ENDPOINT",
|
envVarConstant: "clone_aws_endpoint",
|
||||||
envVarValue: "s3.eu-west-1.amazonaws.com",
|
envVarValue: "s3.eu-west-1.amazonaws.com",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
expectedCloneEnvSecret := []ExpectedValue{
|
expectedCloneEnvSecret := []ExpectedValue{
|
||||||
{
|
{
|
||||||
envIndex: 20,
|
envIndex: 20,
|
||||||
envVarConstant: "CLONE_AWS_ACCESS_KEY_ID",
|
envVarConstant: "clone_aws_access_key_id",
|
||||||
envVarValueRef: &v1.EnvVarSource{
|
envVarValueRef: &v1.EnvVarSource{
|
||||||
SecretKeyRef: &v1.SecretKeySelector{
|
SecretKeyRef: &v1.SecretKeySelector{
|
||||||
LocalObjectReference: v1.LocalObjectReference{
|
LocalObjectReference: v1.LocalObjectReference{
|
||||||
|
|
@ -599,7 +599,7 @@ func TestGenerateSpiloPodEnvVars(t *testing.T) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
envIndex: 20,
|
envIndex: 20,
|
||||||
envVarConstant: "STANDBY_GOOGLE_APPLICATION_CREDENTIALS",
|
envVarConstant: "standby_google_application_credentials",
|
||||||
envVarValueRef: &v1.EnvVarSource{
|
envVarValueRef: &v1.EnvVarSource{
|
||||||
SecretKeyRef: &v1.SecretKeySelector{
|
SecretKeyRef: &v1.SecretKeySelector{
|
||||||
LocalObjectReference: v1.LocalObjectReference{
|
LocalObjectReference: v1.LocalObjectReference{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue