summaryrefslogtreecommitdiff
path: root/libpod/oci_conmon_exec_linux.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-09-01 07:19:41 -0400
committerGitHub <noreply@github.com>2021-09-01 07:19:41 -0400
commit5c3369951573d2079eca0be7fdc40a96933ab977 (patch)
tree33247cbc6f4bc000f44a6ed550b03bb28a8deb63 /libpod/oci_conmon_exec_linux.go
parent331b35996f8e94dac42ca188ff383a5179a4c2bc (diff)
parent1fb07c4225feb2eec9ffcf7ca039b373cfd69ed7 (diff)
downloadpodman-5c3369951573d2079eca0be7fdc40a96933ab977.tar.gz
podman-5c3369951573d2079eca0be7fdc40a96933ab977.tar.bz2
podman-5c3369951573d2079eca0be7fdc40a96933ab977.zip
Merge pull request #11376 from ashley-cui/envsec
Make secret env var available to exec session
Diffstat (limited to 'libpod/oci_conmon_exec_linux.go')
-rw-r--r--libpod/oci_conmon_exec_linux.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/libpod/oci_conmon_exec_linux.go b/libpod/oci_conmon_exec_linux.go
index c4bae9b78..5a7677b04 100644
--- a/libpod/oci_conmon_exec_linux.go
+++ b/libpod/oci_conmon_exec_linux.go
@@ -684,6 +684,19 @@ func prepareProcessExec(c *Container, options *ExecOptions, env []string, sessio
pspec.Env = append(pspec.Env, env...)
}
+ // Add secret envs if they exist
+ manager, err := c.runtime.SecretsManager()
+ if err != nil {
+ return nil, err
+ }
+ for name, secr := range c.config.EnvSecrets {
+ _, data, err := manager.LookupSecretData(secr.Name)
+ if err != nil {
+ return nil, err
+ }
+ pspec.Env = append(pspec.Env, fmt.Sprintf("%s=%s", name, string(data)))
+ }
+
if options.Cwd != "" {
pspec.Cwd = options.Cwd
}