-
Notifications
You must be signed in to change notification settings - Fork 307
Add security context #1961
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
Add security context #1961
Conversation
|
Given the security context appears in 4 different places (once in the operator deployment itself, then in three places in the cluster statefulset), I suspect we may need to improve our documentation about overrides for OpenShift. |
|
Docs regarding openshift will need some updating. I'm going to run this locally in CRC, but we likely need to override the |
|
Let me know if you've figured out the necessary OpenShift overrides (or just push a commit to the branch). |
|
I had to switch to something else on Friday. I'm looking into it now. |
|
Indeed it doesn't like the STS condition
The error describes the problem: This can be workaround with the suggestion from our docs that basically removes the Pod security context. With the security contexts in the containers, it's enough to pass the "restricted" validation. A potential improvement would be to set to I'll leave it to you to decide if you want to implement the annotation behaviour. |
|
For the cluster operator deployment, shouldn't this be split between pod and container securityContext? Example: |
|
Not necessarily, because the operator only has 1 container (rabbit has 2) and it doesn't have documented/supported side-car configurations. RabbitMQ, on the other hand, has 2 containers (init + rabbit), and it has the override feature, which can include additional containers. For RabbitMQ, the Pod security context will "catch" those containers coming from the override. |
|
Quick feedback on this change: this broke all our RabbitMQ deployments in OpenShift and OKD. We deploy rabbitmq instances by adding the anyuid permission to the rabbitmq serviceaccount (this is the workaround from back when the images couldn't run under an arbitrary user id) and after this change all rabbitmq pods are blocked because they set the seccomp profile. I understand the OpenShift security model is a bit awkward, but that caught us by surprise in a minor version operator update. |
|
That's quite surprising because I explicitly tested this change in Openshift Local (former Code Ready Containers), and I only encountered an problem with the run as user and fs group, as described here: #1961 (comment) However, after applying the recommendation for openshift in our docs [1], RabbitMQ started without any issues. From your comment, I understand that you were applying another workaround and this change caused an unexpected breakage. I still think that a minor version is appropriate because it doesn't break upstream Kubernetes, our main audience, and OCP users applying the documented workaround shouldn't experience breakage. I'll add some notes to the release notes to mention this potential pitfall. [1] https://www.rabbitmq.com/kubernetes/operator/using-on-openshift#arbitrary-user-ids |
|
You would have gotten to the seccomp problem if you had only removed the problematic values instead of the entire security context eventually. The biggest problem in transitioning from the old workaround to the now recommended is, that once you start the rabbitmq instances with user 999 they refuse to come up when switching to the randomized uid. Any idea how to fix that? The main issue is, that our workaround kind of used to be the recommended method once upon a time: rabbitmq/rabbitmq-website@a2180ef |
This closes #1910 and #1960
Adds a securityContext to the cluster operator deployment context.
Adds securityContext to RabbitMQ Pods, containers, and init containers.