Skip to content
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

KUSTOMIZE_VERSION ?= v3.8.7 on bump-kb.yaml breaking the "Install the CRDs into the cluster" step on the kubebuilder Quick Start #5785

Closed
tavaresrodrigo opened this issue May 21, 2022 · 8 comments
Assignees

Comments

@tavaresrodrigo
Copy link

Bug Report

What did you do?

I'm following the https://book.kubebuilder.io/quick-start.html and during the "Install the CRDs into the cluster:" step, make install I experience the error below:

$ make install         
~/projects/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 ~/projects/guestbook/bin
Version v3.8.7 does not exist.
make: *** [~/projects/guestbook/bin/kustomize] Error 1

What did you expect to see?

I expected that the "make install" command would execute successfully allowing me to proceed to the run stage.

What did you see instead? Under which circumstances?

$ make install         
~/projects/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 ~/projects/guestbook/bin
Version v3.8.7 does not exist.
make: *** [~/projects/guestbook/bin/kustomize] Error 1

Environment

Operator type:

/language go

Kubernetes cluster type:

Minikube

$ operator-sdk version operator-sdk version: "v1.20.1", commit: "1780d438cfd87382d034c72703a80d9073b7b6d8", kubernetes version: "v1.23", go version: "go1.17.10", GOOS: "darwin", GOARCH: "arm64"

`$ go version go1.18.2 darwin/arm64``

$ kubectl version WARNING: This version information is deprecated and will be replaced with the output from kubectl version --short. Use --output=yaml|json to get the full version. Client Version: version.Info{Major:"1", Minor:"24", GitVersion:"v1.24.0", GitCommit:"4ce5a8954017644c5420bae81d72b09b735c21f0", GitTreeState:"clean", BuildDate:"2022-05-03T13:36:49Z", GoVersion:"go1.18.1", Compiler:"gc", Platform:"darwin/arm64"} Kustomize Version: v4.5.4 Server Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.3", GitCommit:"816c97ab8cff8a1c72eccca1026f7820e93e0d25", GitTreeState:"clean", BuildDate:"2022-01-25T21:19:12Z", GoVersion:"go1.17.6", Compiler:"gc", Platform:"linux/arm64"}

Troubleshooting details

Having a look at the bumb-kb.yaml I could see the KUSTOMIZE_VERSION ?= v3.8.7.

Investigating the install_kustomize.sh I noticed the release_url which is fetching the kustomize releases, however the oldest version the GitHub api is returning is v4.4.0.

Possible Solution

If I manually set the v4.5.5(latest) or v4.4.0(oldest) in the bump-kb.yaml file:

KUSTOMIZE_VERSION ?= v4.4.0

I'm able to "make install" and "make run" the controller.

I'm not quite sure what is the strategy to maintain the versions, if we should get the latest version or the oldest one in this case, but I would be happy to contribute with my first PR if you folks decide this is a decent workaround.

I'm also seeking to get engaged and contribute so any help or guidance to discuss an even better fix will be appreciated.

@camilamacedo86
Copy link
Contributor

camilamacedo86 commented May 21, 2022

Hi @tavaresrodrigo,

GOOS: "darwin", GOARCH: "arm64" is not supported by Kubebuilder or SDK.
You might want to look at the issue raised: kubernetes-sigs/kubebuilder#1932

Regards the kustomize dep only, you can work around it by using the v4; however, from v3 and v4, it has breaking changes, and we cannot ensure that it works well with the default stable scaffolds (such as go/v3).

In Kubebuilder (master) branch, we added a new kustomize/v2-alpha plugin that uses the v4; see: kubernetes-sigs/kubebuilder#2583. From master in Kubebuilder you are able to now:

kubebuilder init --plugins=kustomize/v2-alpha,base.go.kubebuilder.io/v3

We will probably also provide as follow up a new golang plugin like go/v4-alpha, which will allow users to get the same result by running kubebuilder/operator-sdk init --plugins=go/v4-alpha.

However, note that in order to support darwin/arm64 fully we need more changes, and it is not only about the kustomize version, see: kubernetes-sigs/kubebuilder#1932

c/c @jmrodri @rashmigottipati @ryantking @everettraven @asmacdo @fabianvf

@tavaresrodrigo
Copy link
Author

Hi @camilamacedo86, thank you 😃. I've tried on a t3.small and everything worked as expected. Do you think it might be worth handling this error? I think it would be a better user experience if the error was more precise, clearly describing the issue.

So instead of:

"Version v3.8.7 does not exist."

maybe:

 "GOOS: "darwin", GOARCH: "arm64" is not supported by Kubebuilder or SDK" (as you said.)

Thank you for the collaboration, and sorry if my suggestion makes no sense for the project, I'm just getting started in the Framework and there is still a lot to learn, let me know if I can contribute in case you decide this is interesting for the project though, I'm trying to learn more about operators and I think contributing is the best way to do that.

@camilamacedo86
Copy link
Contributor

camilamacedo86 commented May 24, 2022

Hi @tavaresrodrigo,

See: kubernetes-sigs/kubebuilder#2698
(This PR address your suggestion)

c/c @rashmigottipati @ryantking @everettraven ^ looking for PTAL.

@tavaresrodrigo
Copy link
Author

This is great! Thank you @camilamacedo86 🙏 .

@everettraven
Copy link
Contributor

closing this issue since @camilamacedo86 had the upstream PR merged.

@everettraven
Copy link
Contributor

@tavaresrodrigo Would you be interested in helping test a change upstream in Kubebuilder that tries to make modifications to the scaffolded Makefile so that M1 Mac users can use Kustomize v3.8.7 by building it locally instead of attempting to pull a prebuilt release?

If you are interested, there is an upstream PR to address it here: kubernetes-sigs/kubebuilder#2706

@algogrit
Copy link

Hi @tavaresrodrigo,

GOOS: "darwin", GOARCH: "arm64" is not supported by Kubebuilder or SDK. You might want to look at the issue raised: kubernetes-sigs/kubebuilder#1932

Regards the kustomize dep only, you can work around it by using the v4; however, from v3 and v4, it has breaking changes, and we cannot ensure that it works well with the default stable scaffolds (such as go/v3).

In Kubebuilder (master) branch, we added a new kustomize/v2-alpha plugin that uses the v4; see: kubernetes-sigs/kubebuilder#2583. From master in Kubebuilder you are able to now:

kubebuilder init --plugins=kustomize/v2-alpha,base.go.kubebuilder.io/v3

We will probably also provide as follow up a new golang plugin like go/v4-alpha, which will allow users to get the same result by running kubebuilder/operator-sdk init --plugins=go/v4-alpha.

However, note that in order to support darwin/arm64 fully we need more changes, and it is not only about the kustomize version, see: kubernetes-sigs/kubebuilder#1932

c/c @jmrodri @rashmigottipati @ryantking @everettraven @asmacdo @fabianvf

This should be mentioned in the kubebuilder book as well.

@algogrit
Copy link

algogrit commented Jul 29, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants