summaryrefslogtreecommitdiff
path: root/pkg/domain/infra/abi
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-06-25 12:45:53 -0400
committerGitHub <noreply@github.com>2021-06-25 12:45:53 -0400
commit0a0ade3cc00c3779bbf68ddd103d3efd10b5c25b (patch)
tree7a14316df448918e2e54dce77cade7b5cac381b3 /pkg/domain/infra/abi
parentb4767817012a3aedaf05dc7a32bd823fcd3776f4 (diff)
parente7507fe7cf2f35e332f58ae632882f29395e4c59 (diff)
downloadpodman-0a0ade3cc00c3779bbf68ddd103d3efd10b5c25b.tar.gz
podman-0a0ade3cc00c3779bbf68ddd103d3efd10b5c25b.tar.bz2
podman-0a0ade3cc00c3779bbf68ddd103d3efd10b5c25b.zip
Merge pull request #10736 from trusch/feature-use-secret-config
read secret config from config file if no user data.
Diffstat (limited to 'pkg/domain/infra/abi')
-rw-r--r--pkg/domain/infra/abi/secrets.go26
1 files changed, 21 insertions, 5 deletions
diff --git a/pkg/domain/infra/abi/secrets.go b/pkg/domain/infra/abi/secrets.go
index 1e1cbc70f..0bdb4ce60 100644
--- a/pkg/domain/infra/abi/secrets.go
+++ b/pkg/domain/infra/abi/secrets.go
@@ -17,15 +17,30 @@ func (ic *ContainerEngine) SecretCreate(ctx context.Context, name string, reader
if err != nil {
return nil, err
}
- driverOptions := make(map[string]string)
+ // set defaults from config for the case they are not set by an upper layer
+ // (-> i.e. tests that talk directly to the api)
+ cfg, err := ic.Libpod.GetConfig()
+ if err != nil {
+ return nil, err
+ }
if options.Driver == "" {
- options.Driver = "file"
+ options.Driver = cfg.Secrets.Driver
+ }
+ if len(options.DriverOpts) == 0 {
+ options.DriverOpts = cfg.Secrets.Opts
+ }
+ if options.DriverOpts == nil {
+ options.DriverOpts = make(map[string]string)
}
+
if options.Driver == "file" {
- driverOptions["path"] = filepath.Join(secretsPath, "filedriver")
+ if _, ok := options.DriverOpts["path"]; !ok {
+ options.DriverOpts["path"] = filepath.Join(secretsPath, "filedriver")
+ }
}
- secretID, err := manager.Store(name, data, options.Driver, driverOptions)
+
+ secretID, err := manager.Store(name, data, options.Driver, options.DriverOpts)
if err != nil {
return nil, err
}
@@ -58,7 +73,8 @@ func (ic *ContainerEngine) SecretInspect(ctx context.Context, nameOrIDs []string
Spec: entities.SecretSpec{
Name: secret.Name,
Driver: entities.SecretDriverSpec{
- Name: secret.Driver,
+ Name: secret.Driver,
+ Options: secret.DriverOptions,
},
},
}