Skip to content

Commit

Permalink
*: helm support for v3.0.0 apis
Browse files Browse the repository at this point in the history
  • Loading branch information
zhl003 committed Mar 7, 2023
1 parent 989e9c4 commit 8f84085
Show file tree
Hide file tree
Showing 15 changed files with 46 additions and 45 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
35 changes: 18 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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} .
Expand Down Expand Up @@ -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" {} \;

6 changes: 3 additions & 3 deletions charts/mysql-operator/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

4 changes: 2 additions & 2 deletions charts/mysql-operator/charts/mysql-cluster/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 1 addition & 1 deletion charts/mysql-operator/charts/mysql-cluster/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ name: "sample"
namespace: "default"

mysqlVersion: "8.0"
version: v2.3.0
version: v3.0.0

tls:
enable: false
Expand Down
4 changes: 2 additions & 2 deletions charts/mysql-operator/crds/mysql.radondb.com_backups.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
12 changes: 6 additions & 6 deletions charts/mysql-operator/crds/mysql.radondb.com_mysqlclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions charts/mysql-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion config/crd/patches/webhook_in_mysqlclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
clientConfig:
service:
namespace: system
name: webhook-service
name: radondb-mysql-webhook
path: /convert
conversionReviewVersions:
- v1
2 changes: 1 addition & 1 deletion config/samples/mysql_v1alpha1_backup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions config/samples/mysql_v1alpha1_mysqlcluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ spec:
memory: 1Gi

xenonOpts:
image: radondb/xenon:v2.3.0
image: radondb/xenon:v3.0.0
admitDefeatHearbeatCount: 5
electionTimeout: 10000

Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions config/samples/mysql_v1alpha1_mysqlcluster_mysql8.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ spec:
memory: 1Gi

xenonOpts:
image: radondb/xenon:v2.3.0
image: radondb/xenon:v3.0.0
admitDefeatHearbeatCount: 5
electionTimeout: 10000

Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ spec:
memory: 1Gi

xenonOpts:
image: radondb/xenon:v2.3.0
image: radondb/xenon:v3.0.0
admitDefeatHearbeatCount: 5
electionTimeout: 10000

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion config/samples/mysql_v1beta1_backup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8f84085

Please sign in to comment.