Update ACI provider to handle empty environment variables (#297)
This commit is contained in:
committed by
Robbie Zhang
parent
3cde08b825
commit
a1677ce5e0
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user