Skip to content

kubectl verification #45

kubectl verification

kubectl verification #45

name: Verify Public Artifacts
on:
workflow_dispatch:
inputs:
deploy_with:
type: choice
description: 'Select the deployment method'
required: true
options: ['helm', 'olm', 'kubectl']
default: 'helm'
expected_operator_version:
description: 'The expected operator version to deploy (e.g. 1.5.0)'
required: true
expected_server_version:
description: 'The expected server version to deploy (e.g. 11.1.1-0)'
required: true
run-name: ${{ inputs.deploy_with }} verification
jobs:
verify-public-artifact:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: ./.github/actions/setup-go
- name: Download kind
run: |
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.14.0/kind-linux-amd64
chmod +x ./kind
sudo mv ./kind /usr/local/bin
- name: Install kubectl
uses: ./.github/actions/setup-kubectl
- name: Create kind cluster
run: |
cat << EOF > kind.yaml
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
- role: worker
extraPortMappings:
- containerPort: 32001
hostPort: 32001
- role: worker
EOF
kind create cluster --config kind.yaml
- name: Deploy the verticadb operator with olm
if: github.event.inputs.deploy_with == 'olm'
run: |
curl -sL https://github.com/operator-framework/operator-lifecycle-manager/releases/download/v0.26.0/install.sh | bash -s v0.26.0
kubectl create -f https://operatorhub.io/install/verticadb-operator.yaml
echo "Waiting for verticadb-operator CSV to be created..."
timeout 5m bash -c -- "while ! kubectl get csv | grep 'VerticaDB Operator' | grep -cq Succeeded; do sleep 5; done"
echo "DONE!"
kubectl create namespace verticadb-operator
- name: Deploy the verticadb operator with helm
if: github.event.inputs.deploy_with == 'helm'
run: |
helm repo add vertica-charts https://vertica.github.io/charts
helm repo update vertica-charts
helm install vdb-op --wait --namespace verticadb-operator --create-namespace vertica-charts/verticadb-operator
- name: Deploy the verticadb operator with kubectl
if: github.event.inputs.deploy_with == 'kubectl'
run: |
kubectl apply --server-side=true --force-conflicts -f https://github.com/vertica/vertica-kubernetes/releases/latest/download/crds.yaml
kubectl apply -f https://github.com/vertica/vertica-kubernetes/releases/latest/download/operator.yaml
- name: Install krew
run: |
make krew
echo "${KREW_ROOT:-$HOME/.krew}/bin" >> $GITHUB_PATH
- name: Deploy the minio operator
run: |
scripts/setup-minio.sh -o
- name: Install the minio Tenant
run: |
kubectl apply --namespace verticadb-operator -f config/samples/minio.yaml
kubectl wait --for=condition=Complete=True --namespace verticadb-operator job/create-s3-bucket --timeout=5m
- name: Create a VerticaDB CR
run: |
kubectl apply --namespace verticadb-operator -f config/samples/verticadb_sample.yaml
kubectl wait --for=condition=DBInitialized=True --namespace verticadb-operator vdb/verticadb-sample --timeout=10m
kubectl get pods --namespace verticadb-operator --selector app.kubernetes.io/instance=verticadb-sample
- name: Dump the vertica server version
run: |
kubectl exec -it --namespace verticadb-operator verticadb-sample-defaultsubcluster-0 -- vsql -c "select version();"
- name: Dump the labels/annotations of the vertica pods
run: |
kubectl get pods --namespace verticadb-operator --selector app.kubernetes.io/instance=verticadb-sample -o=jsonpath='{range .items[*]}{.metadata.name}{"\n"}{.metadata.labels}{"\n"}{.metadata.annotations}{"\n"}{"\n"}{end}'
- name: Verify the operator version
run: |
kubectl get pods --namespace verticadb-operator --selector app.kubernetes.io/version=${{ github.event.inputs.expected_operator_version }} | grep -cq 'verticadb-sample-defaultsubcluster'
- name: Verify the server version
run: |
kubectl exec -it --namespace verticadb-operator verticadb-sample-defaultsubcluster-0 -- vsql -c "select 1 where version() = 'Vertica Analytic Database v${{ github.event.inputs.expected_server_version }}';" | grep -cq '(1 row)'