From 0cd68bcba296d706ae13e3342c191a2855c17d77 Mon Sep 17 00:00:00 2001 From: varshaprasad96 Date: Wed, 4 Aug 2021 10:28:52 -0700 Subject: [PATCH] bump kubebuilder commit in Operator SDK Signed-off-by: varshaprasad96 --- changelog/fragments/bump-kb.yaml | 78 +++++++++++++++++++ go.mod | 2 +- go.sum | 4 +- internal/plugins/ansible/v1/init.go | 4 +- internal/plugins/helm/v1/init.go | 4 - ...er-manager-metrics-service_v1_service.yaml | 1 + ...cached-operator.clusterserviceversion.yaml | 1 + .../default/manager_auth_proxy_patch.yaml | 1 + .../config/rbac/auth_proxy_service.yaml | 1 + testdata/go/v3/memcached-operator/Makefile | 5 +- ...er-manager-metrics-service_v1_service.yaml | 1 + ...d-operator-webhook-service_v1_service.yaml | 1 + ...cached-operator.clusterserviceversion.yaml | 5 +- .../default/manager_auth_proxy_patch.yaml | 1 + .../config/manager/manager.yaml | 4 +- .../config/rbac/auth_proxy_service.yaml | 1 + .../config/webhook/service.yaml | 1 + ...er-manager-metrics-service_v1_service.yaml | 1 + ...cached-operator.clusterserviceversion.yaml | 5 +- .../default/manager_auth_proxy_patch.yaml | 1 + .../config/manager/manager.yaml | 4 +- .../config/rbac/auth_proxy_service.yaml | 1 + 22 files changed, 108 insertions(+), 19 deletions(-) create mode 100644 changelog/fragments/bump-kb.yaml diff --git a/changelog/fragments/bump-kb.yaml b/changelog/fragments/bump-kb.yaml new file mode 100644 index 00000000000..09f7edc2e9b --- /dev/null +++ b/changelog/fragments/bump-kb.yaml @@ -0,0 +1,78 @@ +# entries is a list of entries to include in +# release notes and/or the migration guide +entries: + - description: > + (go/v3) Fixed a bug in `make test` caused by incorrect envtest asset setup. + + kind: "change" + + # Is this a breaking change? + breaking: false + + migration: + header: (go/v3) Export `KUBEBUILDER_ASSETS` in `Makefile` + body: > + In `go/v3` projects, after installing `setup-envtest` binary, the path to + `KUBEBUILDER_ASSETS` needs to be exported. In `Makefile`, add the following: + + ```diff + +# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary. + +ENVTEST_K8S_VERSION = 1.21 + + test: manifests generate fmt vet envtest ## Run tests. + - go test ./... -coverprofile cover.out + + KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test ./... -coverprofile cover.out + ``` + - description: > + (go/v3, ansible/v1, helm/v1) Added `containerPort` protocol field required for server-side apply in manifests. + + kind: "addition" + + # Is this a breaking change? + breaking: false + + migration: + header: (go/v3, ansible/v1, helm/v1) Add `containerPort` protocol field in manifests. + body: > + In `go/v3`, `ansible/v1`, `helm/v1` projects, specify the `containerPort` protocol in the following files: + - `config/default/manager_auth_proxy_patch.yaml` + - `config/rbac/auth_proxy_service.yaml` + + ```diff + ports: + - containerPort: 8443 + + protocol: TCP + name: https + ``` + + Additionally, in `go/v3` projects, add the `containerPort` protocol to `config/webhook/service.yaml`: + + ```diff + ports: + - port: 443 + + protocol: TCP + targetPort: 9443 + ``` + + - description: > + (go/v3, ansible/v1, helm/v1) Increased resource limits for controller manager. + + kind: "change" + + # Is this a breaking change? + breaking: false + + migration: + header: (go/v3, ansible/v1, helm/v1) Increase resource limits for controller manager. + body: > + In `go/v3`, `ansible/v1`, `helm/v1` projects, increase the `cpu` and `memory` resource limits to `200m` and + `100Mi` respectively in `config/manager/manager.yaml`. + + ```diff + resources: + limits: + - cpu: 100m + - memory: 30Mi + + cpu: 200m + + memory: 100Mi + ``` diff --git a/go.mod b/go.mod index fafd3f49965..d9283927d00 100644 --- a/go.mod +++ b/go.mod @@ -39,7 +39,7 @@ require ( k8s.io/kubectl v0.21.0 sigs.k8s.io/controller-runtime v0.9.2 sigs.k8s.io/controller-tools v0.6.0 - sigs.k8s.io/kubebuilder/v3 v3.0.0-alpha.0.0.20210707171043-359e8aa70c2b + sigs.k8s.io/kubebuilder/v3 v3.0.0-alpha.0.0.20210803185103-51e4a9aa5055 sigs.k8s.io/yaml v1.2.0 ) diff --git a/go.sum b/go.sum index 5e52c8fc55d..2d4e8f24abb 100644 --- a/go.sum +++ b/go.sum @@ -1624,8 +1624,8 @@ sigs.k8s.io/controller-tools v0.6.0 h1:o2Fm1K7CmIp8OVaBtXsWB/ssBAzyoKZPPAGR3Vuxa sigs.k8s.io/controller-tools v0.6.0/go.mod h1:baRMVPrctU77F+rfAuH2uPqW93k6yQnZA2dhUOr7ihc= sigs.k8s.io/kind v0.10.0/go.mod h1:fb32zUw7ewC47bPwLnwhf47wd/vADtv3c38KP7sjIlo= sigs.k8s.io/kubebuilder/v3 v3.0.0-alpha.0.0.20210702145813-742983631190/go.mod h1:pUhjQx9f/+cn1OtSa5zMohY1lgk9s/9Mbcvwj82lrNk= -sigs.k8s.io/kubebuilder/v3 v3.0.0-alpha.0.0.20210707171043-359e8aa70c2b h1:fGbw9og/lq/fNi4afnVwSinfaQXkonlbTar9nG95u44= -sigs.k8s.io/kubebuilder/v3 v3.0.0-alpha.0.0.20210707171043-359e8aa70c2b/go.mod h1:pUhjQx9f/+cn1OtSa5zMohY1lgk9s/9Mbcvwj82lrNk= +sigs.k8s.io/kubebuilder/v3 v3.0.0-alpha.0.0.20210803185103-51e4a9aa5055 h1:3f5m0xp0DEsg+Sdrt1Rld8TCEFOH5GKsoYrEpdOzA+s= +sigs.k8s.io/kubebuilder/v3 v3.0.0-alpha.0.0.20210803185103-51e4a9aa5055/go.mod h1:pUhjQx9f/+cn1OtSa5zMohY1lgk9s/9Mbcvwj82lrNk= sigs.k8s.io/kustomize v2.0.3+incompatible h1:JUufWFNlI44MdtnjUqVnvh29rR37PQFzPbLXqhyOyX0= sigs.k8s.io/kustomize v2.0.3+incompatible/go.mod h1:MkjgH3RdOWrievjo6c9T245dYlB5QeXV4WCbnt/PEpU= sigs.k8s.io/kustomize/api v0.8.5 h1:bfCXGXDAbFbb/Jv5AhMj2BB8a5VAJuuQ5/KU69WtDjQ= diff --git a/internal/plugins/ansible/v1/init.go b/internal/plugins/ansible/v1/init.go index 207c8dd467f..680c7a9e97a 100644 --- a/internal/plugins/ansible/v1/init.go +++ b/internal/plugins/ansible/v1/init.go @@ -177,8 +177,8 @@ func addInitCustomizations(projectName string) error { // todo: remove it when we solve the issue operator-framework/operator-sdk#3573 const resourcesLimitsFragment = ` resources: limits: - cpu: 100m - memory: 30Mi + cpu: 200m + memory: 100Mi requests: cpu: 100m memory: 20Mi diff --git a/internal/plugins/helm/v1/init.go b/internal/plugins/helm/v1/init.go index f8ede16cc3a..f2db1d4b009 100644 --- a/internal/plugins/helm/v1/init.go +++ b/internal/plugins/helm/v1/init.go @@ -199,10 +199,6 @@ func addInitCustomizations(projectName string) error { } // Increase the default memory required. - err = sdkutil.ReplaceInFile(managerFile, "memory: 30Mi", "memory: 90Mi") - if err != nil { - return err - } err = sdkutil.ReplaceInFile(managerFile, "memory: 20Mi", "memory: 60Mi") if err != nil { return err diff --git a/testdata/ansible/memcached-operator/bundle/manifests/memcached-operator-controller-manager-metrics-service_v1_service.yaml b/testdata/ansible/memcached-operator/bundle/manifests/memcached-operator-controller-manager-metrics-service_v1_service.yaml index 157a0cefa11..79085e5ae58 100644 --- a/testdata/ansible/memcached-operator/bundle/manifests/memcached-operator-controller-manager-metrics-service_v1_service.yaml +++ b/testdata/ansible/memcached-operator/bundle/manifests/memcached-operator-controller-manager-metrics-service_v1_service.yaml @@ -9,6 +9,7 @@ spec: ports: - name: https port: 8443 + protocol: TCP targetPort: https selector: control-plane: controller-manager diff --git a/testdata/ansible/memcached-operator/bundle/manifests/memcached-operator.clusterserviceversion.yaml b/testdata/ansible/memcached-operator/bundle/manifests/memcached-operator.clusterserviceversion.yaml index 985dcef3add..e81ccabbdbe 100644 --- a/testdata/ansible/memcached-operator/bundle/manifests/memcached-operator.clusterserviceversion.yaml +++ b/testdata/ansible/memcached-operator/bundle/manifests/memcached-operator.clusterserviceversion.yaml @@ -115,6 +115,7 @@ spec: ports: - containerPort: 8443 name: https + protocol: TCP resources: {} - args: - --health-probe-bind-address=:6789 diff --git a/testdata/ansible/memcached-operator/config/default/manager_auth_proxy_patch.yaml b/testdata/ansible/memcached-operator/config/default/manager_auth_proxy_patch.yaml index fabc2065ef8..8fbf836e4d1 100644 --- a/testdata/ansible/memcached-operator/config/default/manager_auth_proxy_patch.yaml +++ b/testdata/ansible/memcached-operator/config/default/manager_auth_proxy_patch.yaml @@ -18,6 +18,7 @@ spec: - "--v=10" ports: - containerPort: 8443 + protocol: TCP name: https - name: manager args: diff --git a/testdata/ansible/memcached-operator/config/rbac/auth_proxy_service.yaml b/testdata/ansible/memcached-operator/config/rbac/auth_proxy_service.yaml index 6cf656be149..71f1797279e 100644 --- a/testdata/ansible/memcached-operator/config/rbac/auth_proxy_service.yaml +++ b/testdata/ansible/memcached-operator/config/rbac/auth_proxy_service.yaml @@ -9,6 +9,7 @@ spec: ports: - name: https port: 8443 + protocol: TCP targetPort: https selector: control-plane: controller-manager diff --git a/testdata/go/v3/memcached-operator/Makefile b/testdata/go/v3/memcached-operator/Makefile index c8744e94645..2cf8fbab24e 100644 --- a/testdata/go/v3/memcached-operator/Makefile +++ b/testdata/go/v3/memcached-operator/Makefile @@ -39,6 +39,8 @@ BUNDLE_IMG ?= $(IMAGE_TAG_BASE)-bundle:v$(VERSION) IMG ?= controller:latest # Produce CRDs that work back to Kubernetes 1.11 (no version conversion) CRD_OPTIONS ?= "crd:trivialVersions=true,preserveUnknownFields=false" +# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary. +ENVTEST_K8S_VERSION = 1.21 # Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set) ifeq (,$(shell go env GOBIN)) @@ -86,7 +88,7 @@ vet: ## Run go vet against code. go vet ./... test: manifests generate fmt vet envtest ## Run tests. - go test ./... -coverprofile cover.out + KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test ./... -coverprofile cover.out ##@ Build @@ -129,7 +131,6 @@ kustomize: ## Download kustomize locally if necessary. ENVTEST = $(shell pwd)/bin/setup-envtest envtest: ## Download envtest-setup locally if necessary. $(call go-get-tool,$(ENVTEST),sigs.k8s.io/controller-runtime/tools/setup-envtest@latest) - $(ENVTEST) use 1.21 # go-get-tool will 'go get' any package $2 and install it to $1. PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST)))) diff --git a/testdata/go/v3/memcached-operator/bundle/manifests/memcached-operator-controller-manager-metrics-service_v1_service.yaml b/testdata/go/v3/memcached-operator/bundle/manifests/memcached-operator-controller-manager-metrics-service_v1_service.yaml index 157a0cefa11..79085e5ae58 100644 --- a/testdata/go/v3/memcached-operator/bundle/manifests/memcached-operator-controller-manager-metrics-service_v1_service.yaml +++ b/testdata/go/v3/memcached-operator/bundle/manifests/memcached-operator-controller-manager-metrics-service_v1_service.yaml @@ -9,6 +9,7 @@ spec: ports: - name: https port: 8443 + protocol: TCP targetPort: https selector: control-plane: controller-manager diff --git a/testdata/go/v3/memcached-operator/bundle/manifests/memcached-operator-webhook-service_v1_service.yaml b/testdata/go/v3/memcached-operator/bundle/manifests/memcached-operator-webhook-service_v1_service.yaml index 4c9ef443f09..3bb3965dc12 100644 --- a/testdata/go/v3/memcached-operator/bundle/manifests/memcached-operator-webhook-service_v1_service.yaml +++ b/testdata/go/v3/memcached-operator/bundle/manifests/memcached-operator-webhook-service_v1_service.yaml @@ -6,6 +6,7 @@ metadata: spec: ports: - port: 443 + protocol: TCP targetPort: 9443 selector: control-plane: controller-manager diff --git a/testdata/go/v3/memcached-operator/bundle/manifests/memcached-operator.clusterserviceversion.yaml b/testdata/go/v3/memcached-operator/bundle/manifests/memcached-operator.clusterserviceversion.yaml index 8d9dd284710..b8bf2a34431 100644 --- a/testdata/go/v3/memcached-operator/bundle/manifests/memcached-operator.clusterserviceversion.yaml +++ b/testdata/go/v3/memcached-operator/bundle/manifests/memcached-operator.clusterserviceversion.yaml @@ -119,6 +119,7 @@ spec: ports: - containerPort: 8443 name: https + protocol: TCP resources: {} - args: - --health-probe-bind-address=:8081 @@ -146,8 +147,8 @@ spec: periodSeconds: 10 resources: limits: - cpu: 100m - memory: 30Mi + cpu: 200m + memory: 100Mi requests: cpu: 100m memory: 20Mi diff --git a/testdata/go/v3/memcached-operator/config/default/manager_auth_proxy_patch.yaml b/testdata/go/v3/memcached-operator/config/default/manager_auth_proxy_patch.yaml index a224be19ea1..4e2232fa1a9 100644 --- a/testdata/go/v3/memcached-operator/config/default/manager_auth_proxy_patch.yaml +++ b/testdata/go/v3/memcached-operator/config/default/manager_auth_proxy_patch.yaml @@ -18,6 +18,7 @@ spec: - "--v=10" ports: - containerPort: 8443 + protocol: TCP name: https - name: manager args: diff --git a/testdata/go/v3/memcached-operator/config/manager/manager.yaml b/testdata/go/v3/memcached-operator/config/manager/manager.yaml index 79adfe72a55..202624427c2 100644 --- a/testdata/go/v3/memcached-operator/config/manager/manager.yaml +++ b/testdata/go/v3/memcached-operator/config/manager/manager.yaml @@ -47,8 +47,8 @@ spec: periodSeconds: 10 resources: limits: - cpu: 100m - memory: 30Mi + cpu: 200m + memory: 100Mi requests: cpu: 100m memory: 20Mi diff --git a/testdata/go/v3/memcached-operator/config/rbac/auth_proxy_service.yaml b/testdata/go/v3/memcached-operator/config/rbac/auth_proxy_service.yaml index 6cf656be149..71f1797279e 100644 --- a/testdata/go/v3/memcached-operator/config/rbac/auth_proxy_service.yaml +++ b/testdata/go/v3/memcached-operator/config/rbac/auth_proxy_service.yaml @@ -9,6 +9,7 @@ spec: ports: - name: https port: 8443 + protocol: TCP targetPort: https selector: control-plane: controller-manager diff --git a/testdata/go/v3/memcached-operator/config/webhook/service.yaml b/testdata/go/v3/memcached-operator/config/webhook/service.yaml index 31e0f829591..3f638bd9c68 100644 --- a/testdata/go/v3/memcached-operator/config/webhook/service.yaml +++ b/testdata/go/v3/memcached-operator/config/webhook/service.yaml @@ -7,6 +7,7 @@ metadata: spec: ports: - port: 443 + protocol: TCP targetPort: 9443 selector: control-plane: controller-manager diff --git a/testdata/helm/memcached-operator/bundle/manifests/memcached-operator-controller-manager-metrics-service_v1_service.yaml b/testdata/helm/memcached-operator/bundle/manifests/memcached-operator-controller-manager-metrics-service_v1_service.yaml index 157a0cefa11..79085e5ae58 100644 --- a/testdata/helm/memcached-operator/bundle/manifests/memcached-operator-controller-manager-metrics-service_v1_service.yaml +++ b/testdata/helm/memcached-operator/bundle/manifests/memcached-operator-controller-manager-metrics-service_v1_service.yaml @@ -9,6 +9,7 @@ spec: ports: - name: https port: 8443 + protocol: TCP targetPort: https selector: control-plane: controller-manager diff --git a/testdata/helm/memcached-operator/bundle/manifests/memcached-operator.clusterserviceversion.yaml b/testdata/helm/memcached-operator/bundle/manifests/memcached-operator.clusterserviceversion.yaml index 7d025a25a5c..6016a7cfbaf 100644 --- a/testdata/helm/memcached-operator/bundle/manifests/memcached-operator.clusterserviceversion.yaml +++ b/testdata/helm/memcached-operator/bundle/manifests/memcached-operator.clusterserviceversion.yaml @@ -203,6 +203,7 @@ spec: ports: - containerPort: 8443 name: https + protocol: TCP resources: {} - args: - --health-probe-bind-address=:8081 @@ -225,8 +226,8 @@ spec: periodSeconds: 10 resources: limits: - cpu: 100m - memory: 90Mi + cpu: 200m + memory: 100Mi requests: cpu: 100m memory: 60Mi diff --git a/testdata/helm/memcached-operator/config/default/manager_auth_proxy_patch.yaml b/testdata/helm/memcached-operator/config/default/manager_auth_proxy_patch.yaml index 33886eb0c46..92bc8851e66 100644 --- a/testdata/helm/memcached-operator/config/default/manager_auth_proxy_patch.yaml +++ b/testdata/helm/memcached-operator/config/default/manager_auth_proxy_patch.yaml @@ -18,6 +18,7 @@ spec: - "--v=10" ports: - containerPort: 8443 + protocol: TCP name: https - name: manager args: diff --git a/testdata/helm/memcached-operator/config/manager/manager.yaml b/testdata/helm/memcached-operator/config/manager/manager.yaml index 6dde7ee47fb..cb2ea1ba5c1 100644 --- a/testdata/helm/memcached-operator/config/manager/manager.yaml +++ b/testdata/helm/memcached-operator/config/manager/manager.yaml @@ -46,8 +46,8 @@ spec: periodSeconds: 10 resources: limits: - cpu: 100m - memory: 90Mi + cpu: 200m + memory: 100Mi requests: cpu: 100m memory: 60Mi diff --git a/testdata/helm/memcached-operator/config/rbac/auth_proxy_service.yaml b/testdata/helm/memcached-operator/config/rbac/auth_proxy_service.yaml index 6cf656be149..71f1797279e 100644 --- a/testdata/helm/memcached-operator/config/rbac/auth_proxy_service.yaml +++ b/testdata/helm/memcached-operator/config/rbac/auth_proxy_service.yaml @@ -9,6 +9,7 @@ spec: ports: - name: https port: 8443 + protocol: TCP targetPort: https selector: control-plane: controller-manager