-
Notifications
You must be signed in to change notification settings - Fork 15
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
Generate SCC-related resources when on OCP #179
base: main
Are you sure you want to change the base?
Conversation
@ricardozanini wrote a "blind" initial implementation. Can you test it out? Just spinning an instance with the community image should do the trick. If I got this right, the Security Manager will realize it's on OCP and create:
Some considerations:
|
Can you please generate a |
This comment has been minimized.
This comment has been minimized.
Thanks! |
@LCaparelli next time please use pastebin or gist to share the YAML 😛 I got:
You might need to register this API Schema with our client :) Logs:
We might be missing this role definition? |
Signed-off-by: Lucas Caparelli <[email protected]>
Signed-off-by: Lucas Caparelli <[email protected]>
Signed-off-by: Lucas Caparelli <[email protected]>
@ricardozanini Added the Pushed a new image as well, just run:
|
Still failing, haven't you added the
Error:
Not sure if
:) |
After applying the suggestions locally, the operator pod just die in here:
Maybe a problem during SCC creation/config. |
Since this object MUST be created on every OpenShift environment, we should have a You can't treat SCC like an usual k8s object since it's cluster wide. Our controller can't own it, since if you have more than one nexus instance, it will fail to manage it... |
Yeah, that seems to be the way to go. Alternatively, we could try and create it outside of the reconcile loop, perhaps during startup, but... Honestly, I think that including it with the installation manifests is better. The problem here was that we assumed that since the operator is cluster-scoped now we should be able to manage cluster-scoped resources from the reconcile loop, but any objects created during the reconcile will be owned by the Nexus instance being reconciled and since Nexus is namespace-scoped resource, it fails with:
Too bad, it would have been really nice to fully manage the resources from the reconcile loop. I'll make the necessary changes, need to do some reading on how |
I think this error that I see on OCP is related to #187 :) Nevertheless, we should add a |
After a lot of research, I believe we should go ahead with creating the SCC and ClusterRole during installation (as opposed to during reconciliation) with some caveats. Done some testing around and we could create these resources in the reconcile loop, but that means they won't have an This would be very similar to what we already have with many necessary resources present in It's not that simple, because although we don't put an owner ourselves, when installed via OLM (which should really be the "canon" way to install) the CSV becomes the owner of these resources in If we were to simply create the SCC in the reconcile loop, how could we tell for sure if a valid owner for it exists or not? Coupling the reconcile logic with this seems awkward, these resources are not related to business logic at all, it's just infrastructure scaffolding. Handling this at installation is not super pretty either, but I believe it's the lesser of two evils. Putting them directly in
Both of these are pretty harmless, but we could fix them by serving two different CSVs (or @ricardozanini wdyt? |
@LCaparelli we can easily clean up the orphan resources with finalizers. I'd say to register a finalizer with our Nexus CR resource to check if it's the last one in the cluster. If it's, we delete the SCC. So we can do everything programmatically and won't need to keep separated YAML files. See: https://www.openshift.com/blog/kubernetes-operators-best-practices
|
Fix #51
TODO:
Signed-off-by: Lucas Caparelli [email protected]