Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for cap_add,cap_drop #575

Closed
gitlawr opened this issue Apr 27, 2017 · 3 comments
Closed

Support for cap_add,cap_drop #575

gitlawr opened this issue Apr 27, 2017 · 3 comments

Comments

@gitlawr
Copy link
Contributor

gitlawr commented Apr 27, 2017

Currently these keys are marked as unsupported and kompose generates WARNINGs when they are used. But I think there is equivalent in Kubernetes.
see:
https://kubernetes.io/docs/concepts/policy/container-capabilities/
My proposal is to convert cap_add/cap_drop to Pod.Spec.Container.SecurityContext.capabilities.add/drop
For example with such a docker-compose.yml

version: "2"

services:
    hello-world:
        image: alpine:3.4
        command: ["/bin/echo", "hello", "world"]
        cap_add:
          - SYS_NICE
        cap_drop:
          - KILL

kompose generate

metadata:
  labels:
    service: hello-world
spec:
  containers:
  - image: "alpine:3.4"
    command: ["/bin/echo", "hello", "world"]
    securityContext:
      capabilities:
        add:
        - SYS_NICE
        drop:
        - KILL
@kadel
Copy link
Member

kadel commented Apr 27, 2017

Hi @gitlawr, You are right, it looks like this is something that could be added to Kompose

@gitlawr
Copy link
Contributor Author

gitlawr commented Apr 27, 2017

Hi @kadel . In that case, can I add a PR for this or wait for someone to handle it? I'm familiar with k8s but not with openshift by the way.

@kadel
Copy link
Member

kadel commented Apr 27, 2017

You definitely can 😉 , that would be great 👍 , thank you! 💛

That is OK, you can start with doing it just for k8s. Once you send PR with k8s I can help with OpenShift bits, it should be easy once its done for Kubernetes.

gitlawr added a commit to gitlawr/kompose that referenced this issue Apr 28, 2017
This commit Add support for cap_add & cap_drop which maps to
Pod.Spec.Container.SecurityContext.Capabilities.Add/Drop
Added unit tests for ConfigCapabilities function
Updated conversion.md on support for these keys
cdrage pushed a commit to cdrage/kompose that referenced this issue May 17, 2017
This commit Add support for cap_add & cap_drop which maps to
Pod.Spec.Container.SecurityContext.Capabilities.Add/Drop
Added unit tests for ConfigCapabilities function
Updated conversion.md on support for these keys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants