From 8f8408517744027a4c181ac66e7155b532073b87 Mon Sep 17 00:00:00 2001 From: cris Date: Tue, 7 Mar 2023 18:24:33 +0800 Subject: [PATCH] *: helm support for v3.0.0 apis --- Dockerfile | 2 +- Makefile | 35 ++++++++++--------- charts/mysql-operator/Chart.yaml | 6 ++-- .../charts/mysql-cluster/Chart.yaml | 4 +-- .../charts/mysql-cluster/values.yaml | 2 +- .../crds/mysql.radondb.com_backups.yaml | 4 +-- .../crds/mysql.radondb.com_mysqlclusters.yaml | 12 +++---- charts/mysql-operator/values.yaml | 4 +-- .../crd/patches/webhook_in_mysqlclusters.yaml | 2 +- config/samples/mysql_v1alpha1_backup.yaml | 2 +- .../samples/mysql_v1alpha1_mysqlcluster.yaml | 4 +-- ...ha1_mysqlcluster_backup_schedule_demo.yaml | 4 +-- .../mysql_v1alpha1_mysqlcluster_mysql8.yaml | 4 +-- ...v1alpha1_mysqlcluster_podAntiAffinity.yaml | 4 +-- config/samples/mysql_v1beta1_backup.yaml | 2 +- 15 files changed, 46 insertions(+), 45 deletions(-) diff --git a/Dockerfile b/Dockerfile index c8a0632c..7c90ecef 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,7 +24,7 @@ COPY utils/ utils/ COPY mysqluser/ mysqluser/ # Build -RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -oPg manager cmd/manager/main.go +RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o manager cmd/manager/main.go # Use distroless as minimal base image to package the manager binary # Refer to https://github.com/GoogleContainerTools/distroless for more details diff --git a/Makefile b/Makefile index 36879134..5b80b671 100644 --- a/Makefile +++ b/Makefile @@ -1,17 +1,18 @@ # Image URL to use all building/pushing image targets -FROM_VERSION ?=v2.2.1 -CHART_VERSION ?=2.2.1 -CHART_TOVERSION ?=2.3.0 -TO_VERSION ?=v2.3.0 +FROM_VERSION ?=v2.3.0 +CHART_VERSION ?=2.3.0 +CHART_TOVERSION ?=3.0.0 +TO_VERSION ?=v3.0.0 +TAG ?=v3.0.0 IMGPREFIX ?=radondb/ MYSQL_IMAGE_57 ?=5.7.39 MYSQL_IMAGE_80 ?=8.0.25 MYSQL_IMAGE_57_TAG ?=$(IMGPREFIX)percona-server:$(MYSQL_IMAGE_57) MYSQL_IMAGE_80_TAG ?=$(IMGPREFIX)percona-server:$(MYSQL_IMAGE_80) -IMG ?= $(IMGPREFIX)mysql-operator:latest -SIDECAR57_IMG ?= $(IMGPREFIX)mysql57-sidecar:latest -SIDECAR80_IMG ?= $(IMGPREFIX)mysql80-sidecar:latest -XENON_IMG ?= $(IMGPREFIX)xenon:latest +IMG ?= $(IMGPREFIX)mysql-operator:$(TAG) +SIDECAR57_IMG ?= $(IMGPREFIX)mysql57-sidecar:$(TAG) +SIDECAR80_IMG ?= $(IMGPREFIX)mysql80-sidecar:$(TAG) +XENON_IMG ?= $(IMGPREFIX)xenon:$(TAG) GO_PORXY ?= off # Produce CRDs that work back to Kubernetes 1.11 (no version conversion) CRD_OPTIONS ?= "crd:trivialVersions=true,preserveUnknownFields=false" @@ -90,7 +91,7 @@ build: generate fmt vet ## Build manager binary. run: manifests generate fmt vet ## Run a controller from your host. go run ./cmd/manager/main.go -docker-build: test ## Build docker image with the manager. +docker-build: ## Build docker image with the manager. docker buildx build --build-arg GO_PROXY=${GO_PORXY} -t ${IMG} . docker buildx build -f Dockerfile.sidecar --build-arg GO_PROXY=${GO_PORXY} -t ${SIDECAR57_IMG} . docker buildx build -f build/xenon/Dockerfile --build-arg GO_PROXY=${GO_PORXY} -t ${XENON_IMG} . @@ -152,13 +153,13 @@ todo: @grep -Irnw './' -e 'TODO:'|grep -v grep updateVersion: - find ./ -type f -name "*.go" -o -name "*.yaml" -exec sed -i "s/mysql57-sidecar:$(FROM_VERSION)/mysql57-sidecar:$(TO_VERSION)/g" {} \; - find ./ -type f -name "*.go" -o -name "*.yaml" -exec sed -i "s/xenon:$(FROM_VERSION)/xenon:$(TO_VERSION)/g" {} \; - find ./ -type f -name "*.go" -o -name "*.yaml" -exec sed -i "s/mysql-operator:$(FROM_VERSION)/mysql-operator:$(TO_VERSION)/g" {} \; - find ./ -type f -name "*.go" -o -name "*.yaml" -exec sed -i "s/mysql80-sidecar:$(FROM_VERSION)/mysql80-sidecar:$(TO_VERSION)/g" {} \; - find ./ -type f -name "*.go" -o -name "*.yaml" -exec sed -i "s/mysql-operator-$(FROM_VERSION)/mysql-operator-$(TO_VERSION)/g" {} \; - find ./ -type f -name "*.go" -o -name "*.yaml" -exec sed -i "s/\"$(FROM_VERSION)\"/\"$(TO_VERSION)\"/g" {} \; + find ./* -type f -name "*.go" -o -name "*.yaml" -exec sed -i "" "s/mysql57-sidecar:$(FROM_VERSION)/mysql57-sidecar:$(TO_VERSION)/g" {} \; + find ./* -type f -name "*.go" -o -name "*.yaml" -exec sed -i "" "s/xenon:$(FROM_VERSION)/xenon:$(TO_VERSION)/g" {} \; + find ./* -type f -name "*.go" -o -name "*.yaml" -exec sed -i "" "s/mysql-operator:$(FROM_VERSION)/mysql-operator:$(TO_VERSION)/g" {} \; + find ./* -type f -name "*.go" -o -name "*.yaml" -exec sed -i "" "s/mysql80-sidecar:$(FROM_VERSION)/mysql80-sidecar:$(TO_VERSION)/g" {} \; + find ./* -type f -name "*.go" -o -name "*.yaml" -exec sed -i "" "s/mysql-operator-$(FROM_VERSION)/mysql-operator-$(TO_VERSION)/g" {} \; + find ./* -type f -name "*.go" -o -name "*.yaml" -exec sed -i "" "s/\"$(FROM_VERSION)\"/\"$(TO_VERSION)\"/g" {} \; # sed -i "18s/$(CHART_VERSION)/$(CHART_TOVERSION)/" charts/mysql-operator/charts/Chart.yaml - find ./charts -type f -name "*.yaml" -exec sed -i "s/$(CHART_VERSION)/$(CHART_TOVERSION)/g" {} \; - find ./config -type f -name "*.yaml" -exec sed -i "s/$(CHART_VERSION)/$(CHART_TOVERSION)/g" {} \; + find ./charts/* -type f -name "*.yaml" -exec sed -i "" "s/$(CHART_VERSION)/$(CHART_TOVERSION)/g" {} \; + find ./config/* -type f -name "*.yaml" -exec sed -i "" "s/$(CHART_VERSION)/$(CHART_TOVERSION)/g" {} \; diff --git a/charts/mysql-operator/Chart.yaml b/charts/mysql-operator/Chart.yaml index ae8d6ec6..79517fe1 100644 --- a/charts/mysql-operator/Chart.yaml +++ b/charts/mysql-operator/Chart.yaml @@ -15,14 +15,14 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: v2.3.0 +version: v3.0.0 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. # It is recommended to use it with quotes. -appVersion: "v2.3.0" +appVersion: "v3.0.0" dependencies: - name: "mysqlcluster" - version: "v2.3.0" + version: "v3.0.0" \ No newline at end of file diff --git a/charts/mysql-operator/charts/mysql-cluster/Chart.yaml b/charts/mysql-operator/charts/mysql-cluster/Chart.yaml index ab07dbb3..29612e5e 100644 --- a/charts/mysql-operator/charts/mysql-cluster/Chart.yaml +++ b/charts/mysql-operator/charts/mysql-cluster/Chart.yaml @@ -15,10 +15,10 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 2.3.0 +version: 3.0.0 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. # It is recommended to use it with quotes. -appVersion: "v2.3.0" +appVersion: "v3.0.0" diff --git a/charts/mysql-operator/charts/mysql-cluster/values.yaml b/charts/mysql-operator/charts/mysql-cluster/values.yaml index cc35b6f7..f7079a1b 100644 --- a/charts/mysql-operator/charts/mysql-cluster/values.yaml +++ b/charts/mysql-operator/charts/mysql-cluster/values.yaml @@ -6,7 +6,7 @@ name: "sample" namespace: "default" mysqlVersion: "8.0" -version: v2.3.0 +version: v3.0.0 tls: enable: false diff --git a/charts/mysql-operator/crds/mysql.radondb.com_backups.yaml b/charts/mysql-operator/crds/mysql.radondb.com_backups.yaml index 3abb51f7..b19cb88d 100644 --- a/charts/mysql-operator/crds/mysql.radondb.com_backups.yaml +++ b/charts/mysql-operator/crds/mysql.radondb.com_backups.yaml @@ -67,7 +67,7 @@ spec: If is empty, is use leader HostName type: string image: - default: radondb/mysql57-sidecar:v2.3.0 + default: radondb/mysql57-sidecar:v3.0.0 description: To specify the image that will be used for sidecar container. type: string nfsServerAddress: @@ -183,7 +183,7 @@ spec: If is empty, is use leader HostFrom type: string image: - default: radondb/mysql57-sidecar:v2.3.0 + default: radondb/mysql57-sidecar:v3.0.0 description: To specify the image that will be used for sidecar container. type: string nfsServerAddress: diff --git a/charts/mysql-operator/crds/mysql.radondb.com_mysqlclusters.yaml b/charts/mysql-operator/crds/mysql.radondb.com_mysqlclusters.yaml index 40110106..dd96ef57 100644 --- a/charts/mysql-operator/crds/mysql.radondb.com_mysqlclusters.yaml +++ b/charts/mysql-operator/crds/mysql.radondb.com_mysqlclusters.yaml @@ -309,7 +309,7 @@ spec: cpu: 10m memory: 32Mi imagePullPolicy: IfNotPresent - sidecarImage: radondb/mysql57-sidecar:v2.3.0 + sidecarImage: radondb/mysql57-sidecar:v3.0.0 description: PodPolicy defines the policy to extra specification. properties: affinity: @@ -1239,7 +1239,7 @@ spec: schedulerName: type: string sidecarImage: - default: radondb/mysql57-sidecar:v2.3.0 + default: radondb/mysql57-sidecar:v3.0.0 description: To specify the image that will be used for sidecar container. type: string @@ -1311,7 +1311,7 @@ spec: default: admitDefeatHearbeatCount: 5 electionTimeout: 10000 - image: radondb/xenon:v2.3.0 + image: radondb/xenon:v3.0.0 resources: limits: cpu: 100m @@ -1338,7 +1338,7 @@ spec: automatically rebuild the invalid node. type: boolean image: - default: radondb/xenon:v2.3.0 + default: radondb/xenon:v3.0.0 description: To specify the image that will be used for xenon container. type: string @@ -2981,7 +2981,7 @@ spec: default: admitDefeatHearbeatCount: 5 electionTimeout: 10000 - image: radondb/xenon:v2.3.0 + image: radondb/xenon:v3.0.0 resources: limits: cpu: 100m @@ -3008,7 +3008,7 @@ spec: automatically rebuild the invalid node. type: boolean image: - default: radondb/xenon:v2.3.0 + default: radondb/xenon:v3.0.0 description: To specify the image that will be used for xenon container. type: string diff --git a/charts/mysql-operator/values.yaml b/charts/mysql-operator/values.yaml index df31e845..75a97d71 100644 --- a/charts/mysql-operator/values.yaml +++ b/charts/mysql-operator/values.yaml @@ -7,7 +7,7 @@ installCRDS: true mysqlcluster: install: false - version: v2.3.0 + version: v3.0.0 ## Specify an imagePullPolicy (Required) ## It's recommended to change this to 'Always' if the image tag is 'latest' ## ref: http://kubernetes.io/docs/user-guide/images/#updating-images @@ -25,7 +25,7 @@ tolerationSeconds: 30 manager: image: radondb/mysql-operator - tag: v2.3.0 + tag: v3.0.0 enableWebhooks: true resources: {} # We usually recommend not to specify default resources and to leave this as a conscious diff --git a/config/crd/patches/webhook_in_mysqlclusters.yaml b/config/crd/patches/webhook_in_mysqlclusters.yaml index 8008e7ba..cafad3d3 100644 --- a/config/crd/patches/webhook_in_mysqlclusters.yaml +++ b/config/crd/patches/webhook_in_mysqlclusters.yaml @@ -10,7 +10,7 @@ spec: clientConfig: service: namespace: system - name: webhook-service + name: radondb-mysql-webhook path: /convert conversionReviewVersions: - v1 diff --git a/config/samples/mysql_v1alpha1_backup.yaml b/config/samples/mysql_v1alpha1_backup.yaml index 4750919c..3469a434 100644 --- a/config/samples/mysql_v1alpha1_backup.yaml +++ b/config/samples/mysql_v1alpha1_backup.yaml @@ -4,7 +4,7 @@ metadata: name: backup-sample spec: # Add fields here - image: radondb/mysql57-sidecar:v2.3.0 + image: radondb/mysql57-sidecar:v3.0.0 # hostname if empty, use the leader as hostname hostName: sample-mysql-0 clusterName: sample diff --git a/config/samples/mysql_v1alpha1_mysqlcluster.yaml b/config/samples/mysql_v1alpha1_mysqlcluster.yaml index 2bbb310d..0395b1c4 100644 --- a/config/samples/mysql_v1alpha1_mysqlcluster.yaml +++ b/config/samples/mysql_v1alpha1_mysqlcluster.yaml @@ -35,7 +35,7 @@ spec: cpu: 500m memory: 1Gi xenonOpts: - image: radondb/xenon:v2.3.0 + image: radondb/xenon:v3.0.0 admitDefeatHearbeatCount: 5 electionTimeout: 10000 resources: @@ -57,7 +57,7 @@ spec: memory: 128Mi podPolicy: imagePullPolicy: IfNotPresent - sidecarImage: radondb/mysql57-sidecar:v2.3.0 + sidecarImage: radondb/mysql57-sidecar:v3.0.0 busyboxImage: busybox:1.32 slowLogTail: false auditLogTail: false diff --git a/config/samples/mysql_v1alpha1_mysqlcluster_backup_schedule_demo.yaml b/config/samples/mysql_v1alpha1_mysqlcluster_backup_schedule_demo.yaml index b4fe788a..f9e1844b 100644 --- a/config/samples/mysql_v1alpha1_mysqlcluster_backup_schedule_demo.yaml +++ b/config/samples/mysql_v1alpha1_mysqlcluster_backup_schedule_demo.yaml @@ -34,7 +34,7 @@ spec: memory: 1Gi xenonOpts: - image: radondb/xenon:v2.3.0 + image: radondb/xenon:v3.0.0 admitDefeatHearbeatCount: 5 electionTimeout: 10000 @@ -60,7 +60,7 @@ spec: podPolicy: imagePullPolicy: IfNotPresent - sidecarImage: radondb/mysql57-sidecar:v2.3.0 + sidecarImage: radondb/mysql57-sidecar:v3.0.0 busyboxImage: busybox:1.32 slowLogTail: false diff --git a/config/samples/mysql_v1alpha1_mysqlcluster_mysql8.yaml b/config/samples/mysql_v1alpha1_mysqlcluster_mysql8.yaml index 88003d6f..f2ab3db2 100644 --- a/config/samples/mysql_v1alpha1_mysqlcluster_mysql8.yaml +++ b/config/samples/mysql_v1alpha1_mysqlcluster_mysql8.yaml @@ -35,7 +35,7 @@ spec: memory: 1Gi xenonOpts: - image: radondb/xenon:v2.3.0 + image: radondb/xenon:v3.0.0 admitDefeatHearbeatCount: 5 electionTimeout: 10000 @@ -61,7 +61,7 @@ spec: podPolicy: imagePullPolicy: IfNotPresent - sidecarImage: radondb/mysql80-sidecar:v2.3.0 + sidecarImage: radondb/mysql80-sidecar:v3.0.0 busyboxImage: busybox:1.32 slowLogTail: false diff --git a/config/samples/mysql_v1alpha1_mysqlcluster_podAntiAffinity.yaml b/config/samples/mysql_v1alpha1_mysqlcluster_podAntiAffinity.yaml index eaa98507..dc10c39c 100644 --- a/config/samples/mysql_v1alpha1_mysqlcluster_podAntiAffinity.yaml +++ b/config/samples/mysql_v1alpha1_mysqlcluster_podAntiAffinity.yaml @@ -34,7 +34,7 @@ spec: memory: 1Gi xenonOpts: - image: radondb/xenon:v2.3.0 + image: radondb/xenon:v3.0.0 admitDefeatHearbeatCount: 5 electionTimeout: 10000 @@ -60,7 +60,7 @@ spec: podPolicy: imagePullPolicy: IfNotPresent - sidecarImage: radondb/mysql57-sidecar:v2.3.0 + sidecarImage: radondb/mysql57-sidecar:v3.0.0 busyboxImage: busybox:1.32 slowLogTail: false diff --git a/config/samples/mysql_v1beta1_backup.yaml b/config/samples/mysql_v1beta1_backup.yaml index 6beed697..c72d3add 100644 --- a/config/samples/mysql_v1beta1_backup.yaml +++ b/config/samples/mysql_v1beta1_backup.yaml @@ -4,7 +4,7 @@ metadata: name: backup-sample spec: # Add fields here - image: radondb/mysql57-sidecar:v2.3.0 + image: radondb/mysql57-sidecar:v3.0.0 # hostfrom if empty, use the leader as hostfrom hostfrom: sample-mysql-0 clusterName: sample