summaryrefslogtreecommitdiff
path: root/pkg/api
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2022-03-09 17:30:01 -0500
committerDaniel J Walsh <dwalsh@redhat.com>2022-03-09 17:30:01 -0500
commitfeaa1a134a4fd0a7d25bab485708a201321bfb56 (patch)
tree080fa2a13998bc0b9f3c0689df6317f736aa8d02 /pkg/api
parentacfcecf2ae41528d1d7ecd43d37d8fd554f587bc (diff)
downloadpodman-feaa1a134a4fd0a7d25bab485708a201321bfb56.tar.gz
podman-feaa1a134a4fd0a7d25bab485708a201321bfb56.tar.bz2
podman-feaa1a134a4fd0a7d25bab485708a201321bfb56.zip
Add podman play kube --annotation
Allow users to add annotions in the podman play kube command. This PR Also fixes the fact that annotations in the pod spec were not being passed down to containers. Fixes: https://github.com/containers/podman/issues/12968 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'pkg/api')
-rw-r--r--pkg/api/handlers/libpod/play.go38
1 files changed, 20 insertions, 18 deletions
diff --git a/pkg/api/handlers/libpod/play.go b/pkg/api/handlers/libpod/play.go
index 515d0e5cf..aed889298 100644
--- a/pkg/api/handlers/libpod/play.go
+++ b/pkg/api/handlers/libpod/play.go
@@ -23,14 +23,15 @@ func PlayKube(w http.ResponseWriter, r *http.Request) {
runtime := r.Context().Value(api.RuntimeKey).(*libpod.Runtime)
decoder := r.Context().Value(api.DecoderKey).(*schema.Decoder)
query := struct {
- Network []string `schema:"network"`
- TLSVerify bool `schema:"tlsVerify"`
- LogDriver string `schema:"logDriver"`
- LogOptions []string `schema:"logOptions"`
- Start bool `schema:"start"`
- StaticIPs []string `schema:"staticIPs"`
- StaticMACs []string `schema:"staticMACs"`
- NoHosts bool `schema:"noHosts"`
+ Annotations map[string]string `schema:"annotations"`
+ Network []string `schema:"network"`
+ TLSVerify bool `schema:"tlsVerify"`
+ LogDriver string `schema:"logDriver"`
+ LogOptions []string `schema:"logOptions"`
+ Start bool `schema:"start"`
+ StaticIPs []string `schema:"staticIPs"`
+ StaticMACs []string `schema:"staticMACs"`
+ NoHosts bool `schema:"noHosts"`
}{
TLSVerify: true,
Start: true,
@@ -97,16 +98,17 @@ func PlayKube(w http.ResponseWriter, r *http.Request) {
containerEngine := abi.ContainerEngine{Libpod: runtime}
options := entities.PlayKubeOptions{
- Authfile: authfile,
- Username: username,
- Password: password,
- Networks: query.Network,
- NoHosts: query.NoHosts,
- Quiet: true,
- LogDriver: query.LogDriver,
- LogOptions: query.LogOptions,
- StaticIPs: staticIPs,
- StaticMACs: staticMACs,
+ Annotations: query.Annotations,
+ Authfile: authfile,
+ Username: username,
+ Password: password,
+ Networks: query.Network,
+ NoHosts: query.NoHosts,
+ Quiet: true,
+ LogDriver: query.LogDriver,
+ LogOptions: query.LogOptions,
+ StaticIPs: staticIPs,
+ StaticMACs: staticMACs,
}
if _, found := r.URL.Query()["tlsVerify"]; found {
options.SkipTLSVerify = types.NewOptionalBool(!query.TLSVerify)