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

fix: specify nonroot uid for manager #420

Merged
merged 1 commit into from
Feb 3, 2021
Merged

Conversation

heww
Copy link
Collaborator

@heww heww commented Jan 27, 2021

See kubernetes-sigs/kubebuilder#1635 for more
info

Signed-off-by: He Weiwei [email protected]

@@ -3,6 +3,6 @@
FROM gcr.io/distroless/static:nonroot
WORKDIR /
COPY manager .
USER nonroot:nonroot
USER 65532:65532
Copy link
Collaborator

Choose a reason for hiding this comment

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

这个数是随便写的吗?咱们有没有统一的规范

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This user id is from kubernetes-sigs/kubebuilder#1635 which is the part of the kubebuilder v3.

Copy link
Collaborator

Choose a reason for hiding this comment

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

但是我看harbor这边用的都是10000
是不是我们应该统一

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the user id to run the harbor-operator itself, not the user id to run the harbor.

I think we should keep it the same with kubebuilder because these files may be generated by the kubebuilder.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I cannot read what @bitsf wrote,
But I agree with @heww : we should keep the nonroot user:
https://github.com/GoogleContainerTools/distroless/blob/master/examples/nonroot/BUILD#L17

Why using it here?
IMO The change should only be be applied to files under config/.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This PR lets the harbor operator can run in the k8s cluster with PSP enabled.

The config/manager/manager.yaml was changed with runAsUser: 65532

Copy link
Collaborator

Choose a reason for hiding this comment

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

I got it, but the dockerfile does not require any changes.
The user id should be changed on runtime, not at buildtime.

The user 65532 does not exist in gcr.io/distroless/static:nonroot image.

@heww heww requested a review from mhurtrel as a code owner January 27, 2021 08:32
Copy link
Collaborator

@steven-zou steven-zou left a comment

Choose a reason for hiding this comment

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

LGTM

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.

4 participants