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 <ndevos@ibm.com>
Just like for the manager and sidecar executables, add `-version` as an option to the `csi-addons` tool. Signed-off-by: Niels de Vos <ndevos@ibm.com>
| 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.
it should be copied to /usr/sbin?
There was a problem hiding this comment.
/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.
| containers: | ||
| - command: | ||
| - /manager | ||
| - /csi-addons-manager |
There was a problem hiding this comment.
same change should also be made to CSV? might be missed to updated CSV with git push
There was a problem hiding this comment.
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 <ndevos@ibm.com>
| 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.
GOOS=linux seems to be dropped.
I hope it makes no difference
Syncing latest changes from upstream main for kubernetes-csi-addons
The
Makefilenow contains logic to provide a version (git tag) and thecurrent git commit hash in a
-versionargument 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
managerfor the CSI-Addons Operator, butcsi-addons-manager.Just like for the manager and sidecar executables, add
-versionas anoption to the
csi-addonstool.Updates: #385