Skip to content

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

Closed
nathancoleman wants to merge 3 commits intomainfrom
sidecar-inject-net-bind-service
Closed

[NET-9932] Always add NET_BIND_SERVICE capability to injected sidecar container#4066
nathancoleman wants to merge 3 commits intomainfrom
sidecar-inject-net-bind-service

Conversation

@nathancoleman
Copy link
Copy Markdown
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 added backport/1.2.x This release branch is no longer active. backport/1.3.x This release branch is no longer active. backport/1.4.x This release branch is no longer active. backport/1.5.x This release branch is no longer active. labels Jun 3, 2024
@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
Copy Markdown
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 This release branch is no longer active. backport/1.3.x This release branch is no longer active. backport/1.4.x This release branch is no longer active. backport/1.5.x This release branch is no longer active. labels Jun 17, 2024
missylbytes added a commit that referenced this pull request Jun 26, 2024
@nathancoleman
Copy link
Copy Markdown
Member Author

This change happened in #4152

@nathancoleman nathancoleman deleted the sidecar-inject-net-bind-service branch August 5, 2024 15:37
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.

1 participant