Skip to content
This repository has been archived by the owner on Dec 5, 2023. It is now read-only.

Add support for percona mysql operator #228

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
80 changes: 80 additions & 0 deletions .github/workflows/percona-xtradb-cluster-operator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: percona-xtradb-cluster-operator

on:
push:
paths:
- '.github/workflows/percona-xtradb-cluster-operator.yml'
- 'build/percona-xtradb-cluster-operator/**'
- '!build/percona-xtradb-cluster-operator/*.md'

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Prepare
id: prep
run: |
BASE_DIR=build/percona-xtradb-cluster-operator
VERSION=$(cat ${BASE_DIR}/.version)
GIT_COMMIT=$(git rev-parse --short HEAD)
GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
BUILD_TIME=$(date '+%FT%TZ')
echo ::set-output name=version::${VERSION}
echo ::set-output name=git_commit::${GIT_COMMIT}
echo ::set-output name=git_branch::${GIT_BRANCH}
echo ::set-output name=build_time::${BUILD_TIME}
echo ::set-output name=base_dir::${BASE_DIR}

- name: Set up QEMU
uses: docker/setup-qemu-action@v1
with:
platforms: all

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
install: true
version: latest

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Build and Push
if: github.ref != 'refs/heads/main'
uses: docker/build-push-action@v2
with:
build-args: |
VERSION=${{ steps.prep.outputs.version }}
GIT_COMMIT=${{ steps.prep.outputs.git_commit }}
GIT_BRANCH=${{ steps.prep.outputs.git_branch }}
BUILD_TIME=${{ steps.prep.outputs.build_time }}
context: ${{ steps.prep.outputs.base_dir }}/
file: ${{ steps.prep.outputs.base_dir }}/Dockerfile
platforms: linux/amd64,linux/arm/v7,linux/arm64
push: true
tags: |
raspbernetes/percona-xtradb-cluster-operator:${{ github.sha }}

