Skip to content

Commit

Permalink
Bump kubebuilder 3.6.0, upgrade kustomize and add support to Apple Si…
Browse files Browse the repository at this point in the history
…licon
  • Loading branch information
Camila Macedo committed Aug 5, 2022
1 parent 0a7bfd8 commit d49f112
Show file tree
Hide file tree
Showing 119 changed files with 2,857 additions and 1,489 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export IMAGE_VERSION = v1.22.0
export SIMPLE_VERSION = $(shell (test "$(shell git describe --tags)" = "$(shell git describe --tags --abbrev=0)" && echo $(shell git describe --tags)) || echo $(shell git describe --tags --abbrev=0)+git)
export GIT_VERSION = $(shell git describe --dirty --tags --always)
export GIT_COMMIT = $(shell git rev-parse HEAD)
export K8S_VERSION = 1.24.1
export K8S_VERSION = 1.24.2

# Build settings
export TOOLS_DIR = tools/bin
Expand All @@ -36,6 +36,7 @@ export PATH := $(PWD)/$(BUILD_DIR):$(PWD)/$(TOOLS_DIR):$(PATH)

.PHONY: generate
generate: build # Generate CLI docs and samples
rm -rf testdata
go run ./hack/generate/cncf-maintainers/main.go
go run ./hack/generate/cli-doc/gen-cli-doc.go
go run ./hack/generate/samples/generate_testdata.go
Expand Down
106 changes: 106 additions & 0 deletions changelog/fragments/bump-kubebuilder-add-kustomize.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# entries is a list of entries to include in
# release notes and/or the migration guide
entries:
- description: Add a plugin (deploy-image/v1-alpha) for Golang projects which scaffolds the code Deploy and Manage an Operand(image). You can test it out by running `operator-sdk --group=example.com --version=v1alpha1 --kind=Memcached --image=memcached:1.6.15-alpine --image-container-command="memcached,-m=64,modern,-v" --image-container-port="11211" --run-as-user="1001" --plugins="deploy-image/v1-alpha"` [More info](https://master.book.kubebuilder.io/plugins/deploy-image-plugin-v1-alpha.html)
kind: "addition"
breaking: false
- description: Add a plugin (grafana/v1-alpha) valid for all languages to help you generate Grafana dashboards. You can test it out by running `operator-sdk edit --plugins=grafana.kubebuilder.io/v1-alpha` [More info](https://master.book.kubebuilder.io/plugins/grafana-v1-alpha.html)
kind: "addition"
breaking: false
- description: Add new golang plugin `go/v4-alpha` which adds support for Apple Silicon(`darwin/arm64`)
kind: "addition"
breaking: false
- description: Fix Makefile targets to not download binaries when they are found already
kind: "bugfix"
breaking: false
migration:
header: (go/v3) Fix Makefile targets to not download binaries when they are found already
body: |
Update the Makefile targets by adding `test -s $(LOCALBIN)/<binary-name> ||` before the instruction to download them, see:
```sh
KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
.PHONY: kustomize
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
$(KUSTOMIZE): $(LOCALBIN)
test -s $(LOCALBIN)/kustomize || { curl -s $(KUSTOMIZE_INSTALL_SCRIPT) | bash -s -- $(subst v,,$(KUSTOMIZE_VERSION)) $(LOCALBIN); }
.PHONY: controller-gen
controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary.
$(CONTROLLER_GEN): $(LOCALBIN)
test -s $(LOCALBIN)/controller-gen || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION)
.PHONY: envtest
envtest: $(ENVTEST) ## Download envtest-setup locally if necessary.
$(ENVTEST): $(LOCALBIN)
test -s $(LOCALBIN)/setup-envtest || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
```
- description: Remove the option to call `kustomize/v1` plugin alone. If you are looking to use this project as a base for you to generate other plugins, please use [Kubebuilder](https://github.com/kubernetes-sigs/kubebuilder) instead
kind: "bugfix"
breaking: false
- description: (go/v3) Update `controller-tools` from `0.9.0` to `0.9.2`. [More info](https://github.com/kubernetes-sigs/controller-tools/releases/tag/v0.9.2)
kind: "change"
breaking: false
migration:
header: (go/v3) Update `controller-tools` from `0.9.0` to `0.9.2`.
body: |
In the `Makefile` file, replace `CONTROLLER_TOOLS_VERSION ?= v0.9.0` with `CONTROLLER_TOOLS_VERSION ?= v0.9.2`
- description: (go/v3) Update `controller-runtime` from `v0.12.1` to `v0.12.2` and Kubernetes dependencies from `v0.24.0` to `v0.24.2`. [More info](https://github.com/kubernetes-sigs/controller-runtime/releases/tag/v0.12.2)
kind: "change"
breaking: false
migration:
header: go/v3) Update `controller-runtime` from `v0.12.1` to `v0.12.2` and Kubernetes dependencies from `v0.24.0` to `v0.24.2`.
body: |
In the `go.mod` file, ensure the following dependencies versions and run `go mod tidy`:
```go
k8s.io/api v0.24.2
k8s.io/apimachinery v0.24.2
k8s.io/client-go v0.24.2
sigs.k8s.io/controller-runtime v0.12.2
```
- description: (go/v3,ansible/v1,helm/v1) Update `gcr.io/kubebuilder/kube-rbac-proxy` from `0.12.0` to `0.13.0`. [More info](https://github.com/brancz/kube-rbac-proxy/releases/tag/v0.13.0)
kind: "change"
breaking: false
migration:
header: Update `gcr.io/kubebuilder/kube-rbac-proxy` from `0.12.0` to `0.13.0`
body: |
In the `config/default/manager_auth_proxy_patch.yaml` file, replace `gcr.io/kubebuilder/kube-rbac-proxy:0.12.0` with `gcr.io/kubebuilder/kube-rbac-proxy:0.13.0`
- description: >
(ansible/v1,helm/v1) Add supports for Apple Silicon(`darwin/arm64`) and upgrade kustomize version from `v3.8.7` to `v4.5.5`. [Release Notes](https://github.com/kubernetes-sigs/kustomize/releases/tag/kustomize%2Fv4.0.0)
kind: "change"
breaking: yes
- description: >
(ansible/v1,helm/v1) Add supports for Apple Silicon(`darwin/arm64`) and upgrade kustomize version from `v3.8.7` to `v4.5.5`. [Release Notes](https://github.com/kubernetes-sigs/kustomize/releases/tag/kustomize%2Fv4.0.0)
kind: "change"
# Is this a breaking change?
breaking: yes
migration:
header:
body: |
Upgrade kustomize versions from `v3.8.7` to `v4.5.5`
**WARNING** If your project has customizations using kustomize you might be impacted on them. See its [Release Notes](https://github.com/kubernetes-sigs/kustomize/releases/tag/kustomize%2Fv4.0.0). (Note all changes are covered by its docs)
- Update the kustomize version in your Makefile: ensure that the value used for KUSTOMIZE_VERSION is `v4.5.5`
- In the `config/default/kustomization.yaml` file:
a) Replace:
```yaml
#commonLabels:
# someName: someValue
```
With:
```yaml
#labels:
#- includeSelectors: true
# pairs:
# someName: someValue
```
b) Replace: `bases:` With: `resources:`
**(Valid Only for Ansible Projects)**
- In the molecule/default, replace `--load_restrictor none .` with `--load-restrictor LoadRestrictionsNone`
- description: >
(hybrid/v1-alpha) Add supports for Apple Silicon(`darwin/arm64`) and upgrade kustomize version from `v3.8.7` to `v4.5.5`. [Release Notes](https://github.com/kubernetes-sigs/kustomize/releases/tag/kustomize%2Fv4.0.0)
18 changes: 9 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ require (
golang.org/x/tools v0.1.11
gomodules.xyz/jsonpatch/v3 v3.0.1
helm.sh/helm/v3 v3.9.0
k8s.io/api v0.24.1
k8s.io/apiextensions-apiserver v0.24.1
k8s.io/apimachinery v0.24.1
k8s.io/api v0.24.2
k8s.io/apiextensions-apiserver v0.24.2
k8s.io/apimachinery v0.24.2
k8s.io/cli-runtime v0.24.1
k8s.io/client-go v0.24.1
k8s.io/client-go v0.24.2
k8s.io/kubectl v0.24.1
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9
sigs.k8s.io/controller-runtime v0.12.1
sigs.k8s.io/controller-tools v0.9.0
sigs.k8s.io/kubebuilder/v3 v3.5.0
sigs.k8s.io/controller-runtime v0.12.2
sigs.k8s.io/controller-tools v0.9.2
sigs.k8s.io/kubebuilder/v3 v3.6.0
sigs.k8s.io/yaml v1.3.0
)

Expand Down Expand Up @@ -241,8 +241,8 @@ require (
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
k8s.io/apiserver v0.24.1 // indirect
k8s.io/component-base v0.24.1 // indirect
k8s.io/apiserver v0.24.2 // indirect
k8s.io/component-base v0.24.2 // indirect
k8s.io/klog/v2 v2.60.1 // indirect
k8s.io/kube-openapi v0.0.0-20220328201542-3ee0da9b0b42 // indirect
oras.land/oras-go v1.1.0 // indirect
Expand Down
33 changes: 19 additions & 14 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1752,22 +1752,27 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
k8s.io/api v0.24.1 h1:BjCMRDcyEYz03joa3K1+rbshwh1Ay6oB53+iUx2H8UY=
k8s.io/api v0.24.1/go.mod h1:JhoOvNiLXKTPQ60zh2g0ewpA+bnEYf5q44Flhquh4vQ=
k8s.io/apiextensions-apiserver v0.24.1 h1:5yBh9+ueTq/kfnHQZa0MAo6uNcPrtxPMpNQgorBaKS0=
k8s.io/apiextensions-apiserver v0.24.1/go.mod h1:A6MHfaLDGfjOc/We2nM7uewD5Oa/FnEbZ6cD7g2ca4Q=
k8s.io/apimachinery v0.24.1 h1:ShD4aDxTQKN5zNf8K1RQ2u98ELLdIW7jEnlO9uAMX/I=
k8s.io/api v0.24.2 h1:g518dPU/L7VRLxWfcadQn2OnsiGWVOadTLpdnqgY2OI=
k8s.io/api v0.24.2/go.mod h1:AHqbSkTm6YrQ0ObxjO3Pmp/ubFF/KuM7jU+3khoBsOg=
k8s.io/apiextensions-apiserver v0.24.2 h1:/4NEQHKlEz1MlaK/wHT5KMKC9UKYz6NZz6JE6ov4G6k=
k8s.io/apiextensions-apiserver v0.24.2/go.mod h1:e5t2GMFVngUEHUd0wuCJzw8YDwZoqZfJiGOW6mm2hLQ=
k8s.io/apimachinery v0.24.1/go.mod h1:82Bi4sCzVBdpYjyI4jY6aHX+YCUchUIrZrXKedjd2UM=
k8s.io/apiserver v0.24.1 h1:LAA5UpPOeaREEtFAQRUQOI3eE5So/j5J3zeQJjeLdz4=
k8s.io/apiserver v0.24.1/go.mod h1:dQWNMx15S8NqJMp0gpYfssyvhYnkilc1LpExd/dkLh0=
k8s.io/apimachinery v0.24.2 h1:5QlH9SL2C8KMcrNJPor+LbXVTaZRReml7svPEh4OKDM=
k8s.io/apimachinery v0.24.2/go.mod h1:82Bi4sCzVBdpYjyI4jY6aHX+YCUchUIrZrXKedjd2UM=
k8s.io/apiserver v0.24.2 h1:orxipm5elPJSkkFNlwH9ClqaKEDJJA3yR2cAAlCnyj4=
k8s.io/apiserver v0.24.2/go.mod h1:pSuKzr3zV+L+MWqsEo0kHHYwCo77AT5qXbFXP2jbvFI=
k8s.io/cli-runtime v0.24.1 h1:IW6L8dRBq+pPTzvXcB+m/hOabzbqXy57Bqo4XxmW7DY=
k8s.io/cli-runtime v0.24.1/go.mod h1:14aVvCTqkA7dNXY51N/6hRY3GUjchyWDOwW84qmR3bs=
k8s.io/client-go v0.24.1 h1:w1hNdI9PFrzu3OlovVeTnf4oHDt+FJLd9Ndluvnb42E=
k8s.io/client-go v0.24.1/go.mod h1:f1kIDqcEYmwXS/vTbbhopMUbhKp2JhOeVTfxgaCIlF8=
k8s.io/client-go v0.24.2 h1:CoXFSf8if+bLEbinDqN9ePIDGzcLtqhfd6jpfnwGOFA=
k8s.io/client-go v0.24.2/go.mod h1:zg4Xaoo+umDsfCWr4fCnmLEtQXyCNXCvJuSsglNcV30=
k8s.io/code-generator v0.19.7/go.mod h1:lwEq3YnLYb/7uVXLorOJfxg+cUu2oihFhHZ0n9NIla0=
k8s.io/code-generator v0.24.1/go.mod h1:dpVhs00hTuTdTY6jvVxvTFCk6gSMrtfRydbhZwHI15w=
k8s.io/component-base v0.24.1 h1:APv6W/YmfOWZfo+XJ1mZwep/f7g7Tpwvdbo9CQLDuts=
k8s.io/code-generator v0.24.2/go.mod h1:dpVhs00hTuTdTY6jvVxvTFCk6gSMrtfRydbhZwHI15w=
k8s.io/component-base v0.24.1/go.mod h1:DW5vQGYVCog8WYpNob3PMmmsY8A3L9QZNg4j/dV3s38=
k8s.io/component-base v0.24.2 h1:kwpQdoSfbcH+8MPN4tALtajLDfSfYxBDYlXobNWI6OU=
k8s.io/component-base v0.24.2/go.mod h1:ucHwW76dajvQ9B7+zecZAP3BVqvrHoOxm8olHEg0nmM=
k8s.io/component-helpers v0.24.1/go.mod h1:q5Z1pWV/QfX9ThuNeywxasiwkLw9KsR4Q9TAOdb/Y3s=
k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
k8s.io/gengo v0.0.0-20200428234225-8167cfdcfc14/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
Expand Down Expand Up @@ -1796,14 +1801,14 @@ rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.30 h1:dUk62HQ3ZFhD48Qr8MIXCiKA8wInBQCtuE4QGfFW7yA=
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.30/go.mod h1:fEO7lRTdivWO2qYVCVG7dEADOMo/MLDCVr8So2g88Uw=
sigs.k8s.io/controller-runtime v0.12.1 h1:4BJY01xe9zKQti8oRjj/NeHKRXthf1YkYJAgLONFFoI=
sigs.k8s.io/controller-runtime v0.12.1/go.mod h1:BKhxlA4l7FPK4AQcsuL4X6vZeWnKDXez/vp1Y8dxTU0=
sigs.k8s.io/controller-tools v0.9.0 h1:b/vSEPpA8hiMiyzDfLbZdCn3hoAcy3/868OHhYtHY9w=
sigs.k8s.io/controller-tools v0.9.0/go.mod h1:NUkn8FTV3Sad3wWpSK7dt/145qfuQ8CKJV6j4jHC5rM=
sigs.k8s.io/controller-runtime v0.12.2 h1:nqV02cvhbAj7tbt21bpPpTByrXGn2INHRsi39lXy9sE=
sigs.k8s.io/controller-runtime v0.12.2/go.mod h1:qKsk4WE6zW2Hfj0G4v10EnNB2jMG1C+NTb8h+DwCoU0=
sigs.k8s.io/controller-tools v0.9.2 h1:AkTE3QAdz9LS4iD3EJvHyYxBkg/g9fTbgiYsrcsFCcM=
sigs.k8s.io/controller-tools v0.9.2/go.mod h1:NUkn8FTV3Sad3wWpSK7dt/145qfuQ8CKJV6j4jHC5rM=
sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2 h1:kDi4JBNAsJWfz1aEXhO8Jg87JJaPNLh5tIzYHgStQ9Y=
sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2/go.mod h1:B+TnT182UBxE84DiCz4CVE26eOSDAeYCpfDnC2kdKMY=
sigs.k8s.io/kubebuilder/v3 v3.5.0 h1:LnLMp74vq4xAHTSDVO9KWhCq7ZgK5kYPNMT82gasBZY=
sigs.k8s.io/kubebuilder/v3 v3.5.0/go.mod h1:2o0wAP/Qi4vLA5tlmKOCTZdWUlkdewvkNi3o5Ko6eSw=
sigs.k8s.io/kubebuilder/v3 v3.6.0 h1:S0J4ST871SVG5oObPRfyJVjdoKbIUoQgTIUHDq/YtcQ=
sigs.k8s.io/kubebuilder/v3 v3.6.0/go.mod h1:+s6WdvJjIpYRKO+idaeIK5JhbjrZybxh9+K6jK9/Yyc=
sigs.k8s.io/kustomize/api v0.11.4 h1:/0Mr3kfBBNcNPOW5Qwk/3eb8zkswCwnqQxxKtmrTkRo=
sigs.k8s.io/kustomize/api v0.11.4/go.mod h1:k+8RsqYbgpkIrJ4p9jcdPqe8DprLxFUUO0yNOq8C+xI=
sigs.k8s.io/kustomize/cmd/config v0.10.6/go.mod h1:/S4A4nUANUa4bZJ/Edt7ZQTyKOY9WCER0uBS1SW2Rco=
Expand Down
12 changes: 8 additions & 4 deletions hack/generate/samples/internal/go/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,15 @@ package golang
import (
"path/filepath"

golangv2 "github.com/operator-framework/operator-sdk/hack/generate/samples/internal/go/v2"
golangv3 "github.com/operator-framework/operator-sdk/hack/generate/samples/internal/go/v3"
withwebhooks "github.com/operator-framework/operator-sdk/hack/generate/samples/internal/go/memcached-with-webhooks"
)

func GenerateMemcachedSamples(binaryPath, rootPath string) {
golangv2.GenerateMemcachedSample(binaryPath, filepath.Join(rootPath, "go", "v2"))
golangv3.GenerateMemcachedSample(binaryPath, filepath.Join(rootPath, "go", "v3"))

// TODO: replace the Memcached implementation and update the tutorial
// to use the deploy.image/v1-alpha plugin to do the scaffold instead
// to create an empty scaffold add add all code. So that, we can also
// ensure that the tutorial follows the good practices
withwebhooks.GenerateSample(binaryPath, filepath.Join(rootPath, "go", "v3"))
withwebhooks.GenerateSample(binaryPath, filepath.Join(rootPath, "go", "v4-alpha"))
}
Loading

0 comments on commit d49f112

Please sign in to comment.