diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-08-02 10:42:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-02 10:42:46 +0200 |
commit | 5370c53c9c22627385e9bc765dbd1fcfedc09694 (patch) | |
tree | 4c5806942b102326e441f746d9c0538adb901bbc /libpod | |
parent | 2cc5913bed1fb16690eb27c6e636867a5946070e (diff) | |
parent | 834107c82ea50c3299d23c07c04f81b6974202f9 (diff) | |
download | podman-5370c53c9c22627385e9bc765dbd1fcfedc09694.tar.gz podman-5370c53c9c22627385e9bc765dbd1fcfedc09694.tar.bz2 podman-5370c53c9c22627385e9bc765dbd1fcfedc09694.zip |
Merge pull request #3692 from haircommander/play-caps
Add Capability support to play kube
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/kube.go | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/libpod/kube.go b/libpod/kube.go index 084a3df4f..d0e7baf95 100644 --- a/libpod/kube.go +++ b/libpod/kube.go @@ -406,18 +406,26 @@ func determineCapAddDropFromCapabilities(defaultCaps, containerCaps []string) *v drop []v1.Capability add []v1.Capability ) + dedupDrop := make(map[string]bool) + dedupAdd := make(map[string]bool) // Find caps in the defaultCaps but not in the container's // those indicate a dropped cap for _, capability := range defaultCaps { if !util.StringInSlice(capability, containerCaps) { - drop = append(drop, v1.Capability(capability)) + if _, ok := dedupDrop[capability]; !ok { + drop = append(drop, v1.Capability(capability)) + dedupDrop[capability] = true + } } } // Find caps in the container but not in the defaults; those indicate // an added cap for _, capability := range containerCaps { if !util.StringInSlice(capability, defaultCaps) { - add = append(add, v1.Capability(capability)) + if _, ok := dedupAdd[capability]; !ok { + add = append(add, v1.Capability(capability)) + dedupAdd[capability] = true + } } } |