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

*: health check enhancement #743

Merged
merged 1 commit into from
Dec 26, 2022
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
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
!**/*.go
!**/*.mod
!**/*.sum
.git
bin
testbin
vendor
17 changes: 12 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# Image URL to use all building/pushing image targets
REGISTRY ?= quay.io
FROM_VERSION ?=v2.2.1
CHART_VERSION ?=2.2.1
CHART_TOVERSION ?=2.3.0
TO_VERSION ?=v2.3.0
IMGPREFIX ?=radondb/
MYSQL_IMAGE_57 ?=5.7.39
MYSQL_IMAGE_80 ?=8.0.26
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
Expand Down Expand Up @@ -79,10 +82,14 @@ 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-arg GO_PROXY=${GO_PORXY} -t ${IMG} .
docker build -f Dockerfile.sidecar --build-arg GO_PROXY=${GO_PORXY} -t ${SIDECAR57_IMG} .
docker build -f build/xenon/Dockerfile --build-arg GO_PROXY=${GO_PORXY} -t ${XENON_IMG} .
docker build --build-arg XTRABACKUP_PKG=percona-xtrabackup-80 --build-arg GO_PROXY=${GO_PORXY} -f Dockerfile.sidecar -t ${SIDECAR80_IMG} .
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} .
docker buildx build --build-arg XTRABACKUP_PKG=percona-xtrabackup-80 --build-arg GO_PROXY=${GO_PORXY} -f Dockerfile.sidecar -t ${SIDECAR80_IMG} .
docker buildx build --build-arg "MYSQL_IMAGE=${MYSQL_IMAGE_57}" --build-arg GO_PROXY=${GO_PORXY} -f build/mysql/Dockerfile -t ${MYSQL_IMAGE_57_TAG} .
docker buildx build --build-arg "MYSQL_IMAGE=${MYSQL_IMAGE_80}" --build-arg GO_PROXY=${GO_PORXY} -f build/mysql/Dockerfile -t ${MYSQL_IMAGE_80_TAG} .
docker-build-mysql57: test ## Build docker image with the manager.
docker buildx build --build-arg "MYSQL_IMAGE=${MYSQL_IMAGE_57}" --build-arg GO_PROXY=${GO_PORXY} -f build/mysql/Dockerfile -t ${MYSQL_IMAGE_57_TAG} .
docker-push: ## Push docker image with the manager.
docker push ${IMG}
docker push ${SIDECAR_IMG}
Expand Down
7 changes: 7 additions & 0 deletions api/v1alpha1/mysqlcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,13 @@ type MysqlOpts struct {
// +optional
// +kubebuilder:default:={limits: {cpu: "500m", memory: "1Gi"}, requests: {cpu: "100m", memory: "256Mi"}}
Resources corev1.ResourceRequirements `json:"resources,omitempty"`

// MaxLagSeconds configures the readiness probe of mysqld container
// if the replication lag is greater than MaxLagSeconds, the mysqld container will not be not healthy.
// +kubebuilder:default:=30
// +kubebuilder:validation:Minimum=0
// +optional
MaxLagSeconds int `json:"maxLagTime,omitempty"`
}

// XenonOpts defines the options of xenon container.
Expand Down
25 changes: 25 additions & 0 deletions build/mysql/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Build the manager binary
ARG MYSQL_IMAGE
FROM golang:1.17.13 as builder
WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
ARG GO_PROXY=off
RUN if [ "$GO_PROXY" = "on" ]; then \
go env -w GOPROXY=https://goproxy.cn,direct; \
fi
RUN go mod download
# Copy the go source
COPY ./ .
# Build
RUN CGO_ENABLED=0 go build -ldflags="-s -w" -a -o mysqlchecker ./cmd/mysql/main.go
FROM percona/percona-server:${MYSQL_IMAGE}
WORKDIR /
COPY --from=builder /workspace/mysqlchecker /usr/bin/mysqlchecker
USER 65532:65532
ENTRYPOINT ["/docker-entrypoint.sh"]

USER mysql
EXPOSE 3306
CMD ["mysqld"]
88 changes: 0 additions & 88 deletions build/mysql/percona-server-5.7/Dockerfile

This file was deleted.

227 changes: 0 additions & 227 deletions build/mysql/percona-server-5.7/ps-entry.sh

This file was deleted.

Loading