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

Make it possible to configure containerSecurityContext for init-containers #372

Closed
NissesSenap opened this issue Mar 22, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@NissesSenap
Copy link
Collaborator

Is your feature request related to a problem? Please describe.
I need to be able to define securityContainerContext on the init container to be able to start the grafana-operator on my current cluster due to psp rules that we have globally defined.

Describe the solution you'd like
Use the same containerSecurityContext on the init container that you get from grafana.spec.deployment.containerSecurityContext

kind: Grafana
metadata:
  name: grafana
spec:
  deployment:
    containerSecurityContext:
      allowPrivilegeEscalation: false

to the init container.

Describe alternatives you've considered
Instead of using the same containerSecurityContext we could define a seperate one for the init container. Instead of using additional special config for initContainers directly under grafana.spec, like we do for grafana.spec.InitResources I would suggest creating a grafana.sepc.initContainers and store all initContainer specific config under it.

kind: Grafana
metadata:
  name: grafana
spec:
  initContainer:
    InitResources:
      requests:
        memory: "64Mi"
        cpu: "250m"
    initContainerSecurityContext:
      allowPrivilegeEscalation: false
  deployment:
    containerSecurityContext:
      allowPrivilegeEscalation: false

We could still keep grafana.spec.InitResources to be backwards compatible and defining it would prioritize it over grafana.spec.initContainer.InitResources. But when releasing 4.0 I would suggest removing grafana.spec.InitResources to only have one place to define initResources.

Additional context
When trying to start the grafana-operator on my current cluster I get the following error:

psp-allow-privilege-escalation-container] Privilege escalation container is not allowed: grafana-plugins-init

Existing solutions
N/A

@NissesSenap NissesSenap added the enhancement New feature or request label Mar 22, 2021
openshift-merge-robot added a commit that referenced this issue Mar 22, 2021
Add containerSecurityContext init-container #372
@HVBE
Copy link
Collaborator

HVBE commented Mar 23, 2021

Automation should have closed this, resolved through #373 👍

@HVBE HVBE closed this as completed Mar 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants