-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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: Remove kubectl binary from argo image(#5005) #5101
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5101 +/- ##
==========================================
- Coverage 40.90% 40.88% -0.02%
==========================================
Files 136 136
Lines 18419 18426 +7
==========================================
Hits 7534 7534
- Misses 9810 9816 +6
- Partials 1075 1076 +1
Continue to review full report at Codecov.
|
@jannfis @jessesuen This is as part of our discussion at #5005 |
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.
Please also remove hack/installers/install-kubectl-linux.sh
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 change is incomplete, because the last place where we still use kubectl is at the version endpoint:
See: https://github.com/argoproj/argo-cd/blob/master/server/version/version.go#L32-L51
Can you also update version.go to somehow report the version that we import in go modules?
If we decide to remove kubectl from the image, why should we import or print the version ? @jessesuen |
Was trying to find a related discussion but looks like it is gone in slack history. Argo CD still uses kubectl as a library. So user still need to know which version it is e.g. to determine if the target k8s cluster compatible or not. |
We still care about the version of library because it's intended to be equivalent in behavior to the corresponding kubectl binary (including its bugs and fixes) |
Since we use a version pin on the Kubernetes libraries in awk '/k8s.io\/client-go => k8s.io\/client-go/ { print $4 }' go.mod | sed -e 's/v0\.\(.*\)/v1\.\1/' I.e. on current master code this will yield:
We can pass this in Line 118 in 64e1c38
Then use this version identifier in the version endpoint, and get rid of Btw, there is a version discrepancy in client libs used and kubectl installed in the image currently, so the version information is quite misleading currently. |
ec24631
to
52eff1c
Compare
Makefile
Outdated
@@ -14,6 +14,7 @@ GIT_TAG=$(shell if [ -z "`git status --porcelain`" ]; then git describe --exact- | |||
GIT_TREE_STATE=$(shell if [ -z "`git status --porcelain`" ]; then echo "clean" ; else echo "dirty"; fi) | |||
PACKR_CMD=$(shell if [ "`which packr`" ]; then echo "packr"; else echo "go run github.com/gobuffalo/packr/packr"; fi) | |||
VOLUME_MOUNT=$(shell if test "$(go env GOOS)" = "darwin"; then echo ":delegated"; elif test selinuxenabled; then echo ":delegated"; else echo ""; fi) | |||
KUBECTL_VERSION=$(shell awk '/k8s.io\/client-go => k8s.io\/client-go/ { print $4 }' go.mod | sed -e 's/v0\.\(.*\)/v1\.\1/') |
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.
Due to GNU make's own variable expansion, print $4
should be print $$4
here so that the identifier will be processed correctly by awk
94242ee
to
ed4ad4b
Compare
Signed-off-by: iam-veeramalla <[email protected]>
ed4ad4b
to
6b3ef8d
Compare
Please review |
Please check |
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!
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. Awesome! Minus 42 MB from the image.
) Signed-off-by: iam-veeramalla <[email protected]>
Signed-off-by: iam-veeramalla [email protected]
Checklist: