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

FEATURE: build operator image as non-root #2171

Merged
merged 1 commit into from
Sep 23, 2024

Conversation

ImpSy
Copy link
Contributor

@ImpSy ImpSy commented Sep 16, 2024

Purpose of this PR

Reduce the permission of the docker image by making it non-root (like the spark image it's build from)

Proposed changes:

  • Re-enable go mod caching while building the image
  • Make the image use the USER define in the base spark-image (UID: 185, NAME: spark)
  • Use setcap on the binary to keep the ability to mount port <1024 (useful for people mounting webhook on 443)

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

If we aim to increase security of the project, making the image non root is a good 1st step

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

This change has been live on our product for more than 6 month
You can find the PR from our fork here -> https://github.com/spotinst/spark-on-k8s-operator/pull/10/files

@ImpSy ImpSy force-pushed the non-root-image branch 2 times, most recently from 0844cd8 to cc75df7 Compare September 16, 2024 10:07
@ImpSy ImpSy changed the title build operator image as non-root FEATURE: build operator image as non-root Sep 16, 2024
@ChenYi015
Copy link
Contributor

@ImpSy Thanks for the effort to improve the security of operator image! LGTM, will wait for another approval @vara-bonthu @jacobsalway.

Copy link
Contributor

@vara-bonthu vara-bonthu left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution! Nice work @ImpSy 🙌🏼

Copy link
Contributor

@vara-bonthu vara-bonthu left a comment

Choose a reason for hiding this comment

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

/lgtm

Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ChenYi015, vara-bonthu

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:
  • OWNERS [ChenYi015,vara-bonthu]

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 e2cc295 into kubeflow:master Sep 23, 2024
7 checks passed
@ImpSy ImpSy deleted the non-root-image branch September 23, 2024 09:16
ChenYi015 pushed a commit that referenced this pull request Sep 26, 2024
Signed-off-by: ImpSy <[email protected]>
(cherry picked from commit e2cc295)
ChenYi015 pushed a commit that referenced this pull request Sep 26, 2024
Signed-off-by: ImpSy <[email protected]>
(cherry picked from commit e2cc295)
jbhalodia-slack pushed a commit to jbhalodia-slack/spark-operator that referenced this pull request Oct 4, 2024
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.

3 participants