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

Update default container security context #2265

Merged
merged 4 commits into from
Oct 24, 2024

Conversation

ChenYi015
Copy link
Contributor

Purpose of this PR

Proposed changes:

  • Update default container security context

Change Category

Indicate the type of change by marking the applicable boxes:

  • Bugfix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that could affect existing functionality)
  • Documentation update

Rationale

Checklist

Before submitting your PR, please review the following:

  • I have conducted a self-review of my own code.
  • I have updated documentation accordingly.
  • I have added tests that prove my changes are effective or that my feature works.
  • Existing unit tests pass locally with my changes.

Additional Notes

@ChenYi015
Copy link
Contributor Author

/assign @jacobsalway @ImpSy

@jacobsalway
Copy link
Member

jacobsalway commented Oct 18, 2024

Might need to do some investigation to map out all the disk usage of spark-submit but what are your thoughts on also using an emptyDir volume in the controller and adding readOnlyRootFilesystem: true as well?

Might not be worth it if this isn't a common Kubernetes cluster security requirement in the same way that running as non-root and dropping all capabilities are.

Related PR: #2219

@ImpSy
Copy link
Contributor

ImpSy commented Oct 22, 2024

Might need to do some investigation to map out all the disk usage of spark-submit but what are your thoughts on also using an emptyDir volume in the controller and adding readOnlyRootFilesystem: true as well?

Yeah I feel like readOnlyRootFilesystem is a bit too restrictive especially while we are actively modifying the usage of the controller with pod templates

But like the PR #2219 propose we could mount a volume on /tmp and use os.CreateTemp everytime we need a local file

@jacobsalway
Copy link
Member

jacobsalway commented Oct 22, 2024

Could push the user and group directives down to the Dockerfile rather than the container security context. I'm not sold on read-only FS because any temporary disk usage that isn't on a volume could cause a panic but it's an enhancement we can make later down the line if requested/it's a common security requirement or implemented in the other PR.

@google-oss-prow google-oss-prow bot added size/M and removed size/S labels Oct 23, 2024
@ChenYi015
Copy link
Contributor Author

Could push the user and group directives down to the Dockerfile rather than the container security context. I'm not sold on read-only FS because any temporary disk usage that isn't on a volume could cause a panic but it's an enhancement we can make later down the line if requested/it's a common security requirement or implemented in the other PR.

I have pushed the user and group directives down to the Dockerfile. Agree on that we would better implement the readOnlyRootFileSystem in a dedicated PR.

Copy link
Member

@jacobsalway jacobsalway left a comment

Choose a reason for hiding this comment

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

/lgtm

Works for me in local testing on Kind. As you said let's do readOnlyRootFilesystem: true in a separate PR.

@google-oss-prow google-oss-prow bot added the lgtm label Oct 23, 2024
@ChenYi015
Copy link
Contributor Author

/approve

Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ChenYi015, jacobsalway

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-prow google-oss-prow bot merged commit fd2e125 into kubeflow:master Oct 24, 2024
11 checks passed
@ChenYi015 ChenYi015 deleted the security-context branch October 24, 2024 02:03
@cccsss01
Copy link

cccsss01 commented Nov 2, 2024

Might need to do some investigation to map out all the disk usage of spark-submit but what are your thoughts on also using an emptyDir volume in the controller and adding readOnlyRootFilesystem: true as well?

Yeah I feel like readOnlyRootFilesystem is a bit too restrictive especially while we are actively modifying the usage of the controller with pod templates

But like the PR #2219 propose we could mount a volume on /tmp and use os.CreateTemp everytime we need a local file

majority of these local files created don't need to be stored permanently correct?

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

Successfully merging this pull request may close these issues.

4 participants