operator-sdk
operator-sdk copied to clipboard
Make install target is broken because try to install the kustomize when it is installed already
Bug Report
What did you do?
call make install twice
What did you expect to see?
Not fail and just install the kustomize if that is not installed already
What did you see instead? Under which circumstances?
The following error in the second time because the bin is in the dir already
$ make install
/Users/camilamacedo86/go/src/guestbook/bin/controller-gen rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases
curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash -s -- 3.8.7 /Users/camilamacedo86/go/src/guestbook/bin
/Users/camilamacedo86/go/src/guestbook/bin/kustomize exists. Remove it first.
make: *** [Makefile:123: /Users/camilamacedo86/go/src/guestbook/bin/kustomize] Error 1
Environment
Operator type:
/language go /language ansible /language helm
$ operator-sdk version
master
@camilamacedo86: The label(s) language/-->
cannot be applied, because the repository doesn't have them.
In response to this:
Bug Report
What did you do?
call make install twice
What did you expect to see?
Not fail and just install the kustomize if that is not installed already
What did you see instead? Under which circumstances?
The following error in the second time because the bin is in the dir already
$ make install /Users/camilamacedo86/go/src/guestbook/bin/controller-gen rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash -s -- 3.8.7 /Users/camilamacedo86/go/src/guestbook/bin /Users/camilamacedo86/go/src/guestbook/bin/kustomize exists. Remove it first. make: *** [Makefile:123: /Users/camilamacedo86/go/src/guestbook/bin/kustomize] Error 1
Environment
Operator type:
/language go --> /language ansible --> /language helm
$ operator-sdk version
master
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
c/c @ryantking
This seems like the make target for installing kustomize just needs to be changed to this simple bash expression:
KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
.PHONY: kustomize
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
$(KUSTOMIZE): $(LOCALBIN)
test -s $(LOCALBIN)/kustomize || { curl -s $(KUSTOMIZE_INSTALL_SCRIPT) | bash -s -- $(subst v,,$(KUSTOMIZE_VERSION)) $(LOCALBIN); }
In case it helps see before/after:
--- a/Makefile
+++ b/Makefile
@@ -168,7 +168,7 @@ KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/k
.PHONY: kustomize
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
$(KUSTOMIZE): $(LOCALBIN)
- curl -s $(KUSTOMIZE_INSTALL_SCRIPT) | bash -s -- $(subst v,,$(KUSTOMIZE_VERSION)) $(LOCALBIN)
+ test -s $(LOCALBIN)/kustomize || { curl -s $(KUSTOMIZE_INSTALL_SCRIPT) | bash -s -- $(subst v,,$(KUSTOMIZE_VERSION)) $(LOCALBIN); }
TODO: do we need to bump kubebuilder to get this?
Still need to bump kubebuilder it seems, we updated to 3.5.0, which i assume doesnt have this change @camilamacedo86 ?
@asmacdo we can check that the change was made in the PR linked: https://github.com/kubernetes-sigs/kubebuilder/pull/2774
Therefore, we can see that it is only in master and that we do have not an update here on the SDK side, see the SDK testdata samples:
https://github.com/operator-framework/operator-sdk/blob/87cdc50247832a53e26b713a2ecab6e2215bdb52/testdata/go/v3/memcached-operator/Makefile#L169-L173
We can do that now by updating the master commit OR we can wait for the next KB release. Indeed we do many times bump using the commits. Would you like to do this one? If yes, please feel free to do the bump and I can help with the reviews.
Sorted out.