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

Backport of Remove anyuid SCC requirement for OpenShift into release/1.4.x #3849

Conversation

hc-github-team-consul-core
Copy link
Collaborator

Backport

This PR is auto-generated from #3813 to be assessed for backporting due to the inclusion of the label backport/1.4.x.

The below text is copied from the body of the original PR.


  • OpenShift does not want you to use a hardcoded user id and group when running containers.
  • We currently hardcode 5995 and 5996 for the init and inject containers.
  • OpenShift tells you what ids you can use by adding an annotation to the namespace you are deploying to.
  • We now read that annotation from the namespace and change the ids at run time.
  • This removes the requirement of having to run oc adm policy add-scc-to-group anyuid system:serviceaccounts:$TARGET_NAMESPACE when deploying to OpenShift

Changes proposed in this PR

  • Added some helper code to connect-inject/common that reads from the namespace and gets the UID and Group to be used. This code has some fallbacks based from previous versions of OpenShift
  • NOTE: The word 'range' is used in the OpenShift annotation but it is not really a range (anymore).
  • If on OpenShift, use the IDs for init and connect inject.
  • For CNI, we add an annotation to the pod with the redirect config. It includes the UID in the json blob. CNI uses this annotation/blob during Pod Network setup.
  • Acceptance tests were creating the anyuid policy when running on OpenShift and that is not longer needed. (Files dropped/kustomize changes).

How I've tested this PR

  • Unit tests
  • Created a local CRC OpenShift cluster, deployed consul and static server to manually check the IDs.
  • Had @wilkermichael run the connect acceptance tests against a real OpenShift cluster using my control plane image.

How I expect reviewers to test this PR

👀

Checklist


Overview of commits

@hc-github-team-consul-core hc-github-team-consul-core merged commit 445cec4 into release/1.4.x Apr 2, 2024
25 of 49 checks passed
@hc-github-team-consul-core hc-github-team-consul-core deleted the backport/NET-4414/anyuid-openshift/nearly-growing-monkfish branch April 2, 2024 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants