Skip to content

Commit afc3a88

Browse files
Bump kubebuilder release 3.6.0, upgrade kustomize and add support for Apple Silicon (#5965)
* Bump kubebuilder 3.6.0, upgrade kustomize and add support to Apple Silicon * Update changelog/fragments/bump-kubebuilder-add-kustomize.yaml * Update changelog/fragments/bump-kubebuilder-add-kustomize.yaml Co-authored-by: Varsha <[email protected]>
1 parent e516ae4 commit afc3a88

File tree

119 files changed

+2864
-1488
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+2864
-1488
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export IMAGE_VERSION = v1.22.0
99
export SIMPLE_VERSION = $(shell (test "$(shell git describe --tags)" = "$(shell git describe --tags --abbrev=0)" && echo $(shell git describe --tags)) || echo $(shell git describe --tags --abbrev=0)+git)
1010
export GIT_VERSION = $(shell git describe --dirty --tags --always)
1111
export GIT_COMMIT = $(shell git rev-parse HEAD)
12-
export K8S_VERSION = 1.24.1
12+
export K8S_VERSION = 1.24.2
1313

1414
# Build settings
1515
export TOOLS_DIR = tools/bin
@@ -36,6 +36,7 @@ export PATH := $(PWD)/$(BUILD_DIR):$(PWD)/$(TOOLS_DIR):$(PATH)
3636

3737
.PHONY: generate
3838
generate: build # Generate CLI docs and samples
39+
rm -rf testdata
3940
go run ./hack/generate/cncf-maintainers/main.go
4041
go run ./hack/generate/cli-doc/gen-cli-doc.go
4142
go run ./hack/generate/samples/generate_testdata.go
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# entries is a list of entries to include in
2+
# release notes and/or the migration guide
3+
entries:
4+
- description: Legacy layout "Kubebuilder 2.x" provided via the go/v2 plugin is officially deprecated. Be aware that since `Apr 2021`, the default layout produced is done via the `go/v3`. ([More info](https://github.com/kubernetes-sigs/kubebuilder/discussions/2842)) Check your `PROJECT` file to make sure that your project layout is `go.kubebuilder.io/v3`, if not please follow the [migration guide](https://sdk.operatorframework.io/docs/building-operators/golang/migration/) to upgrade your project.
5+
kind: "deprecation"
6+
breaking: false
7+
- description: Add a plugin (deploy-image/v1-alpha) for Golang projects that scaffolds the code to deploy and manage an Operand(image). You can test it out by running `operator-sdk --group=example.com --version=v1alpha1 --kind=Memcached --image=memcached:1.6.15-alpine --image-container-command="memcached,-m=64,modern,-v" --image-container-port="11211" --run-as-user="1001" --plugins="deploy-image/v1-alpha"` [More info](https://master.book.kubebuilder.io/plugins/deploy-image-plugin-v1-alpha.html)
8+
kind: "addition"
9+
breaking: false
10+
- description: Add a plugin (grafana/v1-alpha) valid for all languages to help you generate Grafana dashboards. You can test it out by running `operator-sdk edit --plugins=grafana.kubebuilder.io/v1-alpha` [More info](https://master.book.kubebuilder.io/plugins/grafana-v1-alpha.html)
11+
kind: "addition"
12+
breaking: false
13+
- description: Add new golang plugin `go/v4-alpha` which adds support for Apple Silicon(`darwin/arm64`)
14+
kind: "addition"
15+
breaking: false
16+
- description: Fix Makefile targets to not download binaries when they are found already
17+
kind: "bugfix"
18+
breaking: false
19+
migration:
20+
header: (go/v3) Fix Makefile targets to not download binaries when they are found already
21+
body: |
22+
Update the Makefile targets by adding `test -s $(LOCALBIN)/<binary-name> ||` before the instruction to download them, see:
23+
24+
```sh
25+
KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
26+
.PHONY: kustomize
27+
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
28+
$(KUSTOMIZE): $(LOCALBIN)
29+
test -s $(LOCALBIN)/kustomize || { curl -s $(KUSTOMIZE_INSTALL_SCRIPT) | bash -s -- $(subst v,,$(KUSTOMIZE_VERSION)) $(LOCALBIN); }
30+
31+
.PHONY: controller-gen
32+
controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary.
33+
$(CONTROLLER_GEN): $(LOCALBIN)
34+
test -s $(LOCALBIN)/controller-gen || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION)
35+
36+
.PHONY: envtest
37+
envtest: $(ENVTEST) ## Download envtest-setup locally if necessary.
38+
$(ENVTEST): $(LOCALBIN)
39+
test -s $(LOCALBIN)/setup-envtest || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
40+
```
41+
- description: Remove the option to call `kustomize/v1` plugin alone. If you are looking to use this project as a base for you to generate other plugins, please use [Kubebuilder](https://github.com/kubernetes-sigs/kubebuilder) instead
42+
kind: "bugfix"
43+
breaking: false
44+
- description: (go/v3) Update `controller-tools` from `0.9.0` to `0.9.2`. [More info](https://github.com/kubernetes-sigs/controller-tools/releases/tag/v0.9.2)
45+
kind: "change"
46+
breaking: false
47+
migration:
48+
header: (go/v3) Update `controller-tools` from `0.9.0` to `0.9.2`.
49+
body: |
50+
In the `Makefile` file, replace `CONTROLLER_TOOLS_VERSION ?= v0.9.0` with `CONTROLLER_TOOLS_VERSION ?= v0.9.2`
51+
- description: (go/v3) Update `controller-runtime` from `v0.12.1` to `v0.12.2` and Kubernetes dependencies from `v0.24.0` to `v0.24.2`. [More info](https://github.com/kubernetes-sigs/controller-runtime/releases/tag/v0.12.2)
52+
kind: "change"
53+
breaking: false
54+
migration:
55+
header: (go/v3) Update `controller-runtime` from `v0.12.1` to `v0.12.2` and Kubernetes dependencies from `v0.24.0` to `v0.24.2`.
56+
body: |
57+
In the `go.mod` file, ensure the following dependencies versions and run `go mod tidy`:
58+
59+
```go
60+
k8s.io/api v0.24.2
61+
k8s.io/apimachinery v0.24.2
62+
k8s.io/client-go v0.24.2
63+
sigs.k8s.io/controller-runtime v0.12.2
64+
```
65+
- description: (go/v3,ansible/v1,helm/v1) Update `gcr.io/kubebuilder/kube-rbac-proxy` from `0.12.0` to `0.13.0`. [More info](https://github.com/brancz/kube-rbac-proxy/releases/tag/v0.13.0)
66+
kind: "change"
67+
breaking: false
68+
migration:
69+
header: Update `gcr.io/kubebuilder/kube-rbac-proxy` from `0.12.0` to `0.13.0`
70+
body: |
71+
In the `config/default/manager_auth_proxy_patch.yaml` file, replace `gcr.io/kubebuilder/kube-rbac-proxy:0.12.0` with `gcr.io/kubebuilder/kube-rbac-proxy:0.13.0`
72+
- description: >
73+
(ansible/v1,helm/v1) Add support for Apple Silicon(`darwin/arm64`) and upgrade kustomize version from `v3.8.7` to `v4.5.5`. [Release Notes](https://github.com/kubernetes-sigs/kustomize/releases/tag/kustomize%2Fv4.0.0)
74+
kind: "change"
75+
# Is this a breaking change?
76+
breaking: true
77+
migration:
78+
header: (ansible/v1,helm/v1) Upgrade kustomize versions from `v3.8.7` to `v4.5.5`
79+
body: |
80+
Upgrade kustomize versions from `v3.8.7` to `v4.5.5`
81+
82+
**WARNING** If your project has customizations using kustomize you might be impacted by them. See its [Release Notes](https://github.com/kubernetes-sigs/kustomize/releases/tag/kustomize%2Fv4.0.0). (Note all changes are covered by its docs)
83+
- Update the kustomize version in your Makefile: ensure that the value used for `KUSTOMIZE_VERSION` is `v4.5.5`
84+
85+
- In the `config/default/kustomization.yaml` file:
86+
a) Replace:
87+
```yaml
88+
#commonLabels:
89+
# someName: someValue
90+
```
91+
92+
With:
93+
```yaml
94+
#labels:
95+
#- includeSelectors: true
96+
# pairs:
97+
# someName: someValue
98+
```
99+
100+
b) Replace: `bases:` With: `resources:`
101+
102+
**(Valid Only for Ansible Projects)**
103+
- In the molecule/default, replace `--load_restrictor none .` with `--load-restrictor LoadRestrictionsNone`
104+

go.mod

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,16 @@ require (
3434
golang.org/x/tools v0.1.11
3535
gomodules.xyz/jsonpatch/v3 v3.0.1
3636
helm.sh/helm/v3 v3.9.0
37-
k8s.io/api v0.24.1
38-
k8s.io/apiextensions-apiserver v0.24.1
39-
k8s.io/apimachinery v0.24.1
37+
k8s.io/api v0.24.2
38+
k8s.io/apiextensions-apiserver v0.24.2
39+
k8s.io/apimachinery v0.24.2
4040
k8s.io/cli-runtime v0.24.1
41-
k8s.io/client-go v0.24.1
41+
k8s.io/client-go v0.24.2
4242
k8s.io/kubectl v0.24.1
4343
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9
44-
sigs.k8s.io/controller-runtime v0.12.1
45-
sigs.k8s.io/controller-tools v0.9.0
46-
sigs.k8s.io/kubebuilder/v3 v3.5.0
44+
sigs.k8s.io/controller-runtime v0.12.2
45+
sigs.k8s.io/controller-tools v0.9.2
46+
sigs.k8s.io/kubebuilder/v3 v3.6.0
4747
sigs.k8s.io/yaml v1.3.0
4848
)
4949

@@ -241,8 +241,8 @@ require (
241241
gopkg.in/warnings.v0 v0.1.2 // indirect
242242
gopkg.in/yaml.v2 v2.4.0 // indirect
243243
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
244-
k8s.io/apiserver v0.24.1 // indirect
245-
k8s.io/component-base v0.24.1 // indirect
244+
k8s.io/apiserver v0.24.2 // indirect
245+
k8s.io/component-base v0.24.2 // indirect
246246
k8s.io/klog/v2 v2.60.1 // indirect
247247
k8s.io/kube-openapi v0.0.0-20220328201542-3ee0da9b0b42 // indirect
248248
oras.land/oras-go v1.1.0 // indirect

go.sum

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1752,22 +1752,27 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
17521752
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
17531753
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
17541754
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
1755-
k8s.io/api v0.24.1 h1:BjCMRDcyEYz03joa3K1+rbshwh1Ay6oB53+iUx2H8UY=
17561755
k8s.io/api v0.24.1/go.mod h1:JhoOvNiLXKTPQ60zh2g0ewpA+bnEYf5q44Flhquh4vQ=
1757-
k8s.io/apiextensions-apiserver v0.24.1 h1:5yBh9+ueTq/kfnHQZa0MAo6uNcPrtxPMpNQgorBaKS0=
1758-
k8s.io/apiextensions-apiserver v0.24.1/go.mod h1:A6MHfaLDGfjOc/We2nM7uewD5Oa/FnEbZ6cD7g2ca4Q=
1759-
k8s.io/apimachinery v0.24.1 h1:ShD4aDxTQKN5zNf8K1RQ2u98ELLdIW7jEnlO9uAMX/I=
1756+
k8s.io/api v0.24.2 h1:g518dPU/L7VRLxWfcadQn2OnsiGWVOadTLpdnqgY2OI=
1757+
k8s.io/api v0.24.2/go.mod h1:AHqbSkTm6YrQ0ObxjO3Pmp/ubFF/KuM7jU+3khoBsOg=
1758+
k8s.io/apiextensions-apiserver v0.24.2 h1:/4NEQHKlEz1MlaK/wHT5KMKC9UKYz6NZz6JE6ov4G6k=
1759+
k8s.io/apiextensions-apiserver v0.24.2/go.mod h1:e5t2GMFVngUEHUd0wuCJzw8YDwZoqZfJiGOW6mm2hLQ=
17601760
k8s.io/apimachinery v0.24.1/go.mod h1:82Bi4sCzVBdpYjyI4jY6aHX+YCUchUIrZrXKedjd2UM=
1761-
k8s.io/apiserver v0.24.1 h1:LAA5UpPOeaREEtFAQRUQOI3eE5So/j5J3zeQJjeLdz4=
1762-
k8s.io/apiserver v0.24.1/go.mod h1:dQWNMx15S8NqJMp0gpYfssyvhYnkilc1LpExd/dkLh0=
1761+
k8s.io/apimachinery v0.24.2 h1:5QlH9SL2C8KMcrNJPor+LbXVTaZRReml7svPEh4OKDM=
1762+
k8s.io/apimachinery v0.24.2/go.mod h1:82Bi4sCzVBdpYjyI4jY6aHX+YCUchUIrZrXKedjd2UM=
1763+
k8s.io/apiserver v0.24.2 h1:orxipm5elPJSkkFNlwH9ClqaKEDJJA3yR2cAAlCnyj4=
1764+
k8s.io/apiserver v0.24.2/go.mod h1:pSuKzr3zV+L+MWqsEo0kHHYwCo77AT5qXbFXP2jbvFI=
17631765
k8s.io/cli-runtime v0.24.1 h1:IW6L8dRBq+pPTzvXcB+m/hOabzbqXy57Bqo4XxmW7DY=
17641766
k8s.io/cli-runtime v0.24.1/go.mod h1:14aVvCTqkA7dNXY51N/6hRY3GUjchyWDOwW84qmR3bs=
1765-
k8s.io/client-go v0.24.1 h1:w1hNdI9PFrzu3OlovVeTnf4oHDt+FJLd9Ndluvnb42E=
17661767
k8s.io/client-go v0.24.1/go.mod h1:f1kIDqcEYmwXS/vTbbhopMUbhKp2JhOeVTfxgaCIlF8=
1768+
k8s.io/client-go v0.24.2 h1:CoXFSf8if+bLEbinDqN9ePIDGzcLtqhfd6jpfnwGOFA=
1769+
k8s.io/client-go v0.24.2/go.mod h1:zg4Xaoo+umDsfCWr4fCnmLEtQXyCNXCvJuSsglNcV30=
17671770
k8s.io/code-generator v0.19.7/go.mod h1:lwEq3YnLYb/7uVXLorOJfxg+cUu2oihFhHZ0n9NIla0=
17681771
k8s.io/code-generator v0.24.1/go.mod h1:dpVhs00hTuTdTY6jvVxvTFCk6gSMrtfRydbhZwHI15w=
1769-
k8s.io/component-base v0.24.1 h1:APv6W/YmfOWZfo+XJ1mZwep/f7g7Tpwvdbo9CQLDuts=
1772+
k8s.io/code-generator v0.24.2/go.mod h1:dpVhs00hTuTdTY6jvVxvTFCk6gSMrtfRydbhZwHI15w=
17701773
k8s.io/component-base v0.24.1/go.mod h1:DW5vQGYVCog8WYpNob3PMmmsY8A3L9QZNg4j/dV3s38=
1774+
k8s.io/component-base v0.24.2 h1:kwpQdoSfbcH+8MPN4tALtajLDfSfYxBDYlXobNWI6OU=
1775+
k8s.io/component-base v0.24.2/go.mod h1:ucHwW76dajvQ9B7+zecZAP3BVqvrHoOxm8olHEg0nmM=
17711776
k8s.io/component-helpers v0.24.1/go.mod h1:q5Z1pWV/QfX9ThuNeywxasiwkLw9KsR4Q9TAOdb/Y3s=
17721777
k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
17731778
k8s.io/gengo v0.0.0-20200428234225-8167cfdcfc14/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
@@ -1796,14 +1801,14 @@ rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
17961801
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
17971802
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.30 h1:dUk62HQ3ZFhD48Qr8MIXCiKA8wInBQCtuE4QGfFW7yA=
17981803
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.30/go.mod h1:fEO7lRTdivWO2qYVCVG7dEADOMo/MLDCVr8So2g88Uw=
1799-
sigs.k8s.io/controller-runtime v0.12.1 h1:4BJY01xe9zKQti8oRjj/NeHKRXthf1YkYJAgLONFFoI=
1800-
sigs.k8s.io/controller-runtime v0.12.1/go.mod h1:BKhxlA4l7FPK4AQcsuL4X6vZeWnKDXez/vp1Y8dxTU0=
1801-
sigs.k8s.io/controller-tools v0.9.0 h1:b/vSEPpA8hiMiyzDfLbZdCn3hoAcy3/868OHhYtHY9w=
1802-
sigs.k8s.io/controller-tools v0.9.0/go.mod h1:NUkn8FTV3Sad3wWpSK7dt/145qfuQ8CKJV6j4jHC5rM=
1804+
sigs.k8s.io/controller-runtime v0.12.2 h1:nqV02cvhbAj7tbt21bpPpTByrXGn2INHRsi39lXy9sE=
1805+
sigs.k8s.io/controller-runtime v0.12.2/go.mod h1:qKsk4WE6zW2Hfj0G4v10EnNB2jMG1C+NTb8h+DwCoU0=
1806+
sigs.k8s.io/controller-tools v0.9.2 h1:AkTE3QAdz9LS4iD3EJvHyYxBkg/g9fTbgiYsrcsFCcM=
1807+
sigs.k8s.io/controller-tools v0.9.2/go.mod h1:NUkn8FTV3Sad3wWpSK7dt/145qfuQ8CKJV6j4jHC5rM=
18031808
sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2 h1:kDi4JBNAsJWfz1aEXhO8Jg87JJaPNLh5tIzYHgStQ9Y=
18041809
sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2/go.mod h1:B+TnT182UBxE84DiCz4CVE26eOSDAeYCpfDnC2kdKMY=
1805-
sigs.k8s.io/kubebuilder/v3 v3.5.0 h1:LnLMp74vq4xAHTSDVO9KWhCq7ZgK5kYPNMT82gasBZY=
1806-
sigs.k8s.io/kubebuilder/v3 v3.5.0/go.mod h1:2o0wAP/Qi4vLA5tlmKOCTZdWUlkdewvkNi3o5Ko6eSw=
1810+
sigs.k8s.io/kubebuilder/v3 v3.6.0 h1:S0J4ST871SVG5oObPRfyJVjdoKbIUoQgTIUHDq/YtcQ=
1811+
sigs.k8s.io/kubebuilder/v3 v3.6.0/go.mod h1:+s6WdvJjIpYRKO+idaeIK5JhbjrZybxh9+K6jK9/Yyc=
18071812
sigs.k8s.io/kustomize/api v0.11.4 h1:/0Mr3kfBBNcNPOW5Qwk/3eb8zkswCwnqQxxKtmrTkRo=
18081813
sigs.k8s.io/kustomize/api v0.11.4/go.mod h1:k+8RsqYbgpkIrJ4p9jcdPqe8DprLxFUUO0yNOq8C+xI=
18091814
sigs.k8s.io/kustomize/cmd/config v0.10.6/go.mod h1:/S4A4nUANUa4bZJ/Edt7ZQTyKOY9WCER0uBS1SW2Rco=

hack/generate/samples/internal/go/generate.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,15 @@ package golang
1717
import (
1818
"path/filepath"
1919

20-
golangv2 "github.com/operator-framework/operator-sdk/hack/generate/samples/internal/go/v2"
21-
golangv3 "github.com/operator-framework/operator-sdk/hack/generate/samples/internal/go/v3"
20+
withwebhooks "github.com/operator-framework/operator-sdk/hack/generate/samples/internal/go/memcached-with-webhooks"
2221
)
2322

2423
func GenerateMemcachedSamples(binaryPath, rootPath string) {
25-
golangv2.GenerateMemcachedSample(binaryPath, filepath.Join(rootPath, "go", "v2"))
26-
golangv3.GenerateMemcachedSample(binaryPath, filepath.Join(rootPath, "go", "v3"))
24+
25+
// TODO: replace the Memcached implementation and update the tutorial
26+
// to use the deploy.image/v1-alpha plugin to do the scaffold instead
27+
// to create an empty scaffold add add all code. So that, we can also
28+
// ensure that the tutorial follows the good practices
29+
withwebhooks.GenerateSample(binaryPath, filepath.Join(rootPath, "go", "v3"))
30+
withwebhooks.GenerateSample(binaryPath, filepath.Join(rootPath, "go", "v4-alpha"))
2731
}
File renamed without changes.

0 commit comments

Comments
 (0)