Skip to content

Commit 6b9a814

Browse files
bump kubebuilder commit in Operator SDK (#5130)
Signed-off-by: varshaprasad96 <[email protected]> Co-authored-by: varshaprasad96 <[email protected]>
1 parent ca54e14 commit 6b9a814

22 files changed

+108
-19
lines changed

changelog/fragments/bump-kb.yaml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
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) Fixed a bug in `make test` caused by incorrect envtest asset setup.
6+
7+
kind: "change"
8+
9+
# Is this a breaking change?
10+
breaking: false
11+
12+
migration:
13+
header: (go/v3) Export `KUBEBUILDER_ASSETS` in `Makefile`
14+
body: >
15+
In `go/v3` projects, after installing `setup-envtest` binary, the path to
16+
`KUBEBUILDER_ASSETS` needs to be exported. In `Makefile`, add the following:
17+
18+
```diff
19+
+# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
20+
+ENVTEST_K8S_VERSION = 1.21
21+
22+
test: manifests generate fmt vet envtest ## Run tests.
23+
- go test ./... -coverprofile cover.out
24+
+ KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test ./... -coverprofile cover.out
25+
```
26+
- description: >
27+
(go/v3, ansible/v1, helm/v1) Added `containerPort` protocol field required for server-side apply in manifests.
28+
29+
kind: "addition"
30+
31+
# Is this a breaking change?
32+
breaking: false
33+
34+
migration:
35+
header: (go/v3, ansible/v1, helm/v1) Add `containerPort` protocol field in manifests.
36+
body: >
37+
In `go/v3`, `ansible/v1`, `helm/v1` projects, specify the `containerPort` protocol in the following files:
38+
- `config/default/manager_auth_proxy_patch.yaml`
39+
- `config/rbac/auth_proxy_service.yaml`
40+
41+
```diff
42+
ports:
43+
- containerPort: 8443
44+
+ protocol: TCP
45+
name: https
46+
```
47+
48+
Additionally, in `go/v3` projects, add the `containerPort` protocol to `config/webhook/service.yaml`:
49+
50+
```diff
51+
ports:
52+
- port: 443
53+
+ protocol: TCP
54+
targetPort: 9443
55+
```
56+
57+
- description: >
58+
(go/v3, ansible/v1, helm/v1) Increased resource limits for controller manager.
59+
60+
kind: "change"
61+
62+
# Is this a breaking change?
63+
breaking: false
64+
65+
migration:
66+
header: (go/v3, ansible/v1, helm/v1) Increase resource limits for controller manager.
67+
body: >
68+
In `go/v3`, `ansible/v1`, `helm/v1` projects, increase the `cpu` and `memory` resource limits to `200m` and
69+
`100Mi` respectively in `config/manager/manager.yaml`.
70+
71+
```diff
72+
resources:
73+
limits:
74+
- cpu: 100m
75+
- memory: 30Mi
76+
+ cpu: 200m
77+
+ memory: 100Mi
78+
```

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ require (
3939
k8s.io/kubectl v0.21.0
4040
sigs.k8s.io/controller-runtime v0.9.2
4141
sigs.k8s.io/controller-tools v0.6.0
42-
sigs.k8s.io/kubebuilder/v3 v3.0.0-alpha.0.0.20210707171043-359e8aa70c2b
42+
sigs.k8s.io/kubebuilder/v3 v3.0.0-alpha.0.0.20210803185103-51e4a9aa5055
4343
sigs.k8s.io/yaml v1.2.0
4444
)
4545

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1623,8 +1623,8 @@ sigs.k8s.io/controller-tools v0.6.0 h1:o2Fm1K7CmIp8OVaBtXsWB/ssBAzyoKZPPAGR3Vuxa
16231623
sigs.k8s.io/controller-tools v0.6.0/go.mod h1:baRMVPrctU77F+rfAuH2uPqW93k6yQnZA2dhUOr7ihc=
16241624
sigs.k8s.io/kind v0.10.0/go.mod h1:fb32zUw7ewC47bPwLnwhf47wd/vADtv3c38KP7sjIlo=
16251625
sigs.k8s.io/kubebuilder/v3 v3.0.0-alpha.0.0.20210702145813-742983631190/go.mod h1:pUhjQx9f/+cn1OtSa5zMohY1lgk9s/9Mbcvwj82lrNk=
1626-
sigs.k8s.io/kubebuilder/v3 v3.0.0-alpha.0.0.20210707171043-359e8aa70c2b h1:fGbw9og/lq/fNi4afnVwSinfaQXkonlbTar9nG95u44=
1627-
sigs.k8s.io/kubebuilder/v3 v3.0.0-alpha.0.0.20210707171043-359e8aa70c2b/go.mod h1:pUhjQx9f/+cn1OtSa5zMohY1lgk9s/9Mbcvwj82lrNk=
1626+
sigs.k8s.io/kubebuilder/v3 v3.0.0-alpha.0.0.20210803185103-51e4a9aa5055 h1:3f5m0xp0DEsg+Sdrt1Rld8TCEFOH5GKsoYrEpdOzA+s=
1627+
sigs.k8s.io/kubebuilder/v3 v3.0.0-alpha.0.0.20210803185103-51e4a9aa5055/go.mod h1:pUhjQx9f/+cn1OtSa5zMohY1lgk9s/9Mbcvwj82lrNk=
16281628
sigs.k8s.io/kustomize v2.0.3+incompatible h1:JUufWFNlI44MdtnjUqVnvh29rR37PQFzPbLXqhyOyX0=
16291629
sigs.k8s.io/kustomize v2.0.3+incompatible/go.mod h1:MkjgH3RdOWrievjo6c9T245dYlB5QeXV4WCbnt/PEpU=
16301630
sigs.k8s.io/kustomize/api v0.8.5 h1:bfCXGXDAbFbb/Jv5AhMj2BB8a5VAJuuQ5/KU69WtDjQ=

