@@ -5,121 +5,124 @@ weight: 998964000
5
5
6
6
## Upgrade K8s versions to use 1.29
7
7
8
- Regarding the upcoming major changes in the plugin, please note that ` go/v3 ` is being deprecated by Kubebuilder hence Operator SDK would also be migrating to ` go/v4 ` soon. Following are the changes to be addressed in your project structure, ` Makefile ` and ` go.mod ` files: 1) [ go/v4] Update your ` go.mod ` file to upgrade the dependencies and run ` go mod tidy ` to download them ```go
9
- k8s.io/api v0.29.2
10
- k8s.io/apimachinery v0.29.2
11
- k8s.io/client-go v0.29.2
12
- sigs.k8s.io/controller-runtime v0.17.3
13
- ``` 2) [go/v4, helm/v1] The projects are now scaffolded with 0.16.0 version of kube-rbac-proxy. Modify the version of kube-rbac-proxy in the following scaffolded files: - config/default/manager_auth_proxy_patch.yaml
14
- ```diff
15
- - gcr.io/kubebuilder/kube-rbac-proxy:v0.15.0
16
- + gcr.io/kubebuilder/kube-rbac-proxy:v0.16.0
17
- ```
8
+ Regarding the upcoming major changes in the plugin, please note that ` go/v3 ` is being deprecated by Kubebuilder hence Operator SDK would also be migrating to ` go/v4 ` soon. Following are the changes to be addressed in your project structure, ` Makefile ` and ` go.mod ` files:
9
+ 1 ) [ go/v4] Update your ` go.mod ` file to upgrade the dependencies and run ` go mod tidy ` to download them:
10
+ ``` go
11
+ k8s.io /api v0.29.2
12
+ k8s.io /apimachinery v0.29.2
13
+ k8s.io /client-go v0.29.2
14
+ sigs.k8s .io /controller-runtime v0.17.3
15
+ ```
16
+ 2 ) [ go/v4, helm/v1] The projects are now scaffolded with 0.16.0 version of kube-rbac-proxy. Modify the version of kube-rbac-proxy in the following scaffolded files: - config/default/manager_auth_proxy_patch.yaml
17
+ ``` diff
18
+ - gcr.io/kubebuilder/kube-rbac-proxy:v0.15.0
19
+ + gcr.io/kubebuilder/kube-rbac-proxy:v0.16.0
20
+ ```
18
21
3 ) [ go/v4] You can now generate a file that contains all the resources built with Kustomize, which are necessary to install this project without its dependencies. Update your Makefile by adding:
19
- ``` diff
20
- + .PHONY: build-installer
21
- + build-installer: manifests generate kustomize ## Generate a consolidated YAML with CRDs and deployment.
22
- + mkdir -p dist
23
- + cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
24
- + $(KUSTOMIZE) build config/default > dist/install.yaml
25
- ```
22
+ ``` diff
23
+ + .PHONY: build-installer
24
+ + build-installer: manifests generate kustomize ## Generate a consolidated YAML with CRDs and deployment.
25
+ + mkdir -p dist
26
+ + cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
27
+ + $(KUSTOMIZE) build config/default > dist/install.yaml
28
+ ```
26
29
4 ) [ go/v4] Update ENVTEST_K8S_VERSION in your Makefile:
27
- ``` diff
28
- - ENVTEST_K8S_VERSION = 1.28.3
29
- + ENVTEST_K8S_VERSION = 1.29.0
30
- ```
30
+ ``` diff
31
+ - ENVTEST_K8S_VERSION = 1.28.3
32
+ + ENVTEST_K8S_VERSION = 1.29.0
33
+ ```
31
34
5 ) [ go/v4] Remove the following section from your Makefile:
32
- ``` diff
33
- - GOLANGCI_LINT = $(shell pwd)/bin/golangci-lint
34
- - GOLANGCI_LINT_VERSION ?= v1.54.2
35
- - golangci-lint:
36
- - @[ -f $(GOLANGCI_LINT) ] || { \
37
- - set -e ;\
38
- - curl -sSfL https://github.com/raw/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell dirname $(GOLANGCI_LINT)) $(GOLANGCI_LINT_VERSION) ;\
39
- - }
40
- ```
35
+ ``` diff
36
+ - GOLANGCI_LINT = $(shell pwd)/bin/golangci-lint
37
+ - GOLANGCI_LINT_VERSION ?= v1.54.2
38
+ - golangci-lint:
39
+ - @[ -f $(GOLANGCI_LINT) ] || { \
40
+ - set -e ;\
41
+ - curl -sSfL https://github.com/raw/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell dirname $(GOLANGCI_LINT)) $(GOLANGCI_LINT_VERSION) ;\
42
+ - }
43
+ ```
41
44
6 ) [ go/v4] Update the following in your Makefile:
42
- ``` diff
43
- - ## Tool Binaries
44
- - KUBECTL ?= kubectl
45
- - KUSTOMIZE ?= $(LOCALBIN)/kustomize
46
- - CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
47
- - ENVTEST ?= $(LOCALBIN)/setup-envtest
48
- -
49
- - ## Tool Versions
50
- - KUSTOMIZE_VERSION ?= v5.2.1
51
- - CONTROLLER_TOOLS_VERSION ?= v0.13.0
52
- -
53
- - .PHONY: kustomize
54
- - kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary. If wrong version is installed, it will be removed before downloading.
55
- - $(KUSTOMIZE): $(LOCALBIN)
56
- - @if test -x $(LOCALBIN)/kustomize && ! $(LOCALBIN)/kustomize version | grep -q $(KUSTOMIZE_VERSION); then \
57
- - echo "$(LOCALBIN)/kustomize version is not expected $(KUSTOMIZE_VERSION). Removing it before installing."; \
58
- - rm -rf $(LOCALBIN)/kustomize; \
59
- - fi
60
- - test -s $(LOCALBIN)/kustomize || GOBIN=$(LOCALBIN) GO111MODULE=on go install sigs.k8s.io/kustomize/kustomize/v5@$(KUSTOMIZE_VERSION)
61
- -
62
- - .PHONY: controller-gen
63
- - controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary. If wrong version is installed, it will be overwritten.
64
- - $(CONTROLLER_GEN): $(LOCALBIN)
65
- - test -s $(LOCALBIN)/controller-gen && $(LOCALBIN)/controller-gen --version | grep -q $(CONTROLLER_TOOLS_VERSION) || \
66
- - GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION)
67
- -
68
- - .PHONY: envtest
69
- - envtest: $(ENVTEST) ## Download envtest-setup locally if necessary.
70
- - $(ENVTEST): $(LOCALBIN)
71
- - test -s $(LOCALBIN)/setup-envtest || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
72
- + ## Tool Binaries
73
- + KUBECTL ?= kubectl
74
- + KUSTOMIZE ?= $(LOCALBIN)/kustomize-$(KUSTOMIZE_VERSION)
75
- + CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen-$(CONTROLLER_TOOLS_VERSION)
76
- + ENVTEST ?= $(LOCALBIN)/setup-envtest-$(ENVTEST_VERSION)
77
- + GOLANGCI_LINT = $(LOCALBIN)/golangci-lint-$(GOLANGCI_LINT_VERSION)
78
- +
79
- + ## Tool Versions
80
- + KUSTOMIZE_VERSION ?= v5.3.0
81
- + CONTROLLER_TOOLS_VERSION ?= v0.14.0
82
- + ENVTEST_VERSION ?= release-0.17
83
- + GOLANGCI_LINT_VERSION ?= v1.57.2
84
- +
85
- + .PHONY: kustomize
86
- + kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
87
- + $(KUSTOMIZE): $(LOCALBIN)
88
- + $(call go-install-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/v5,$(KUSTOMIZE_VERSION))
89
- +
90
- + .PHONY: controller-gen
91
- + controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary.
92
- + $(CONTROLLER_GEN): $(LOCALBIN)
93
- + $(call go-install-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen,$(CONTROLLER_TOOLS_VERSION))
94
- +
95
- + .PHONY: envtest
96
- + envtest: $(ENVTEST) ## Download setup-envtest locally if necessary.
97
- + $(ENVTEST): $(LOCALBIN)
98
- + $(call go-install-tool,$(ENVTEST),sigs.k8s.io/controller-runtime/tools/setup-envtest,$(ENVTEST_VERSION))
99
- +
100
- + .PHONY: golangci-lint
101
- + golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
102
- + $(GOLANGCI_LINT): $(LOCALBIN)
103
- + $(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/golangci-lint,${GOLANGCI_LINT_VERSION})
104
- +
105
- + # go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
106
- + # $1 - target path with name of binary (ideally with version)
107
- + # $2 - package url which can be installed
108
- + # $3 - specific version of package
109
- + define go-install-tool
110
- + @[ -f $(1) ] || { \
111
- + set -e; \
112
- + package=$(2)@$(3) ;\
113
- + echo "Downloading $${package}" ;\
114
- + GOBIN=$(LOCALBIN) go install $${package} ;\
115
- + mv "$$(echo "$(1)" | sed "s/-$(3)$$//")" $(1) ;\
116
- + }
117
- + endef
118
- ```
45
+ ``` diff
46
+ - ## Tool Binaries
47
+ - KUBECTL ?= kubectl
48
+ - KUSTOMIZE ?= $(LOCALBIN)/kustomize
49
+ - CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
50
+ - ENVTEST ?= $(LOCALBIN)/setup-envtest
51
+ -
52
+ - ## Tool Versions
53
+ - KUSTOMIZE_VERSION ?= v5.2.1
54
+ - CONTROLLER_TOOLS_VERSION ?= v0.13.0
55
+ -
56
+ - .PHONY: kustomize
57
+ - kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary. If wrong version is installed, it will be removed before downloading.
58
+ - $(KUSTOMIZE): $(LOCALBIN)
59
+ - @if test -x $(LOCALBIN)/kustomize && ! $(LOCALBIN)/kustomize version | grep -q $(KUSTOMIZE_VERSION); then \
60
+ - echo "$(LOCALBIN)/kustomize version is not expected $(KUSTOMIZE_VERSION). Removing it before installing."; \
61
+ - rm -rf $(LOCALBIN)/kustomize; \
62
+ - fi
63
+ - test -s $(LOCALBIN)/kustomize || GOBIN=$(LOCALBIN) GO111MODULE=on go install sigs.k8s.io/kustomize/kustomize/v5@$(KUSTOMIZE_VERSION)
64
+ -
65
+ - .PHONY: controller-gen
66
+ - controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary. If wrong version is installed, it will be overwritten.
67
+ - $(CONTROLLER_GEN): $(LOCALBIN)
68
+ - test -s $(LOCALBIN)/controller-gen && $(LOCALBIN)/controller-gen --version | grep -q $(CONTROLLER_TOOLS_VERSION) || \
69
+ - GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION)
70
+ -
71
+ - .PHONY: envtest
72
+ - envtest: $(ENVTEST) ## Download envtest-setup locally if necessary.
73
+ - $(ENVTEST): $(LOCALBIN)
74
+ - test -s $(LOCALBIN)/setup-envtest || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
75
+ + ## Tool Binaries
76
+ + KUBECTL ?= kubectl
77
+ + KUSTOMIZE ?= $(LOCALBIN)/kustomize-$(KUSTOMIZE_VERSION)
78
+ + CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen-$(CONTROLLER_TOOLS_VERSION)
79
+ + ENVTEST ?= $(LOCALBIN)/setup-envtest-$(ENVTEST_VERSION)
80
+ + GOLANGCI_LINT = $(LOCALBIN)/golangci-lint-$(GOLANGCI_LINT_VERSION)
81
+ +
82
+ + ## Tool Versions
83
+ + KUSTOMIZE_VERSION ?= v5.3.0
84
+ + CONTROLLER_TOOLS_VERSION ?= v0.14.0
85
+ + ENVTEST_VERSION ?= release-0.17
86
+ + GOLANGCI_LINT_VERSION ?= v1.57.2
87
+ +
88
+ + .PHONY: kustomize
89
+ + kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
90
+ + $(KUSTOMIZE): $(LOCALBIN)
91
+ + $(call go-install-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/v5,$(KUSTOMIZE_VERSION))
92
+ +
93
+ + .PHONY: controller-gen
94
+ + controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary.
95
+ + $(CONTROLLER_GEN): $(LOCALBIN)
96
+ + $(call go-install-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen,$(CONTROLLER_TOOLS_VERSION))
97
+ +
98
+ + .PHONY: envtest
99
+ + envtest: $(ENVTEST) ## Download setup-envtest locally if necessary.
100
+ + $(ENVTEST): $(LOCALBIN)
101
+ + $(call go-install-tool,$(ENVTEST),sigs.k8s.io/controller-runtime/tools/setup-envtest,$(ENVTEST_VERSION))
102
+ +
103
+ + .PHONY: golangci-lint
104
+ + golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
105
+ + $(GOLANGCI_LINT): $(LOCALBIN)
106
+ + $(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/golangci-lint,${GOLANGCI_LINT_VERSION})
107
+ +
108
+ + # go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
109
+ + # $1 - target path with name of binary (ideally with version)
110
+ + # $2 - package url which can be installed
111
+ + # $3 - specific version of package
112
+ + define go-install-tool
113
+ + @[ -f $(1) ] || { \
114
+ + set -e; \
115
+ + package=$(2)@$(3) ;\
116
+ + echo "Downloading $${package}" ;\
117
+ + GOBIN=$(LOCALBIN) go install $${package} ;\
118
+ + mv "$$(echo "$(1)" | sed "s/-$(3)$$//")" $(1) ;\
119
+ + }
120
+ + endef
121
+ ```
119
122
7 ) [ helm/v1] Update the kustomize version in your Makefile:
120
- ``` diff
121
- - curl -sSLo - https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v5.2.1/kustomize_v5.2.1_$(OS)_$(ARCH).tar.gz | \
122
- + curl -sSLo - https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v5.3.0/kustomize_v5.3.0_$(OS)_$(ARCH).tar.gz | \
123
- ```
123
+ ``` diff
124
+ - curl -sSLo - https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v5.2.1/kustomize_v5.2.1_$(OS)_$(ARCH).tar.gz | \
125
+ + curl -sSLo - https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v5.3.0/kustomize_v5.3.0_$(OS)_$(ARCH).tar.gz | \
126
+ ```
124
127
125
128
_ See [ #6736 ] ( https://github.com/operator-framework/operator-sdk/pull/6736 ) for more details._
0 commit comments