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

Define SecurityContext for container components #923

Closed
kadel opened this issue Sep 12, 2022 · 3 comments
Closed

Define SecurityContext for container components #923

kadel opened this issue Sep 12, 2022 · 3 comments

Comments

@kadel
Copy link
Member

kadel commented Sep 12, 2022

With the introduction of Pod Security Admission in Kubernetes 1.25 and with OpenShift enabling this by default in 4.11 (https://cloud.redhat.com/blog/pod-security-admission-in-openshift-4.11)

Devfile should allow users to define SecurityContext for container components.

The SecurityContext is required to pass the checks performed by PodSecurity Admission controller.
For example, in OCP 4.11 the "restricted" policy is audited. That means that every container started without proper SecurityContext will be recorded will produce a warning and will be recorded to the audit log.
The containers without proper SecurityContext will be even more problematic with future OCP versions as they plan to change the default from "audit" to "enforce". This will mean that every container that doesn't meet the "restricted" requirements will be rejected.

@kadel
Copy link
Member Author

kadel commented Sep 12, 2022

There are two solutions for this.
We either allow users to define SecurityContext as part of the devfile container definition.

Or we leave the responsibility of correctly setting the SecurityContext to tooling.
The tooling approach might not work as I'm not sure if tools will be able to always correctly determine the correct SecurityContext setting for each cluster.

@Jdubrick
Copy link
Contributor

Closing issue as I believe users can define SecurityContext in the latest devfile schema version. If this is incorrect we can reopen it.

@Jdubrick Jdubrick closed this as not planned Won't fix, can't repro, duplicate, stale Feb 28, 2024
@michael-valdron
Copy link
Member

Closing issue as I believe users can define SecurityContext in the latest devfile schema version. If this is incorrect we can reopen it.

You can by overriding through the attributes: https://devfile.io/docs/2.2.2/overriding-pod-and-container-attributes#container-overrides

But the schema spec does not contain SecurityContext field properties for components. With container and pod overriding attributes, I don't think this is a priority to implement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done ✅
Development

No branches or pull requests

3 participants