Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bump kubebuilder commit in Operator SDK #5117

Merged
merged 1 commit into from
Aug 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions changelog/fragments/bump-kb.yaml
Original file line number Diff line number Diff line change
@@ -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
```
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
4 changes: 2 additions & 2 deletions internal/plugins/ansible/v1/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions internal/plugins/helm/v1/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ spec:
ports:
- name: https
port: 8443
protocol: TCP
varshaprasad96 marked this conversation as resolved.
Show resolved Hide resolved
targetPort: https
selector:
control-plane: controller-manager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ spec:
ports:
- containerPort: 8443
name: https
protocol: TCP
resources: {}
- args:
- --health-probe-bind-address=:6789
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ spec:
- "--v=10"
ports:
- containerPort: 8443
protocol: TCP
name: https
- name: manager
args:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ spec:
ports:
- name: https
port: 8443
protocol: TCP
targetPort: https
selector:
control-plane: controller-manager
5 changes: 3 additions & 2 deletions testdata/go/v3/memcached-operator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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))))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ spec:
ports:
- name: https
port: 8443
protocol: TCP
targetPort: https
selector:
control-plane: controller-manager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ metadata:
spec:
ports:
- port: 443
protocol: TCP
targetPort: 9443
selector:
control-plane: controller-manager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ spec:
ports:
- containerPort: 8443
name: https
protocol: TCP
resources: {}
- args:
- --health-probe-bind-address=:8081
Expand Down Expand Up @@ -146,8 +147,8 @@ spec:
periodSeconds: 10
resources:
limits:
cpu: 100m
memory: 30Mi
cpu: 200m
varshaprasad96 marked this conversation as resolved.
Show resolved Hide resolved
memory: 100Mi
requests:
cpu: 100m
memory: 20Mi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ spec:
- "--v=10"
ports:
- containerPort: 8443
protocol: TCP
name: https
- name: manager
args:
Expand Down
4 changes: 2 additions & 2 deletions testdata/go/v3/memcached-operator/config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ spec:
periodSeconds: 10
resources:
limits:
cpu: 100m
memory: 30Mi
cpu: 200m
memory: 100Mi
requests:
cpu: 100m
memory: 20Mi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ spec:
ports:
- name: https
port: 8443
protocol: TCP
targetPort: https
selector:
control-plane: controller-manager
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ metadata:
spec:
ports:
- port: 443
protocol: TCP
targetPort: 9443
selector:
control-plane: controller-manager
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ spec:
ports:
- name: https
port: 8443
protocol: TCP
targetPort: https
selector:
control-plane: controller-manager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ spec:
ports:
- containerPort: 8443
name: https
protocol: TCP
resources: {}
- args:
- --health-probe-bind-address=:8081
Expand All @@ -225,8 +226,8 @@ spec:
periodSeconds: 10
resources:
limits:
cpu: 100m
memory: 90Mi
cpu: 200m
memory: 100Mi
requests:
cpu: 100m
memory: 60Mi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ spec:
- "--v=10"
ports:
- containerPort: 8443
protocol: TCP
name: https
- name: manager
args:
Expand Down
4 changes: 2 additions & 2 deletions testdata/helm/memcached-operator/config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ spec:
periodSeconds: 10
resources:
limits:
cpu: 100m
memory: 90Mi
cpu: 200m
memory: 100Mi
requests:
cpu: 100m
memory: 60Mi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ spec:
ports:
- name: https
port: 8443
protocol: TCP
targetPort: https
selector:
control-plane: controller-manager