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

Deployment issues on OpenShift due to container securityContext #446

Open
BlueCog opened this issue Nov 11, 2024 · 2 comments
Open

Deployment issues on OpenShift due to container securityContext #446

BlueCog opened this issue Nov 11, 2024 · 2 comments
Labels
chart( operator ) Related to the operator (cloudnative-pg) chart

Comments

@BlueCog
Copy link

BlueCog commented Nov 11, 2024

Summary

When deploying the CloudNativePG Helm chart on OpenShift, we encountered deployment failures caused by the container-level securityContext specified in the chart's values.yaml. OpenShift's security policies restrict the use of certain securityContext fields, leading to conflicts that prevent the pods from starting.

Details

  • The securityContext at the container level includes hardcoded runAsUser and runAsGroup values.
  • OpenShift assigns user IDs (UIDs) and group IDs (GIDs) dynamically for security reasons.
  • Specifying runAsUser and runAsGroup in the container securityContext causes permission issues on OpenShift.
    -The pods fail to start with errors related to security context constraints.

Proposed Solution:

  • Introduce a new configuration option to make the container securityContext optional.
  • Add a boolean flag enableSecurityContex under containerSecurityContext in values.yaml.
  • Modify deployment.yaml to include the container securityContext only if enableSecurityContext is true.
  • Default the flag to true to preserve existing behavior for users not affected by this issue.

Pull Request:

A pull request implementing this solution has been submitted: #445

Additional Context:

We are not utilizing the Operator Lifecycle Manager (OLM) installation method for deploying the CloudNativePG operator. Instead, we have an internal Lifecycle Management (LCM) process that leverages tools like Renovate and ArgoCD to manage our deployments.

@sxd
Copy link
Member

sxd commented Nov 11, 2024

Hello @BlueCog

The chart to install the operator it's not meant to be used with OpenShift, for that, there's a supported OLM package, the chart should never be used on OpenShift

Regards,

@BlueCog
Copy link
Author

BlueCog commented Nov 11, 2024

The chart to install the operator it's not meant to be used with OpenShift, for that, there's a supported OLM package, the chart should never be used on OpenShift

Regards,

Thank you for your response.

I wanted to confirm whether this is the official stance regarding the usage of the Helm chart on OpenShift. In our experience, we have successfully installed the CloudNativePG operator on OpenShift with minimal adjustments. Post-installation, we have been able to provision databases and utilize the operator's features without any issues.

Our organization operates in an air-gapped environment, which means that utilizing the Operator Lifecycle Manager (OLM) does not provide direct benefits for us. Implementing OLM would require additional efforts to mirror and maintain the OLM packages within our environment. Moreover, OLM does not fit well with our stringent automated update policy, which is efficiently managed through standalone images and Helm charts, along with tools like Renovate and ArgoCD.

By deploying via Helm charts, we can:

  • Maintain Consistency: Our lifecycle management process ensures all components are updated and deployed consistently.
  • Automate Updates: Tools like Renovate help us keep dependencies current without manual intervention.
  • Integrate Seamlessly: Helm charts align with our existing CI/CD pipelines and infrastructure.

Given these factors, having the option to deploy the operator using Helm charts is highly beneficial for us. The changes proposed in the pull request aim to enhance the Helm chart's compatibility with OpenShift by making the container securityContext optional. This modification does not affect users who deploy in environments without such constraints but provides flexibility for those who do.

We would appreciate it if you could consider our use case and the proposed changes. Supporting the Helm chart deployment on OpenShift would greatly assist organizations like ours that rely on Helm for deployment and have specific operational requirements.

Thank you for your time and consideration. We look forward to your feedback.

@itay-grudev itay-grudev added chart( cluster ) Related to the cluster chart chart( operator ) Related to the operator (cloudnative-pg) chart and removed chart( cluster ) Related to the cluster chart labels Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chart( operator ) Related to the operator (cloudnative-pg) chart
Projects
None yet
Development

No branches or pull requests

3 participants