Skip to content

Backport: Remove anyuid SCC requirement for OpenShift (#3813)#3851

Merged
curtbushko merged 1 commit intorelease/1.2.xfrom
backport/NET-4414/anyuid-openshift-to-release-1.2.x
Apr 2, 2024
Merged

Backport: Remove anyuid SCC requirement for OpenShift (#3813)#3851
curtbushko merged 1 commit intorelease/1.2.xfrom
backport/NET-4414/anyuid-openshift-to-release-1.2.x

Conversation

@curtbushko
Copy link
Copy Markdown
Contributor

Manual backport of #3813 to release/1.2.x

  • 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

Remove SCC requirement for anyuid for OpenShift
@curtbushko curtbushko requested a review from wilkermichael April 2, 2024 17:47
@curtbushko curtbushko added the pr/no-backport signals that a PR will not contain a backport label label Apr 2, 2024
@curtbushko curtbushko merged commit 6b45f75 into release/1.2.x Apr 2, 2024
@curtbushko curtbushko deleted the backport/NET-4414/anyuid-openshift-to-release-1.2.x branch April 2, 2024 18:54
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.

2 participants