-
Notifications
You must be signed in to change notification settings - Fork 115
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
Conversation
@@ -3,6 +3,6 @@ | |||
FROM gcr.io/distroless/static:nonroot | |||
WORKDIR / | |||
COPY manager . | |||
USER nonroot:nonroot | |||
USER 65532:65532 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个数是随便写的吗?咱们有没有统一的规范
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
但是我看harbor这边用的都是10000
是不是我们应该统一
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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/
.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
See kubernetes-sigs/kubebuilder#1635 for more info Signed-off-by: He Weiwei <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
See kubernetes-sigs/kubebuilder#1635 for more
info
Signed-off-by: He Weiwei [email protected]