Skip to content

EVEREST-1618: affinity per component #2193

EVEREST-1618: affinity per component

EVEREST-1618: affinity per component #2193

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
golang-tests:
name: Go unit tests
timeout-minutes: 30
strategy:
fail-fast: true
runs-on: ubuntu-latest
env:
TOOLS_PATH: "/opt/tools/bin"
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Set up Go release
uses: actions/setup-go@v5
with:
go-version: '1.22'
check-latest: true
- name: Install tools
run: |
mkdir -p $TOOLS_PATH
echo $TOOLS_PATH >> $GITHUB_PATH
curl -LO https://dl.k8s.io/release/v$KUBECTL_VERSION/bin/linux/amd64/kubectl
curl -LO "https://dl.k8s.io/v$KUBECTL_VERSION/bin/linux/amd64/kubectl.sha256"
echo "$(cat kubectl.sha256) kubectl" | sha256sum --check
chmod +x kubectl
cp kubectl "$TOOLS_PATH"
rm kubectl
env:
KUBECTL_VERSION: 1.27.9
- name: Run tests
run:
make test
env:
PXC_OPERATOR_VERSION: 1.15.0
PSMDB_OPERATOR_VERSION: 1.18.0
PG_OPERATOR_VERSION: 2.5.0
PERCONA_VERSION_SERVICE_URL: https://check-dev.percona.com/versions/v1
eks-e2e-tests:
name: E2E tests (EKS)
timeout-minutes: 80
concurrency: eks-e2e-tests
strategy:
fail-fast: true
runs-on: ubuntu-latest
env:
TOOLS_PATH: "/opt/tools/bin"
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Set up Go release
uses: actions/setup-go@v5
with:
go-version: '1.22'
check-latest: true
- name: Build operator
run:
make build
- name: Configure AWS
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.EVEREST_EKS_E2E_IAM_USER_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.EVEREST_EKS_E2E_IAM_USER_ACCESS_KEY_SECRET }}
aws-region: us-east-2
- name: Configure env
run: |
mkdir -p $TOOLS_PATH
echo $TOOLS_PATH >> $GITHUB_PATH
aws eks update-kubeconfig --name everest-e2e-dev-eks-cluster
- name: Install tools
run: |
# Kubectl
curl -LO https://dl.k8s.io/release/v$KUBECTL_VERSION/bin/linux/amd64/kubectl
curl -LO "https://dl.k8s.io/v$KUBECTL_VERSION/bin/linux/amd64/kubectl.sha256"
echo "$(cat kubectl.sha256) kubectl" | sha256sum --check
chmod +x kubectl
cp kubectl "$TOOLS_PATH"
rm kubectl
# Kuttl
curl -Lo ./kubectl-kuttl https://github.com/kudobuilder/kuttl/releases/download/v0.15.0/kubectl-kuttl_0.15.0_linux_x86_64
chmod +x ./kubectl-kuttl
mv ./kubectl-kuttl "$TOOLS_PATH"
# kubectl
curl -LO https://dl.k8s.io/release/v$KUBECTL_VERSION/bin/linux/amd64/kubectl
curl -LO "https://dl.k8s.io/v$KUBECTL_VERSION/bin/linux/amd64/kubectl.sha256"
echo "$(cat kubectl.sha256) kubectl" | sha256sum --check
chmod +x kubectl
cp kubectl "$TOOLS_PATH"
rm kubectl
# Install EKSCTL
ARCH=amd64
PLATFORM=$(uname -s)_$ARCH
curl -sLO "https://github.com/eksctl-io/eksctl/releases/latest/download/eksctl_$PLATFORM.tar.gz"
tar -xzf eksctl_$PLATFORM.tar.gz -C "$TOOLS_PATH"
chmod +x "$TOOLS_PATH"/eksctl
env:
KUBECTL_VERSION: 1.27.9
- name: Scale up cluster
run: |
eksctl scale nodegroup --cluster="$CLUSTER_NAME" --nodes=10 "$NODEPOOL_NAME" --wait
env:
CLUSTER_NAME: "everest-e2e-dev-eks-cluster"
NODEPOOL_NAME: "everest-e2e-dev-eks-workers"
- name: Run upgrade tests
run: |
kubectl kuttl test --config ./tests/e2e/kuttl-upgrade.yaml
env:
PXC_OPERATOR_VERSION: 1.15.0
PSMDB_OPERATOR_VERSION: 1.18.0
PG_OPERATOR_VERSION: 2.5.0
PREVIOUS_PG_OPERATOR_VERSION: 2.4.1
PREVIOUS_PXC_OPERATOR_VERSION: 1.14.0
PREVIOUS_PSMDB_OPERATOR_VERSION: 1.17.0
PERCONA_VERSION_SERVICE_URL: https://check-dev.percona.com/versions/v1
- name: Clean up custom resources
if: always()
continue-on-error: true
# If this does not finish in 10 minutes, it's stuck with some resource having a finalizer.
timeout-minutes: 10
run: |
namespaces=$(kubectl get pxc -A -o jsonpath='{.items[*].metadata.namespace}')
for namespace in ${namespaces[@]}
do
kubectl -n $namespace get pxc -o name | awk -F '/' {'print $2'} | xargs --no-run-if-empty kubectl patch pxc -n $namespace -p '{"metadata":{"finalizers":null}}' --type merge
done
namespaces=$(kubectl get psmdb -A -o jsonpath='{.items[*].metadata.namespace}')
for namespace in ${namespaces[@]}
do
kubectl -n $namespace get psmdb -o name | awk -F '/' {'print $2'} | xargs --no-run-if-empty kubectl patch psmdb -n $namespace -p '{"metadata":{"finalizers":null}}' --type merge
done
namespaces=$(kubectl get pg -A -o jsonpath='{.items[*].metadata.namespace}')
for namespace in ${namespaces[@]}
do
kubectl -n $namespace get pg -o name | awk -F '/' {'print $2'} | xargs --no-run-if-empty kubectl patch pg -n $namespace -p '{"metadata":{"finalizers":null}}' --type merge
done
namespaces=$(kubectl get db -A -o jsonpath='{.items[*].metadata.namespace}')
for namespace in ${namespaces[@]}
do
kubectl -n $namespace get db -o name | awk -F '/' {'print $2'} | xargs --no-run-if-empty kubectl patch db -n $namespace -p '{"metadata":{"finalizers":null}}' --type merge
done
kubectl delete db --all-namespaces --all --cascade=foreground
kubectl delete pvc --all-namespaces --all
kubectl delete backupstorage --all-namespaces --all
kubectl get ns -o name | grep kuttl | awk -F '/' {'print $2'} | xargs --no-run-if-empty kubectl delete ns
- name: Run core tests
if: always()
run: |
kubectl kuttl test --config ./tests/e2e/kuttl-core.yaml
env:
PXC_OPERATOR_VERSION: 1.15.0
PSMDB_OPERATOR_VERSION: 1.18.0
PG_OPERATOR_VERSION: 2.5.0
PERCONA_VERSION_SERVICE_URL: https://check-dev.percona.com/versions/v1
- name: Run features tests
if: always()
run: |
kubectl kuttl test --config ./tests/integration/kuttl-features.yaml
env:
PXC_OPERATOR_VERSION: 1.15.0
PSMDB_OPERATOR_VERSION: 1.18.0
PG_OPERATOR_VERSION: 2.5.0
PREVIOUS_PG_OPERATOR_VERSION: 2.4.1
PREVIOUS_PXC_OPERATOR_VERSION: 1.14.0
PREVIOUS_PSMDB_OPERATOR_VERSION: 1.17.0
PERCONA_VERSION_SERVICE_URL: https://check-dev.percona.com/versions/v1
EVEREST_CATALOG_VERSION: 1.0.1
OLM_VERSION: 0.27.0
- name: Clean up custom resources
if: always()
run: |
namespaces=$(kubectl get pxc -A -o jsonpath='{.items[*].metadata.namespace}')
for namespace in ${namespaces[@]}
do
kubectl -n $namespace get pxc -o name | awk -F '/' {'print $2'} | xargs --no-run-if-empty kubectl patch pxc -n $namespace -p '{"metadata":{"finalizers":null}}' --type merge
done
namespaces=$(kubectl get psmdb -A -o jsonpath='{.items[*].metadata.namespace}')
for namespace in ${namespaces[@]}
do
kubectl -n $namespace get psmdb -o name | awk -F '/' {'print $2'} | xargs --no-run-if-empty kubectl patch psmdb -n $namespace -p '{"metadata":{"finalizers":null}}' --type merge
done
namespaces=$(kubectl get pg -A -o jsonpath='{.items[*].metadata.namespace}')
for namespace in ${namespaces[@]}
do
kubectl -n $namespace get pg -o name | awk -F '/' {'print $2'} | xargs --no-run-if-empty kubectl patch pg -n $namespace -p '{"metadata":{"finalizers":null}}' --type merge
done
namespaces=$(kubectl get db -A -o jsonpath='{.items[*].metadata.namespace}')
for namespace in ${namespaces[@]}
do
kubectl -n $namespace get db -o name | awk -F '/' {'print $2'} | xargs --no-run-if-empty kubectl patch db -n $namespace -p '{"metadata":{"finalizers":null}}' --type merge
done
kubectl delete db --all-namespaces --all --cascade=foreground
kubectl delete pvc --all-namespaces --all
kubectl delete backupstorage --all-namespaces --all
kubectl get ns -o name | grep kuttl | awk -F '/' {'print $2'} | xargs --no-run-if-empty kubectl delete ns
kubectl delete ns operators olm --ignore-not-found=true --wait=false
sleep 10
kubectl delete apiservice v1.packages.operators.coreos.com --ignore-not-found=true
kubectl get crd -o name | grep .coreos.com$ | awk -F '/' {'print $2'} | xargs --no-run-if-empty kubectl delete crd
- name: Scale down cluster
if: always()
run: |
eksctl scale nodegroup --cluster="$CLUSTER_NAME" --nodes=0 "$NODEPOOL_NAME"
env:
CLUSTER_NAME: "everest-e2e-dev-eks-cluster"
NODEPOOL_NAME: "everest-e2e-dev-eks-workers"
- name: Clean up resources and CRDs
if: always()
run: |
kubectl get crd -o name | grep .percona.com$ | awk -F '/' {'print $2'} | xargs --no-run-if-empty kubectl delete crd
kubectl delete crd postgresclusters.postgres-operator.crunchydata.com
make-bundle:
name: Make Bundle
strategy:
fail-fast: true
runs-on: ubuntu-latest
env:
TOOLS_PATH: "/opt/tools/bin"
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Go release
uses: actions/setup-go@v5
with:
go-version: '1.22'
check-latest: true
- name: Install operator-sdk
run: |
mkdir -p $TOOLS_PATH
echo $TOOLS_PATH >> $GITHUB_PATH
export ARCH=$(case $(uname -m) in x86_64) echo -n amd64 ;; aarch64) echo -n arm64 ;; *) echo -n $(uname -m) ;; esac)
export OS=$(uname | awk '{print tolower($0)}')
export OPERATOR_SDK_DL_URL=https://github.com/operator-framework/operator-sdk/releases/download/v1.38.0
curl -LO ${OPERATOR_SDK_DL_URL}/operator-sdk_${OS}_${ARCH}
gpg --keyserver keyserver.ubuntu.com --recv-keys 052996E2A20B5C7E
curl -LO ${OPERATOR_SDK_DL_URL}/checksums.txt
curl -LO ${OPERATOR_SDK_DL_URL}/checksums.txt.asc
gpg -u "Operator SDK (release) <[email protected]>" --verify checksums.txt.asc
grep operator-sdk_${OS}_${ARCH} checksums.txt | sha256sum -c -
chmod +x operator-sdk_${OS}_${ARCH}
mv operator-sdk_${OS}_${ARCH} $TOOLS_PATH/operator-sdk
- name: Make bundle and build bundle image
run: |
make bundle bundle-build