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 | |
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')
-rw-r--r-- | pkg/api/handlers/compat/secrets.go | 5 | ||||
-rw-r--r-- | pkg/api/handlers/libpod/secrets.go | 2 | ||||
-rw-r--r-- | pkg/api/server/register_secrets.go | 8 |
3 files changed, 11 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) diff --git a/pkg/api/server/register_secrets.go b/pkg/api/server/register_secrets.go index 8918ad238..a60145958 100644 --- a/pkg/api/server/register_secrets.go +++ b/pkg/api/server/register_secrets.go @@ -25,6 +25,14 @@ func (s *APIServer) registerSecretHandlers(r *mux.Router) error { // type: string // description: Secret driver // default: "file" + // - in: query + // name: driveropts + // type: string + // description: Secret driver options + // - in: query + // name: labels + // type: string + // description: Labels on the secret // - in: body // name: request // description: Secret |