-
Notifications
You must be signed in to change notification settings - Fork 0
176 lines (151 loc) · 5.84 KB
/
performance.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
name: Setup DigitalOcean K8s Cluster
on:
workflow_dispatch:
inputs:
CLUSTER_NAME:
description: 'Name of the Kubernetes cluster'
type: string
default: 'perfo-cluster'
required: true
NODE_SIZE:
description: 'Size of the nodes'
options:
- s-2vcpu-2gb
- s-4vcpu-8gb
- s-8vcpu-16gb
- s-16vcpu-32gb
type: choice
default: s-8vcpu-16gb
required: true
NODE_COUNT:
description: 'Number of nodes'
type: number
default: 4
required: true
DURATION_TIME:
description: 'How long to run before collecting metrics'
type: number
default: 10
required: true
KUBERNETES_VERSION:
description: 'Kubernetes version to use'
type: string
required: false
# ACCOUNT_ID:
# description: 'Your account ID'
# type: string
# required: true
# ACCESS_KEY:
# description: 'Your access key'
# type: string
# required: true
STORAGE_VERSION:
description: 'storage version'
type: string
required: false
NODE_AGENT_VERSION:
description: 'node agent version'
type: string
required: false
ENABLE_KDR:
description: 'Enable KDR'
required: false
type: boolean
default: false
PRIVATE_NODE_AGENT:
description: 'Private node agent version'
required: false
type: string
HELM_GIT_BRANCH:
description: 'Helm chart branch (e.g., main)'
required: false
type: string
jobs:
setup-cluster:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install kubectl
run: |
sudo snap install kubectl --classic
kubectl version --client --output=yaml
- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DIGITALOCEAN_TOKEN }}
- name: Create Kubernetes Cluster
run: |
CMD="doctl kubernetes cluster create ${{ github.event.inputs.CLUSTER_NAME }} \
--region fra1 \
--vpc-uuid 7ff72b70-98a3-4743-9e83-2f0131047d39 \
--node-pool \"name=default-pool;size=${{ github.event.inputs.NODE_SIZE }};count=${{ github.event.inputs.NODE_COUNT }}\" \
--tag \"helmTest\" \
--wait"
if [ ! -z "${{ github.event.inputs.KUBERNETES_VERSION }}" ]; then
CMD="$CMD --version ${{ github.event.inputs.KUBERNETES_VERSION }}"
fi
echo "Running command: $CMD"
eval $CMD
- name: Configure kubectl
run: |
doctl kubernetes cluster kubeconfig save ${{ github.event.inputs.CLUSTER_NAME }}
kubectl config set-context $(kubectl config current-context) --namespace=default
- name: Connect to the cluster
run: |
CLUSTER_ID=$(doctl kubernetes cluster get ${{ github.event.inputs.CLUSTER_NAME }} --format ID --no-header)
doctl kubernetes cluster kubeconfig save $CLUSTER_ID
- name: Run performance Test
env:
QUAYIO_REGISTRY_PASSWORD: ${{ secrets.QUAYIO_REGISTRY_PASSWORD }}
QUAYIO_REGISTRY_USERNAME: ${{ secrets.QUAYIO_REGISTRY_USERNAME }}
PERFO_GITHUB_TOKEN: ${{ secrets.PERFO_GITHUB_TOKEN }}
ACCOUNT_ID: ${{ secrets.PERFO_ACCOUNT_ID }}
ACCESS_KEY: ${{ secrets.PERFO_ACCESS_KEY }}
run: |
CMD="python performance.py -skip-cluster -nodes ${{ github.event.inputs.NODE_COUNT }} -account $ACCOUNT_ID -accessKey $ACCESS_KEY"
if [ ! -z "${{ github.event.inputs.STORAGE_VERSION }}" ]; then
CMD="$CMD -storage-version ${{ github.event.inputs.STORAGE_VERSION }}"
fi
if [ ! -z "${{ github.event.inputs.NODE_AGENT_VERSION }}" ]; then
CMD="$CMD -node-agent-version ${{ github.event.inputs.NODE_AGENT_VERSION }}"
fi
if [ "${{ github.event.inputs.ENABLE_KDR }}" == "true" ]; then
CMD="$CMD -kdr"
fi
if [ ! -z "${{ github.event.inputs.PRIVATE_NODE_AGENT }}" ]; then
CMD="$CMD -private-node-agent ${{ github.event.inputs.PRIVATE_NODE_AGENT }}"
fi
if [ ! -z "${{ github.event.inputs.HELM_GIT_BRANCH }}" ]; then
CMD="$CMD -helm-git-branch ${{ github.event.inputs.HELM_GIT_BRANCH }}"
fi
echo "Running command: $CMD"
eval $CMD
- name: Create RBAC
run: |
kubectl apply -f admin-role-binding.yaml
- name: Create Git Auth Secret
run: |
# Create base64 encoded token
echo -n "${{ secrets.PERFO_GITHUB_TOKEN }}" | base64 > token.b64
# Create the secret
kubectl create namespace default --dry-run=client -o yaml | kubectl apply -f -
kubectl create secret generic git-auth \
--namespace=default \
--from-file=token=token.b64 \
--dry-run=client -o yaml | kubectl apply -f -
- name: Create Webhook Secret
run: |
kubectl create secret generic perf-channel-webhook \
--namespace=default \
--from-literal=url=${{ secrets.PERFO_CHANNEL_WEBHOOK_URL }} \
--dry-run=client -o yaml | kubectl apply -f -
- name: Deploy the Collect Metrics Job
run: |
# Replace variables in the job yaml
TIMESTAMP=$(date +%Y%m%d-%H%M%S)
cat collect-metrics-job.yaml | \
sed "s/\$(DATE)/$TIMESTAMP/" | \
sed "s/\$(DURATION_TIME)/${{ github.event.inputs.DURATION_TIME }}/" | \
kubectl apply -f -
echo "Metrics collection job deployed with duration: ${{ github.event.inputs.DURATION_TIME }} minutes"