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

OpenShift SCC in declarative form #4609

Closed
errordeveloper opened this issue Feb 15, 2024 · 5 comments · Fixed by fluxcd/website#1921
Closed

OpenShift SCC in declarative form #4609

errordeveloper opened this issue Feb 15, 2024 · 5 comments · Fixed by fluxcd/website#1921

Comments

@errordeveloper
Copy link
Contributor

Currently OpenShift docs have this:

for i in ${!FLUX_CONTROLLERS[@]}; do
  oc adm policy add-scc-to-user nonroot system:serviceaccount:${FLUX_NAMESPACE}:${FLUX_CONTROLLERS[$i]}
done

This can be expressed as a role:

apiVersion: "rbac.authorization.k8s.io/v1"
kind:       "ClusterRole"
metadata: name: string
rules: {
	apiGroups: [
		"security.openshift.io",
	]
	resources: [
		"securitycontextconstraints",
	]
	resourceNames: [
		"nonroot",
	]
	verbs: [
		"use",
	]
}

I based the above on something I wrote for Cilium here: https://github.com/cilium/cilium-olm/blob/d595d9b949ee9eab66968cd5e32636bb79f2fe9d/config/operator/rbac.cue#L50-L66

Happy to make a PR to the docs with an expanded YAML version once I have a bit of time.

@stefanprodan
Copy link
Member

Hey @errordeveloper so with this cluster role instead of running a command for each controller SA, people can just do a kubectl apply? If so then I think it's a great UX improvement.

@errordeveloper
Copy link
Contributor Author

@stefanprodan exactly :)

@stefanprodan
Copy link
Member

@errordeveloper can you please post on #4625 the exact YAML that would work for Flux?

@jack-evans
Copy link

Could this be something flux does on bootstrap?

@stefanprodan
Copy link
Member

Adding that SCC YAML to the repo before bootstrap should be straight forward https://fluxcd.io/flux/installation/configuration/boostrap-customization/

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 a pull request may close this issue.

3 participants