internal/plugins/ansible/v1/init.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ func addInitCustomizations(projectName string) error {
177177
// todo: remove it when we solve the issue operator-framework/operator-sdk#3573
178178
const resourcesLimitsFragment = ` resources:
179179
limits:
180-
cpu: 100m
181-
memory: 30Mi
180+
cpu: 200m
181+
memory: 100Mi
182182
requests:
183183
cpu: 100m
184184
memory: 20Mi

internal/plugins/helm/v1/init.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,6 @@ func addInitCustomizations(projectName string) error {
199199
}
200200

201201
// Increase the default memory required.
202-
err = sdkutil.ReplaceInFile(managerFile, "memory: 30Mi", "memory: 90Mi")
203-
if err != nil {
204-
return err
205-
}
206202
err = sdkutil.ReplaceInFile(managerFile, "memory: 20Mi", "memory: 60Mi")
207203
if err != nil {
208204
return err

testdata/ansible/memcached-operator/bundle/manifests/memcached-operator-controller-manager-metrics-service_v1_service.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ spec:
99
ports:
1010
- name: https
1111
port: 8443
12+
protocol: TCP
1213
targetPort: https
1314
selector:
1415
control-plane: controller-manager

testdata/ansible/memcached-operator/bundle/manifests/memcached-operator.clusterserviceversion.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ spec:
115115
ports:
116116
- containerPort: 8443
117117
name: https
118+
protocol: TCP
118119
resources: {}
119120
- args:
120121
- --health-probe-bind-address=:6789

testdata/ansible/memcached-operator/config/default/manager_auth_proxy_patch.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ spec:
1818
- "--v=10"
1919
ports:
2020
- containerPort: 8443
21+
protocol: TCP
2122
name: https
2223
- name: manager
2324
args:

testdata/ansible/memcached-operator/config/rbac/auth_proxy_service.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ spec:
99
ports:
1010
- name: https
1111
port: 8443
12+
protocol: TCP
1213
targetPort: https
1314
selector:
1415
control-plane: controller-manager

testdata/go/v3/memcached-operator/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ BUNDLE_IMG ?= $(IMAGE_TAG_BASE)-bundle:v$(VERSION)
3939
IMG ?= controller:latest
4040
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
4141
CRD_OPTIONS ?= "crd:trivialVersions=true,preserveUnknownFields=false"
42+
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
43+
ENVTEST_K8S_VERSION = 1.21
4244

4345
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
4446
ifeq (,$(shell go env GOBIN))
@@ -86,7 +88,7 @@ vet: ## Run go vet against code.
8688
go vet ./...
8789

8890
test: manifests generate fmt vet envtest ## Run tests.
89-
go test ./... -coverprofile cover.out
91+
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test ./... -coverprofile cover.out
9092

9193
##@ Build
9294

@@ -129,7 +131,6 @@ kustomize: ## Download kustomize locally if necessary.
129131
ENVTEST = $(shell pwd)/bin/setup-envtest
130132
envtest: ## Download envtest-setup locally if necessary.
131133
$(call go-get-tool,$(ENVTEST),sigs.k8s.io/controller-runtime/tools/setup-envtest@latest)
132-
$(ENVTEST) use 1.21
133134

134135
# go-get-tool will 'go get' any package $2 and install it to $1.
135136
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))

0 commit comments

Comments
 (0)