summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorPeter Hunt <pehunt@redhat.com>2019-08-01 15:31:15 -0400
committerPeter Hunt <pehunt@redhat.com>2019-08-01 15:47:45 -0400
commit834107c82ea50c3299d23c07c04f81b6974202f9 (patch)
tree8f9f7985e518f8f26fb4589c5d3a5183962b91d9 /pkg
parent3acfcb30628ed937200a144817f52ee52cfc2e40 (diff)
downloadpodman-834107c82ea50c3299d23c07c04f81b6974202f9.tar.gz
podman-834107c82ea50c3299d23c07c04f81b6974202f9.tar.bz2
podman-834107c82ea50c3299d23c07c04f81b6974202f9.zip
Add capability functionality to play kube
Take capabilities written in a kube and add to a container adapt test suite and write cap-add/drop tests Signed-off-by: Peter Hunt <pehunt@redhat.com>
Diffstat (limited to 'pkg')
-rw-r--r--pkg/adapter/pods.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/pkg/adapter/pods.go b/pkg/adapter/pods.go
index b9d7fcd9b..c3a9ab8d8 100644
--- a/pkg/adapter/pods.go
+++ b/pkg/adapter/pods.go
@@ -682,6 +682,15 @@ func kubeContainerToCreateConfig(ctx context.Context, containerYAML v1.Container
if containerYAML.SecurityContext.AllowPrivilegeEscalation != nil {
containerConfig.NoNewPrivs = !*containerYAML.SecurityContext.AllowPrivilegeEscalation
}
+
+ }
+ if caps := containerYAML.SecurityContext.Capabilities; caps != nil {
+ for _, capability := range caps.Add {
+ containerConfig.CapAdd = append(containerConfig.CapAdd, string(capability))
+ }
+ for _, capability := range caps.Drop {
+ containerConfig.CapDrop = append(containerConfig.CapDrop, string(capability))
+ }
}
containerConfig.Command = []string{}