diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2022-09-21 13:15:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-21 13:15:28 +0200 |
commit | ffa73c58a52b470d9708a8ae38536fa0dc443d8b (patch) | |
tree | 5f946382c70e75a60595966442c2ce48924816b8 /pkg/api/handlers | |
parent | fea325327106aebc08fd6b11bc77c434e614c3e9 (diff) | |
parent | 9bb51e8e96f98ab74d416a9af9bd708c7c503bdf (diff) | |
download | podman-ffa73c58a52b470d9708a8ae38536fa0dc443d8b.tar.gz podman-ffa73c58a52b470d9708a8ae38536fa0dc443d8b.tar.bz2 podman-ffa73c58a52b470d9708a8ae38536fa0dc443d8b.zip |
Merge pull request #15842 from ashley-cui/seclabels
Add labels to secrets
Diffstat (limited to 'pkg/api/handlers')
-rw-r--r-- | pkg/api/handlers/compat/secrets.go | 5 | ||||
-rw-r--r-- | pkg/api/handlers/libpod/secrets.go | 2 |
2 files changed, 3 insertions, 4 deletions
diff --git a/pkg/api/handlers/compat/secrets.go b/pkg/api/handlers/compat/secrets.go index 13b3c4e24..847f05f27 100644 --- a/pkg/api/handlers/compat/secrets.go +++ b/pkg/api/handlers/compat/secrets.go @@ -111,14 +111,11 @@ func CreateSecret(w http.ResponseWriter, r *http.Request) { utils.Error(w, http.StatusInternalServerError, fmt.Errorf("Decode(): %w", err)) return } - if len(createParams.Labels) > 0 { - utils.Error(w, http.StatusBadRequest, fmt.Errorf("labels not supported: %w", errors.New("bad parameter"))) - return - } decoded, _ := base64.StdEncoding.DecodeString(createParams.Data) reader := bytes.NewReader(decoded) opts.Driver = createParams.Driver.Name + opts.Labels = createParams.Labels ic := abi.ContainerEngine{Libpod: runtime} report, err := ic.SecretCreate(r.Context(), createParams.Name, reader, opts) diff --git a/pkg/api/handlers/libpod/secrets.go b/pkg/api/handlers/libpod/secrets.go index 6eba65f2b..c24ac8563 100644 --- a/pkg/api/handlers/libpod/secrets.go +++ b/pkg/api/handlers/libpod/secrets.go @@ -22,6 +22,7 @@ func CreateSecret(w http.ResponseWriter, r *http.Request) { Name string `schema:"name"` Driver string `schema:"driver"` DriverOpts map[string]string `schema:"driveropts"` + Labels map[string]string `schema:"labels"` }{ // override any golang type defaults } @@ -33,6 +34,7 @@ func CreateSecret(w http.ResponseWriter, r *http.Request) { opts.Driver = query.Driver opts.DriverOpts = query.DriverOpts + opts.Labels = query.Labels ic := abi.ContainerEngine{Libpod: runtime} report, err := ic.SecretCreate(r.Context(), query.Name, r.Body, opts) |