Skip to content

Commit

Permalink
Merge branch 'main' into K8SPXC-1195
Browse files Browse the repository at this point in the history
  • Loading branch information
egegunes authored Dec 19, 2023
2 parents b7d4de6 + 16a4e67 commit 8608969
Show file tree
Hide file tree
Showing 117 changed files with 3,502 additions and 1,208 deletions.
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ updates:
directory: /
schedule:
interval: monthly
day: "thursday"
time: "01:00"
reviewers:
- hors
- egegunes
Expand Down Expand Up @@ -41,3 +43,5 @@ updates:
- "dependencies"
schedule:
interval: monthly
day: "thursday"
time: "01:00"
8 changes: 4 additions & 4 deletions .github/workflows/reviewdog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
with:
go-version: '^1.19'
go-version: '^1.21'
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
Expand All @@ -32,9 +32,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
with:
go-version: '^1.19'
go-version: '^1.21'
- run: go install mvdan.cc/sh/v3/cmd/shfmt@latest
- run: $(go env GOPATH)/bin/shfmt -f . | grep -v 'vendor' | xargs $(go env GOPATH)/bin/shfmt -bn -ci -s -w
- name: suggester / shfmt
Expand Down
43 changes: 39 additions & 4 deletions .github/workflows/scan.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,57 @@
name: Scan docker
on: [pull_request]

env:
# Use docker.io for Docker Hub if empty
REGISTRY: docker.io

# github.repository as <account>/<repo>
IMAGE_NAME: perconalab/percona-xtradb-cluster-operator

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build an image from Dockerfile

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build an image from Dockerfile (linux/arm64)
run: |
export IMAGE=perconalab/percona-xtradb-cluster-operator:${{ github.sha }}
export IMAGE=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}-arm64
export DOCKER_PUSH=0
export DOCKER_SQUASH=0
export DOCKER_DEFAULT_PLATFORM='linux/arm64'
./e2e-tests/build
- name: Run Trivy vulnerability scanner
- name: Run Trivy vulnerability scanner image (linux/arm64)
uses: aquasecurity/[email protected]
with:
image-ref: '${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}-arm64'
format: 'table'
exit-code: '1'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'

- name: Build an image from Dockerfile (linux/amd64)
run: |
export IMAGE=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}-amd64
export DOCKER_PUSH=0
export DOCKER_SQUASH=0
export DOCKER_DEFAULT_PLATFORM='linux/amd64'
./e2e-tests/build
- name: Run Trivy vulnerability scanner image (linux/amd64)
uses: aquasecurity/[email protected]
with:
image-ref: 'docker.io/perconalab/percona-xtradb-cluster-operator:${{ github.sha }}'
image-ref: '${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}-amd64'
format: 'table'
exit-code: '1'
ignore-unfixed: true
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ jobs:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
with:
go-version: '^1.19'
go-version: '^1.21'
- uses: actions/checkout@v4
- name: go test
run: make test
16 changes: 0 additions & 16 deletions ADOPTERS.md

This file was deleted.