- name: Build and Push
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v2
with:
build-args: |
VERSION=${{ steps.prep.outputs.version }}
GIT_COMMIT=${{ steps.prep.outputs.git_commit }}
GIT_BRANCH=${{ steps.prep.outputs.git_branch }}
BUILD_TIME=${{ steps.prep.outputs.build_time }}
context: ${{ steps.prep.outputs.base_dir }}/
file: ${{ steps.prep.outputs.base_dir }}/Dockerfile
platforms: linux/amd64,linux/arm/v7,linux/arm64
push: true
tags: |
raspbernetes/percona-xtradb-cluster-operator:latest
raspbernetes/percona-xtradb-cluster-operator:${{ steps.prep.outputs.version }}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ This repository is only used to store the unofficial docker images that will be
| [kubeyaml](https://hub.docker.com/r/raspbernetes/kubeyaml) | `arm/arm64/amd64` | N/A |
| [kured](https://hub.docker.com/r/raspbernetes/kured) | `arm/arm64/amd64` | N/A |
| [node-feature-discovery](https://hub.docker.com/r/raspbernetes/node-feature-discovery) | `arm/arm64/amd64` | [![GitHub issue status](https://img.shields.io/github/issues/detail/state/kubernetes-sigs/node-feature-discovery/426)](https://github.com/kubernetes-sigs/node-feature-discovery/issues/426) |
| [percona-xtradb-cluster-operator](https://hub.docker.com/r/raspbernetes/percona-xtradb-cluster-operator) | `arm/arm64/amd64` | N/A |
| [sops](https://hub.docker.com/r/raspbernetes/sops) | `arm/arm64/amd64` | [![GitHub issue status](https://img.shields.io/github/issues/detail/state/mozilla/sops/595)](https://github.com/mozilla/sops/issues/595) |
| [thanos](https://hub.docker.com/r/raspbernetes/thanos) | `arm64/amd64` | [![GitHub issue status](https://img.shields.io/github/issues/detail/state/thanos-io/thanos/1851)](https://github.com/thanos-io/thanos/issues/1851) |
| [traefik-forward-auth](https://hub.docker.com/r/raspbernetes/traefik-forward-auth) | `arm64/amd64` | N/A |
Expand Down
1 change: 1 addition & 0 deletions build/percona-xtradb-cluster-operator/.version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v1.10.0
55 changes: 55 additions & 0 deletions build/percona-xtradb-cluster-operator/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
FROM golang:1.17.7 as build

ARG VERSION
ARG TARGETOS
ARG TARGETARCH
ARG TARGETVARIANT=""
ARG GIT_COMMIT
ARG GIT_BRANCH
ARG BUILD_TIME
ARG GO_LDFLAGS

ENV CGO_ENABLED=0 \
GOOS=${TARGETOS} \
GOARCH=${TARGETARCH} \
GOARM=${TARGETVARIANT}

WORKDIR /go/src/github.com/percona/percona-xtradb-cluster-operator

RUN git clone --depth 1 -b ${VERSION} https://github.com/percona/percona-xtradb-cluster-operator .

COPY . .

RUN mkdir -p build/_output/bin \
&& GOOS=$GOOS GOARCH=$GOARCH CGO_ENABLED=$CGO_ENABLED GO_LDFLAGS=$GO_LDFLAGS \
go build -mod=vendor -ldflags "-w -s -X main.GitCommit=$GIT_COMMIT -X main.GitBranch=$GIT_BRANCH -X main.BuildTime=$BUILD_TIME" \
-o build/_output/bin/percona-xtradb-cluster-operator \
cmd/manager/main.go \
&& cp -r build/_output/bin/percona-xtradb-cluster-operator /usr/local/bin/percona-xtradb-cluster-operator

RUN go get k8s.io/apimachinery/pkg/util/sets \
&& go build -o build/_output/bin/peer-list cmd/peer-list/main.go \
&& cp -r build/_output/bin/peer-list /usr/local/bin/

FROM registry.access.redhat.com/ubi8/ubi-minimal AS ubi8
RUN microdnf update && microdnf clean all

LABEL name="Percona XtraDB Cluster Operator" \
vendor="Percona" \
summary="Percona XtraDB Cluster is an active/active high availability and high scalability open source solution for MySQL clustering" \
description="Percona XtraDB Cluster is a high availability solution that helps enterprises avoid downtime and outages and meet expected customer experience." \
maintainer="Percona Development <[email protected]>"

RUN ls -la
COPY --from=build /go/src/github.com/percona/percona-xtradb-cluster-operator/LICENSE /licenses/
COPY --from=build /usr/local/bin/percona-xtradb-cluster-operator /usr/local/bin/percona-xtradb-cluster-operator
COPY --from=build /usr/local/bin/peer-list /peer-list
COPY --from=build /go/src/github.com/percona/percona-xtradb-cluster-operator/build/pxc-entrypoint.sh /pxc-entrypoint.sh
COPY --from=build /go/src/github.com/percona/percona-xtradb-cluster-operator/build/pxc-init-entrypoint.sh /pxc-init-entrypoint.sh
COPY --from=build /go/src/github.com/percona/percona-xtradb-cluster-operator/build/unsafe-bootstrap.sh /unsafe-bootstrap.sh
COPY --from=build /go/src/github.com/percona/percona-xtradb-cluster-operator/build/pxc-configure-pxc.sh /pxc-configure-pxc.sh
COPY --from=build /go/src/github.com/percona/percona-xtradb-cluster-operator/build/liveness-check.sh /liveness-check.sh
COPY --from=build /go/src/github.com/percona/percona-xtradb-cluster-operator/build/readiness-check.sh /readiness-check.sh
COPY --from=build /go/src/github.com/percona/percona-xtradb-cluster-operator/build/get-pxc-state /get-pxc-state

USER 2
3 changes: 3 additions & 0 deletions build/percona-xtradb-cluster-operator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# percona-xtradb-cluster-operator

Docker image for Percona's MySQL Operator.