Setup DigitalOcean K8s Cluster #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Performance Test | |
on: | |
workflow_dispatch: | |
inputs: | |
NODE_SIZE: | |
description: 'Size of the nodes' | |
options: | |
- s-2vcpu-2gb | |
- s-4vcpu-8gb | |
- s-8vcpu-16gb | |
- s-16vcpu-32gb | |
type: choice | |
default: s-4vcpu-8gb | |
required: true | |
NODE_COUNT: | |
description: 'Number of nodes' | |
type: number | |
default: 3 | |
required: true | |
K8S_VERSION: | |
description: 'K8s version' | |
type: number | |
default: 1.31 | |
required: true | |
ACCOUNT_ID: | |
description: 'Your account ID' | |
type: string | |
required: true | |
ACCESS_KEY: | |
description: 'Your access key' | |
type: string | |
required: true | |
jobs: | |
setup-cluster: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Install Terraform CLI | |
run: | | |
sudo apt-get update -y | |
sudo apt-get install -y gnupg software-properties-common curl | |
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg | |
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list | |
sudo apt-get update -y && sudo apt-get install -y terraform | |
- name: Install kubectl | |
run: | | |
sudo snap install kubectl --classic | |
kubectl version --client --output=yaml | |
- name: Install doctl | |
run: | | |
sudo snap install doctl | |
doctl version | |
- name: Set up DigitalOcean Token | |
run: | | |
mkdir -p ~/.do | |
echo "${{ secrets.DIGITALOCEAN_TOKEN }}" > ~/.do/devops_token | |
- name: Initialize Terraform | |
run: | | |
cd terraform-test-clusters/DOKS | |
terraform init | |
- name: Create Terraform Variables File | |
run: | | |
cat <<EOF > terraform.tfvars | |
node_size = "${{ github.event.inputs.NODE_SIZE }}" | |
node_count = ${${{ github.event.inputs.NODE_COUNT }}} | |
EOF | |
- name: Validate Terraform Configuration | |
run: terraform validate | |
- name: Plan Terraform Changes | |
run: terraform plan -var-file=terraform.tfvars -out=tfplan | |
- name: Apply Terraform Configuration | |
run: terraform apply -auto-approve tfplan | |
- name: Clean up Terraform Plan | |
run: rm -f tfplan | |
- name: Run performance Test | |
run: | | |
python performance.py -skip-cluster -nodes ${{ github.event.inputs.NODE_SIZE }} -account ${{ github.event.inputs.ACCOUNT_ID }} -access ${{ github.event.inputs.ACCESS_KEY }} |