5 changes: 3 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ EOF
docker login -u '${USER}' -p '${PASS}'
export RELEASE=0
export IMAGE=\$DOCKER_TAG
docker buildx create --use
./e2e-tests/build
docker logout
"
Expand All @@ -364,7 +365,7 @@ EOF
--rm \
-v $WORKSPACE/src/github.com/percona/percona-xtradb-cluster-operator:/go/src/github.com/percona/percona-xtradb-cluster-operator \
-w /go/src/github.com/percona/percona-xtradb-cluster-operator \
golang:1.19 sh -c '
golang:1.21 sh -c '
go install -mod=readonly github.com/google/go-licenses@latest;
/go/bin/go-licenses csv github.com/percona/percona-xtradb-cluster-operator/cmd/manager \
| cut -d , -f 3 \
Expand Down Expand Up @@ -393,7 +394,7 @@ EOF
-w /go/src/github.com/percona/percona-xtradb-cluster-operator \
-e GO111MODULE=on \
-e GOFLAGS='-buildvcs=false' \
golang:1.19 sh -c 'go build -v -o percona-xtradb-cluster-operator github.com/percona/percona-xtradb-cluster-operator/cmd/manager'
golang:1.21 sh -c 'go build -v -o percona-xtradb-cluster-operator github.com/percona/percona-xtradb-cluster-operator/cmd/manager'
"
'''

Expand Down
14 changes: 0 additions & 14 deletions adopters/example/README.md

This file was deleted.

15 changes: 0 additions & 15 deletions adopters/leviatan/README.md

This file was deleted.

33 changes: 0 additions & 33 deletions adopters/users/laimison/README.md

This file was deleted.

13 changes: 0 additions & 13 deletions adopters/users/spron-in/README.md

This file was deleted.

5 changes: 2 additions & 3 deletions build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.19 AS go_builder
FROM golang:1.21 AS go_builder
WORKDIR /go/src/github.com/percona/percona-xtradb-cluster-operator

COPY . .
Expand All @@ -8,12 +8,11 @@ ARG GIT_BRANCH
ARG BUILD_TIME
ARG GO_LDFLAGS
ARG GOOS=linux
ARG GOARCH=amd64
ARG CGO_ENABLED=0

RUN go mod download \
&& mkdir -p build/_output/bin \
&& GOOS=$GOOS GOARCH=$GOARCH CGO_ENABLED=$CGO_ENABLED GO_LDFLAGS=$GO_LDFLAGS \
&& GOOS=$GOOS CGO_ENABLED=$CGO_ENABLED GO_LDFLAGS=$GO_LDFLAGS \
go build -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 \
Expand Down
8 changes: 0 additions & 8 deletions build/pxc-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ else
fi

file_env 'XTRABACKUP_PASSWORD' 'xtrabackup' 'xtrabackup'
file_env 'CLUSTERCHECK_PASSWORD' '' 'clustercheck'

NODE_NAME=$(hostname -f)
NODE_PORT=3306
Expand Down Expand Up @@ -269,9 +268,6 @@ elif [ -n "$DISCOVERY_SERVICE" ]; then
{ set +x; } 2>/dev/null
sed -r "s|^[#]?wsrep_sst_auth=.*$|wsrep_sst_auth='xtrabackup:${XTRABACKUP_PASSWORD}'|" "${CFG}" 1<>"${CFG}"

/usr/bin/clustercheckcron clustercheck "${CLUSTERCHECK_PASSWORD}" 1 /var/lib/mysql/clustercheck.log 1 &
set -x

else
: checking incoming cluster parameters
NODE_IP=$(hostname -I | awk ' { print $1 } ')
Expand Down Expand Up @@ -396,7 +392,6 @@ if [ -z "$CLUSTER_JOIN" ] && [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then
if [[ $MYSQL_VERSION == "8.0" ]] && ((MYSQL_PATCH_VERSION >= 16)); then
read -r -d '' systemUserGrant <<-EOSQL || true
GRANT SYSTEM_USER ON *.* TO 'monitor'@'${MONITOR_HOST}';
GRANT SYSTEM_USER ON *.* TO 'clustercheck'@'localhost';
EOSQL
fi

Expand All @@ -422,9 +417,6 @@ if [ -z "$CLUSTER_JOIN" ] && [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then
GRANT SELECT ON performance_schema.* TO 'monitor'@'${MONITOR_HOST}';
${monitorConnectGrant}
CREATE USER 'clustercheck'@'localhost' IDENTIFIED BY '$(escape_special "${CLUSTERCHECK_PASSWORD}")' PASSWORD EXPIRE NEVER;
GRANT PROCESS ON *.* TO 'clustercheck'@'localhost';
${systemUserGrant}
CREATE USER 'replication'@'%' IDENTIFIED BY '$(escape_special "${REPLICATION_PASSWORD}")' PASSWORD EXPIRE NEVER;
Expand Down
22 changes: 15 additions & 7 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import (
"sigs.k8s.io/controller-runtime/pkg/cache"
"sigs.k8s.io/controller-runtime/pkg/healthz"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
metricsServer "sigs.k8s.io/controller-runtime/pkg/metrics/server"
ctrlWebhook "sigs.k8s.io/controller-runtime/pkg/webhook"

_ "github.com/Percona-Lab/percona-version-service/api"
"github.com/percona/percona-xtradb-cluster-operator/pkg/apis"
Expand Down Expand Up @@ -84,19 +86,25 @@ func main() {
}

options := ctrl.Options{
Scheme: scheme,
MetricsBindAddress: metricsAddr,
Port: 9443,
Scheme: scheme,
Metrics: metricsServer.Options{
BindAddress: metricsAddr,
},
HealthProbeBindAddress: probeAddr,
LeaderElection: enableLeaderElection,
LeaderElectionID: "08db1feb.percona.com",
Namespace: namespace,
LeaderElectionID: "08db0feb.percona.com",
WebhookServer: ctrlWebhook.NewServer(ctrlWebhook.Options{
Port: 9443,
}),
}

// Add support for MultiNamespace set in WATCH_NAMESPACE
if len(namespace) > 0 {
options.Namespace = ""
options.NewCache = cache.MultiNamespacedCacheBuilder(append(strings.Split(namespace, ","), operatorNamespace))
namespaces := make(map[string]cache.Config)
for _, ns := range append(strings.Split(namespace, ","), operatorNamespace) {
namespaces[ns] = cache.Config{}
}
options.Cache.DefaultNamespaces = namespaces
}

// Get a config to talk to the apiserver
Expand Down
Loading

0 comments on commit 8608969

Please sign in to comment.