Skip to content

Commit

Permalink
feat: init k8s
Browse files Browse the repository at this point in the history
  • Loading branch information
earayu committed Nov 5, 2024
1 parent fc99a57 commit 72ee6c7
Show file tree
Hide file tree
Showing 2 changed files with 277 additions and 260 deletions.
65 changes: 41 additions & 24 deletions .github/workflows/wescale_wesql_performance_kind.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,28 @@ jobs:
kubectl get nodes
kubectl get pods -A
- name: Configure AWS CLI
run: |
aws configure set aws_access_key_id ${{ secrets.AWS_ACCESS_KEY_ID }}
aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws configure set default.region us-east-2
- name: Create S3 Bucket
id: create_bucket
run: |
BUCKET_NAME="wescale-$(date +'%Y%m%d%H%M%S')"
echo "Bucket name: $BUCKET_NAME"
aws s3 mb s3://$BUCKET_NAME
echo "bucket_name=$BUCKET_NAME" >> $GITHUB_OUTPUT
# Step 5: Create Kubernetes ConfigMap and Secret
- name: Create ConfigMap and Secret in Kubernetes
run: |
export WESQL_OBJECTSTORE_BUCKET=$BUCKET_NAME
export WESQL_OBJECTSTORE_REGION=us-east-2
export WESQL_OBJECTSTORE_ACCESS_KEY=${{ secrets.AWS_ACCESS_KEY_ID }}
export WESQL_OBJECTSTORE_SECRET_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }}
kubectl apply -f - <<EOF
apiVersion: v1
kind: ConfigMap
Expand All @@ -54,8 +73,10 @@ jobs:
MYSQL_CUSTOM_CONFIG: |
[mysqld]
objectstore_provider=aws
objectstore_region=cn-northwest-1
objectstore_bucket=${{ steps.create_bucket.outputs.bucket_name }}
objectstore_region=${WESQL_OBJECTSTORE_REGION}
objectstore_bucket=${WESQL_OBJECTSTORE_BUCKET}
repo_objectstore_id=sysbench
branch_objectstore_id=main
datadir=/data/mysql/data
log-error=/data/mysql/log/mysqld-error.log
log-bin=binlog
Expand All @@ -65,31 +86,27 @@ jobs:
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
--namespace default \
--type Opaque \
--from-literal=WESQL_OBJECTSTORE_ACCESS_KEY=${WESQL_OBJECTSTORE_ACCESS_KEY} \
--from-literal=WESQL_OBJECTSTORE_SECRET_KEY=${WESQL_OBJECTSTORE_SECRET_KEY} \
--from-literal=MYSQL_ROOT_PASSWORD=passwd
# 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
kubectl apply -f https://raw.githubusercontent.com/wesql/deploy/refs/heads/main/artifact/wescale-killercoda.yaml
- name: Wait for WeSQL Server to be ready
run: |
kubectl wait --for=condition=available deployment/wesql-vtgate --timeout=500s
echo "Creating Cluster..."
kubectl apply -f cluster/wescale-standard-tag.yaml
kubectl get pods
kubectl exec -it $(kubectl get pods -l app.kubernetes.io/name=wesql-vtgate -o jsonpath='{.items[0].metadata.name}') -- mysql -uroot -P15306 -ppasswd -e "SHOW DATABASES;"
- name: Clean up
if: always()
run: |
echo "Deleting bucket: ${{ steps.create_bucket.outputs.bucket_name }}"
aws s3 rm s3://${{ steps.create_bucket.outputs.bucket_name }} --recursive
aws s3 rb s3://${{ steps.create_bucket.outputs.bucket_name }}
Loading

0 comments on commit 72ee6c7

Please sign in to comment.