-
Notifications
You must be signed in to change notification settings - Fork 39
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
build: include -version
option for csi-addons executable
#397
Conversation
The `Makefile` now contains logic to provide a version (git tag) and the current git commit hash in a `-version` argument to executables. However the container-images did not use `make`, and therefor the executables would not have the version information set. While updating the building of the executables in the container, the names of the executables has been prefixed with `csi-addons-`, so that a listing of running processes on a Kubernetes node does not show `manager` for the CSI-Addons Operator, but `csi-addons-manager`. Updates: csi-addons#385 Signed-off-by: Niels de Vos <[email protected]>
Just like for the manager and sidecar executables, add `-version` as an option to the `csi-addons` tool. Signed-off-by: Niels de Vos <[email protected]>
|
||
# Use distroless as minimal base image to package the sidecar binary | ||
# Refer to https://github.com/GoogleContainerTools/distroless for more details | ||
FROM gcr.io/distroless/static:latest | ||
WORKDIR / | ||
COPY --from=builder /workspace /usr/bin/ | ||
COPY --from=builder /workspace/go/src/github.com/csi-addons/kubernetes-csi-addons/bin/csi-addons-sidecar /usr/sbin/ | ||
COPY --from=builder /workspace/go/src/github.com/csi-addons/kubernetes-csi-addons/bin/csi-addons /usr/bin/ |
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.
it should be copied to /usr/sbin
?
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.
/usr/sbin
is the path for executables that act like servers or are for admin users. csi-addons
is a tool that can be used by any user to talk to the csi-driver. I though it would be more suitable in /usr/bin
. The distinction between the paths is not very important to me, I am happy yo change either, both should be in the $PATH
when an admin user logs in the pod.
@@ -22,7 +22,7 @@ spec: | |||
runAsNonRoot: true | |||
containers: | |||
- command: | |||
- /manager | |||
- /csi-addons-manager |
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.
same change should also be made to CSV? might be missed to updated CSV with git push
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.
Hmm, I don't think the command is included there. I can not find it in config/manifests/bases/clusterserviceversion.yaml.in
.
Disable building with CGo support, so that only native Golang functions are used. This makes it possible to build the executables in one container, and run them in a distroless container. Fore rebuilding all components with `-a` in the `Makefile`, this prevents including artifacts that may have been built outside the contains with CGo enabled. Signed-off-by: Niels de Vos <[email protected]>
@@ -4,17 +4,17 @@ FROM quay.io/projectquay/golang:1.20 as builder | |||
# Copy the contents of the repository | |||
ADD . /workspace/go/src/github.com/csi-addons/kubernetes-csi-addons | |||
|
|||
ENV GOPATH=/workspace/go | |||
ENV GOPATH=/workspace/go CGO_ENABLED=0 |
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.
GOOS=linux
seems to be dropped.
I hope it makes no difference
The
Makefile
now contains logic to provide a version (git tag) and thecurrent git commit hash in a
-version
argument to executables. Howeverthe container-images did not use
make
, and therefor the executableswould not have the version information set.
While updating the building of the executables in the container, the
names of the executables has been prefixed with
csi-addons-
, so that alisting of running processes on a Kubernetes node does not show
manager
for the CSI-Addons Operator, butcsi-addons-manager
.Just like for the manager and sidecar executables, add
-version
as anoption to the
csi-addons
tool.Updates: #385