From a1677ce5e0acbd2e62c9a7e8a5f5583806fa56c8 Mon Sep 17 00:00:00 2001 From: Jeremy Rickard Date: Mon, 6 Aug 2018 11:55:40 -0600 Subject: [PATCH] Update ACI provider to handle empty environment variables (#297) --- providers/azure/aci.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/providers/azure/aci.go b/providers/azure/aci.go index 1884f94fc..f4085cb7e 100644 --- a/providers/azure/aci.go +++ b/providers/azure/aci.go @@ -676,8 +676,10 @@ func (p *ACIProvider) getContainers(pod *v1.Pod) ([]aci.Container, error) { c.EnvironmentVariables = make([]aci.EnvironmentVariable, 0, len(container.Env)) for _, e := range container.Env { - envVar := getACIEnvVar(e) - c.EnvironmentVariables = append(c.EnvironmentVariables, envVar) + if e.Value != "" { + envVar := getACIEnvVar(e) + c.EnvironmentVariables = append(c.EnvironmentVariables, envVar) + } } // NOTE(robbiezhang): ACI CPU request must be times of 10m @@ -1116,7 +1118,7 @@ func filterServiceAccountSecretVolume(osType string, containerGroup *aci.Contain func getACIEnvVar(e v1.EnvVar) aci.EnvironmentVariable { var envVar aci.EnvironmentVariable // If the variable is a secret, use SecureValue - if e.ValueFrom.SecretKeyRef != nil { + if e.ValueFrom != nil && e.ValueFrom.SecretKeyRef != nil { envVar = aci.EnvironmentVariable{ Name: e.Name, SecureValue: e.Value,