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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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
Signed-off-by: ImpSy <3097030+ImpSy@users.noreply.github.com>
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ChenYi015

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

@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.

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.

2 participants