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

support pod securitycontext and container security context #496

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

pgvishnuram
Copy link
Contributor

@pgvishnuram pgvishnuram commented May 13, 2024

Description

This PR segregates podSecurityContext and containerSecurityContext in order to add changes independently

Related Issues

Yet to update

Testing

QA should able to pass both container securityContext and podSecurity context independly

Merging

cherry-pick to valid dag-server releases

@pgvishnuram pgvishnuram marked this pull request as ready for review May 13, 2024 15:20
@pgvishnuram pgvishnuram requested a review from a team as a code owner May 13, 2024 15:20
@@ -50,6 +50,7 @@ spec:
ports:
- name: server
containerPort: {{ .Values.dagDeploy.ports.dagServerHttp }}
securityContext: {{ toYaml .Values.dagDeploy.securityContext | nindent 12 }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be containerSecurityContext ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like securityContext should apply to both pods and containers, podSecurityContext should apply to pods, and containerSecurityContext should apply to containers.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes we can set containerSecurityContext for better naming and we will also release a houston api changes as well for adopting new naming. should we target this release or next patch

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like we should do it on this patch because otherwise customers could put a securityContext config in place for containers, and later that becomes a global setting for pods and containers, which is probably not what they intended.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@danielhoherd can we follow oss approach here

securityContexts: 
    pods: {}
    container: {}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i like that, but what do they use for the lower-priority hierarchy?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

they have top level securityContext and then at service levels - but our use case it to allow passing securityContext when a user what to set more extensive properties at container level

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should probably widen this securityContext effort out into a ticket that standardizes on a way that we will do securityContexts, describe the way we think is best to do them, and then make an effort to do that everywhere. We don't want to come up with a cool way to do this in this one feature if it is inconsistent with how we do it elsewhere, so we should be consistent with some other implementation here (maybe the airflow one) and also strive to be consistent with a default implementation everywhere. I'll open a ticket about that.

https://github.com/astronomer/issues/issues/6368

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

those are strairght forward but we should mend our code in houston thats why we are going in selectives

values.yaml Outdated
Comment on lines 573 to 576
securityContext: {}
podSecurityContext: {}
# runAsUser: 999
# runAsGroup: 0
containerSecurityContext: {}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

securityContexts: 
    pod: {}
    container: {}

Copy link
Member

@danielhoherd danielhoherd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good for now. It's not perfect, but it will unblock us. We can circle back to this when working on https://github.com/astronomer/issues/issues/6368

This is going to break older dagDeploy deployments though because it changes the securityContexts helm values structure.

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

Successfully merging this pull request may close these issues.

None yet

2 participants