Skip to content

Commit 2d0aae8

Browse files
✨ Upgrade kubebuilder from 3.3.0 to 3.4.1 (#5735)
Signed-off-by: Camila Macedo <[email protected]>
1 parent cc7e087 commit 2d0aae8

File tree

22 files changed

+407
-123
lines changed

22 files changed

+407
-123
lines changed

changelog/fragments/bump-kb.yaml

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
# entries is a list of entries to include in
2+
# release notes and/or the migration guide
3+
entries:
4+
- description: >
5+
(go/v3): For Golang-based operators, fix suite test using global cfg ([More info](https://github.com/kubernetes-sigs/kubebuilder/pull/2602))
6+
kind: "bugfix"
7+
breaking: false
8+
migration:
9+
header: (go/v3):For golang-language based operators, fis suite test using global cfg
10+
body: |
11+
In the suite test files, replace `cfg, err := testEnv.Start()` with:
12+
13+
```go
14+
var err error
15+
// cfg is defined in this file globally.
16+
cfg, err = testEnv.Start()
17+
```
18+
19+
Note: You can find suite test files scaffold for the APIs created for your project
20+
such as `api/webhook_suitetest.go` directory as for your controllers in `controllers/suite_test.go`.
21+
- description: >
22+
(go/v3): For Golang-based operators, ensure that the plugin can only be used with its go supported version >= 1.17 (IMPORTANT:
23+
Golang projects still not supporting versions >= 1.18. To know more about what needs to be done
24+
in order to support Golang 1.18, see [here](https://github.com/kubernetes-sigs/kubebuilder/issues/2559) )
25+
kind: "bugfix"
26+
breaking: false
27+
- description: >
28+
(kustomize/v1): For Golang-based operators, fix the issue to scaffold the same Kind for different groups with
29+
multi-group support by using group name in crd/patches and rbac editor/viewer manifests ([More info](https://github.com/kubernetes-sigs/kubebuilder/pull/2500))
30+
kind: "bugfix"
31+
breaking: false
32+
- description: >
33+
(kustomize/v1): For Golang-based operators, fix the issue to scaffold the same Kind for different groups with
34+
multi-group support by using group name in crd/patches and rbac editor/viewer manifests ([More info](https://github.com/kubernetes-sigs/kubebuilder/pull/2500))
35+
kind: "bugfix"
36+
breaking: false
37+
- description: >
38+
(go/v3): For Golang-based operators, avoid adding duplicated code fragments ([More info](https://github.com/kubernetes-sigs/kubebuilder/pull/2619))
39+
kind: "bugfix"
40+
breaking: false
41+
- description: >
42+
(declarative/v1): For Golang-based operators, copy the channels directory in the Dockerfile ([More info](https://github.com/kubernetes-sigs/kubebuilder/pull/2507/files))
43+
kind: "addition"
44+
breaking: false
45+
migration:
46+
header: For Golang-based operators, update Dockerfile if you are using the [declarative/v1 plugin](https://book.kubebuilder.io/plugins/declarative-v1.html)
47+
body: |
48+
If you are using the declarative/v1 plugin for your scaffolds, then following the steps to update the Dockerfile.
49+
a) After `COPY controllers/ controllers/` add:
50+
51+
```sh
52+
# https://github.com/kubernetes-sigs/kubebuilder-declarative-pattern/blob/master/docs/addon/walkthrough/README.md#adding-a-manifest
53+
# Stage channels and make readable
54+
COPY channels/ /channels/
55+
RUN chmod -R a+rx /channels/
56+
```
57+
58+
b) After the `COPY --from=builder /workspace/manager .`" add:
59+
60+
```sh
61+
# copy channels
62+
COPY --from=builder /channels /channels
63+
```
64+
- description: >
65+
(go/v3):For Golang-based operators, upgrade controller-runtime and Kubernetes deps
66+
kind: "change"
67+
breaking: false
68+
migration:
69+
header: (go/v3):For Golang-based operators, upgrade controller-runtime from v0.11.0 to v0.11.2 and Kubernetes deps from 1.23.0 to 1.23.5
70+
body: |
71+
Update your go.mod by replacing `sigs.k8s.io/controller-runtime v0.11.0` with `sigs.k8s.io/controller-runtime v0.11.2` and run `go mod tidy`
72+
to update the K8s dependencies.
73+
- description: >
74+
(kustomize/v1):For Golang/Helm/Ansible-based operators, upgrade kube-rbac-proxy image from v0.8.0 to v0.11.0
75+
kind: "change"
76+
breaking: false
77+
migration:
78+
header: For Golang/Helm/Ansible-based operators, upgrade kube-rbac-proxy image from v0.8.0 to v0.11.0. (For further information see the kube-rbac-proxy [release notes](https://github.com/brancz/kube-rbac-proxy/releases))
79+
body: |
80+
Update the tag version used for the image `gcr.io/kubebuilder/kube-rbac-proxy` in the file config/default/manager_auth_proxy_patch.yaml.
81+
Replace `gcr.io/kubebuilder/kube-rbac-proxy:v0.8.0` with `gcr.io/kubebuilder/kube-rbac-proxy:v0.11.0`
82+
- description: >
83+
(go/v3):For Golang-based operators, new README.md will begin to be scaffolded
84+
kind: "addition"
85+
breaking: false
86+
- description: >
87+
(config-gen alpha command): Updated the image `gcr.io/kubebuilder/kube-rbac-proxy` from v0.5.0 to v0.11.0
88+
kind: "change"
89+
breaking: false
90+
- description: >
91+
(config-gen alpha command): upgrade sigs.k8s.io/controller-tools from v0.7.0 to v0.8.0
92+
kind: "change"
93+
breaking: false
94+
- description: >
95+
For Golang-based operators, change Makefile targets to replace go get with go install in order to remove deprecation
96+
and begin to be prepared to support go 1.18 in the future releases (IMPORTANT:
97+
Golang projects still not supporting versions >= 1.18. To know more about what needs to be done
98+
in order to support Golang 1.18, see [here](https://github.com/kubernetes-sigs/kubebuilder/issues/2559) )
99+
kind: "change"
100+
breaking: false
101+
migration:
102+
header: For Golang-based operators, change Makefile targets to replace go get with go install
103+
body: |
104+
The targets kustomize, controller-gen and envtest were changed. Update the Makefile replacing:
105+
106+
```sh
107+
CONTROLLER_GEN = $(shell pwd)/bin/controller-gen
108+
.PHONY: controller-gen
109+
controller-gen: ## Download controller-gen locally if necessary.
110+
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/[email protected])
111+
112+
KUSTOMIZE = $(shell pwd)/bin/kustomize
113+
.PHONY: kustomize
114+
kustomize: ## Download kustomize locally if necessary.
115+
$(call go-get-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/[email protected])
116+
117+
ENVTEST = $(shell pwd)/bin/setup-envtest
118+
.PHONY: envtest
119+
envtest: ## Download envtest-setup locally if necessary.
120+
$(call go-get-tool,$(ENVTEST),sigs.k8s.io/controller-runtime/tools/setup-envtest@latest)
121+
122+
# go-get-tool will 'go get' any package $2 and install it to $1.
123+
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
124+
define go-get-tool
125+
@[ -f $(1) ] || { \
126+
set -e ;\
127+
TMP_DIR=$$(mktemp -d) ;\
128+
cd $$TMP_DIR ;\
129+
go mod init tmp ;\
130+
echo "Downloading $(2)" ;\
131+
GOBIN=$(PROJECT_DIR)/bin go get $(2) ;\
132+
rm -rf $$TMP_DIR ;\
133+
}
134+
endef
135+
```
136+
137+
With:
138+
139+
```sh
140+
##@ Build Dependencies
141+
142+
## Location to install dependencies to
143+
LOCALBIN ?= $(shell pwd)/bin
144+
$(LOCALBIN):
145+
mkdir -p $(LOCALBIN)
146+
147+
## Tool Binaries
148+
KUSTOMIZE ?= $(LOCALBIN)/kustomize
149+
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
150+
ENVTEST ?= $(LOCALBIN)/setup-envtest
151+
152+
## Tool Versions
153+
KUSTOMIZE_VERSION ?= v3.8.7
154+
CONTROLLER_TOOLS_VERSION ?= v0.8.0
155+
156+
KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
157+
.PHONY: kustomize
158+
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
159+
$(KUSTOMIZE): $(LOCALBIN)
160+
curl -s $(KUSTOMIZE_INSTALL_SCRIPT) | bash -s -- $(subst v,,$(KUSTOMIZE_VERSION)) $(LOCALBIN)
161+
162+
.PHONY: controller-gen
163+
controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary.
164+
$(CONTROLLER_GEN): $(LOCALBIN)
165+
GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION)
166+
167+
.PHONY: envtest
168+
envtest: $(ENVTEST) ## Download envtest-setup locally if necessary.
169+
$(ENVTEST): $(LOCALBIN)
170+
GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
171+
```

go.mod

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ require (
3333
golang.org/x/tools v0.1.10
3434
gomodules.xyz/jsonpatch/v3 v3.0.1
3535
helm.sh/helm/v3 v3.6.2
36-
k8s.io/api v0.23.1
37-
k8s.io/apiextensions-apiserver v0.23.1
38-
k8s.io/apimachinery v0.23.1
36+
k8s.io/api v0.23.5
37+
k8s.io/apiextensions-apiserver v0.23.5
38+
k8s.io/apimachinery v0.23.5
3939
k8s.io/cli-runtime v0.23.1
40-
k8s.io/client-go v0.23.1
40+
k8s.io/client-go v0.23.5
4141
k8s.io/kubectl v0.23.1
42-
sigs.k8s.io/controller-runtime v0.11.0
42+
sigs.k8s.io/controller-runtime v0.11.2
4343
sigs.k8s.io/controller-tools v0.8.0
44-
sigs.k8s.io/kubebuilder/v3 v3.3.0
44+
sigs.k8s.io/kubebuilder/v3 v3.4.1
4545
sigs.k8s.io/yaml v1.3.0
4646
)
4747

@@ -230,16 +230,16 @@ require (
230230
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
231231
gopkg.in/yaml.v2 v2.4.0 // indirect
232232
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
233-
k8s.io/apiserver v0.23.1 // indirect
234-
k8s.io/component-base v0.23.1 // indirect
233+
k8s.io/apiserver v0.23.5 // indirect
234+
k8s.io/component-base v0.23.5 // indirect
235235
k8s.io/klog/v2 v2.30.0 // indirect
236236
k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65 // indirect
237-
k8s.io/utils v0.0.0-20210930125809-cb0fa318a74b // indirect
238-
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.25 // indirect
237+
k8s.io/utils v0.0.0-20211116205334-6203023598ed // indirect
238+
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.30 // indirect
239239
sigs.k8s.io/json v0.0.0-20211020170558-c049b76a60c6 // indirect
240-
sigs.k8s.io/kustomize/api v0.10.1 // indirect
241-
sigs.k8s.io/kustomize/kyaml v0.13.0 // indirect
242-
sigs.k8s.io/structured-merge-diff/v4 v4.2.0 // indirect
240+
sigs.k8s.io/kustomize/api v0.11.4 // indirect
241+
sigs.k8s.io/kustomize/kyaml v0.13.6 // indirect
242+
sigs.k8s.io/structured-merge-diff/v4 v4.2.1 // indirect
243243
)
244244

245245
replace (

0 commit comments

Comments
 (0)