summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorUrvashi Mohnani <umohnani@redhat.com>2022-01-06 07:56:20 -0500
committerUrvashi Mohnani <umohnani@redhat.com>2022-01-10 05:51:19 -0500
commit4dc5a5b15db4884101fc85a543ca356f3346ef6a (patch)
tree4eb665346a54479265c667127fa2794058a387de /pkg
parent6ed2c639ac614b8292660fda604d3a8f6cbb42b7 (diff)
downloadpodman-4dc5a5b15db4884101fc85a543ca356f3346ef6a.tar.gz
podman-4dc5a5b15db4884101fc85a543ca356f3346ef6a.tar.bz2
podman-4dc5a5b15db4884101fc85a543ca356f3346ef6a.zip
Don't add env if optional and not found
If the pod yaml has env from secret and condifg map but they are optional and the secret cannot be found, don't add the env key as well as the env value will not be found. Matches behavior with k8s. Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
Diffstat (limited to 'pkg')
-rw-r--r--pkg/specgen/generate/kube/kube.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/pkg/specgen/generate/kube/kube.go b/pkg/specgen/generate/kube/kube.go
index 6d9f598c9..b41ee8db0 100644
--- a/pkg/specgen/generate/kube/kube.go
+++ b/pkg/specgen/generate/kube/kube.go
@@ -291,7 +291,10 @@ func ToSpecGen(ctx context.Context, opts *CtrSpecGenOptions) (*specgen.SpecGener
return nil, err
}
- envs[env.Name] = value
+ // Only set the env if the value is not ""
+ if value != "" {
+ envs[env.Name] = value
+ }
}
for _, envFrom := range opts.Container.EnvFrom {
cmEnvs, err := envVarsFrom(envFrom, opts)