Skip to content

feat: add wescale wesql cluster workflow #7

feat: add wescale wesql cluster workflow

feat: add wescale wesql cluster workflow #7

name: "Setup WeScale WeSQL Server Cluster2"
on:
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:
inputs:
wescale_image_tag:
description: "WeScale Image Tag"
required: true
default: "0.3.0"
wesql_image_tag:
description: "WeSQL Server Image Tag"
required: true
default: "8.0.35-6.alpha10.20240918.g18ad68b.27"
jobs:
setup:
name: "Setup WeScale WeSQL Server Cluster"
runs-on: macos-latest
steps:
# Step 1: Checkout the code
- name: Checkout code
uses: actions/checkout@v3
- name: Setup docker (missing on MacOS)
if: runner.os == 'macos'
run: |
brew install docker colima
colima start
- name: start minikube
id: minikube
uses: medyagh/setup-minikube@latest
with:
driver: docker
- name: kubectl
run: kubectl get pods -A
# Step 5: Create Kubernetes ConfigMap and Secret in Kind Cluster
- name: Create Secret in Kind Cluster
run: |
kubectl apply -f - <<EOF
apiVersion: v1
kind: ConfigMap
metadata:
name: wesql-server-config
data:
MYSQL_CUSTOM_CONFIG: |
[mysqld]
objectstore_provider=aws
objectstore_region=cn-northwest-1
objectstore_bucket=${{ steps.create_bucket.outputs.bucket_name }}
datadir=/data/mysql/data
log-error=/data/mysql/log/mysqld-error.log
log-bin=binlog
gtid_mode=ON
enforce_gtid_consistency=ON
log_slave_updates=ON
binlog_format=ROW
skip_name_resolve=ON
EOF
kubectl get configmap wesql-server-config --namespace default -o yaml
kubectl create secret generic wesql-server-secret \
--namespace default \
--type Opaque \
--from-literal=WESQL_OBJECTSTORE_ACCESS_KEY=${{ secrets.WESQL_OBJECTSTORE_ACCESS_KEY }} \
--from-literal=WESQL_OBJECTSTORE_SECRET_KEY=${{ secrets.WESQL_OBJECTSTORE_SECRET_KEY }} \
--from-literal=MYSQL_ROOT_PASSWORD=${{ secrets.MYSQL_ROOT_PASSWORD }}
kubectl get secret wesql-server-secret --namespace default -o yaml
# Step 6: Generate Cluster YAML File And Create Cluster
- name: Generate Cluster YAML File And Create Cluster
run: |
WESCALE_IMAGE_TAG=${{ github.event_name == 'workflow_dispatch' && github.event.inputs.wescale_image_tag || '0.3.0' }}
WESQL_SERVER_IMAGE_TAG=${{ github.event_name == 'workflow_dispatch' && github.event.inputs.wesql_image_tag || '8.0.35-6.alpha10.20240918.g18ad68b.25' }}
echo "Using Wescale Image Tag: $WESCALE_IMAGE_TAG"
echo "Using WeSQL Server Image Tag: $WESQL_SERVER_IMAGE_TAG"
sed -e "s|\${WESQL_SERVER_TAG}|$WESQL_SERVER_IMAGE_TAG|g" -e "s|\${WESCALE_TAG}|$WESCALE_IMAGE_TAG|g" cluster/wescale-standard-tag-template.yaml > cluster/wescale-standard-tag.yaml
echo "Content of wescale-standard-tag.yaml:"
cat cluster/wescale-standard-tag.yaml
echo "Creating Cluster..."
kubectl apply -f cluster/wescale-standard-tag.yaml
kubectl get pods