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

[NET-9932] Always add NET_BIND_SERVICE capability to injected sidecar container #4066

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

nathancoleman
Copy link
Member

@nathancoleman nathancoleman commented Jun 3, 2024

Changes proposed in this PR

Consul-dataplane always requires the NET_BIND_SERVICE capability (docs). This is explicitly allowed under the restricted-v2 SecurityContextConstraints (SCC) that ships with OpenShift 4.11+; however, the container needs to request the capability in order for it to be granted. This change does that.

How I've tested this PR

Worked w/ @natemollica-nm to verify that this fix allows the application sidecar running the consul-dataplane image to spin up successfully under the restricted-v2 SCC where it would have previously logged the following error on startup.

Defaulted container "consul-dataplane" out of: consul-dataplane, backend, consul-connect-inject-init (init)
[dumb-init] /usr/local/bin/consul-dataplane: Operation not permitted

Application sidecars should now be fully functional on OpenShift without creating a custom SCC.
The Pod containing the injected sidecar should get an annotation from OpenShift indicating that it's using the restricted-v2 SCC.

How I expect reviewers to test this PR

See above

Checklist

@nathancoleman nathancoleman changed the title Always add NET_BIND_SERVICE capability to injected sidecar container [NET-9932] Always add NET_BIND_SERVICE capability to injected sidecar container Jun 7, 2024
@nathancoleman nathancoleman marked this pull request as ready for review June 13, 2024 18:27
@nathancoleman nathancoleman force-pushed the sidecar-inject-net-bind-service branch from e0d4d94 to 531db20 Compare June 17, 2024 18:42
@nathancoleman
Copy link
Member Author

Note to self: This PR cannot be backported to any release that requires running Consul w/ the anyuid SecurityContextConstraints. If we do, then we get the following error due to the fact that anyuid does not allow the NET_BIND_SERVICE capability.

pods "backend-6c4cf7dc55-" is forbidden: unable to validate against any security context constraint:
| [provider anyuid: .containers[0].capabilities.add:                                                                                                                                                
│       Invalid value: "NET_BIND_SERVICE": capability may not be added

@nathancoleman nathancoleman added pr/no-backport signals that a PR will not contain a backport label and removed backport/1.2.x 1.2.x release branch backport/1.3.x backport/1.4.x backport/1.5.x labels Jun 17, 2024
missylbytes added a commit that referenced this pull request Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr/no-backport signals that a PR will not contain a backport label
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant