-
Notifications
You must be signed in to change notification settings - Fork 1
91 lines (78 loc) · 3.72 KB
/
stack-workflow.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
name: Cluster Stack Management
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: 'us-east-1'
EKS_CLUSTER_NAME: 'metabaselab'
RDS_PASSWORD: ${{ secrets.RDS_PASSWORD }}
on:
workflow_dispatch:
inputs:
components:
description: 'Comma-separated list of components to apply (e.g., istio,metabase)'
required: true
default: 'keda,metrics-server,monitoring,metabase,istio'
jobs:
helm:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: Update kube config
run: aws eks update-kubeconfig --name $EKS_CLUSTER_NAME --region $AWS_DEFAULT_REGION
- name: Set up Helm
uses: azure/setup-helm@v1
with:
version: 'v3.13.3'
- name: Install metrics-server
if: contains(github.event.inputs.components, 'metrics-server')
run: |
kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/high-availability-1.21+.yaml
- name: Helm install kube-prometheus-stack(monitoring)
if: contains(github.event.inputs.components, 'monitoring')
run: |
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
cd stack/monitoring
helm upgrade --install monitoring prometheus-community/kube-prometheus-stack --namespace monitoring -f values.yaml --create-namespace
- name: Helm install Istio
if: contains(github.event.inputs.components, 'istio')
run: |
helm repo add istio https://istio-release.storage.googleapis.com/charts
helm repo update
cd stack/istio
helm upgrade --install istio-base istio/base -n istio-system --create-namespace --set defaultRevision=default
helm upgrade --install istiod istio/istiod -n istio-system -f istiod-values.yaml --wait
kubectl apply -f pod-monitor.yaml && kubectl apply -f service-monitor.yaml
- name: Helm install KEDA
if: contains(github.event.inputs.components, 'keda')
run: |
helm repo add kedacore https://kedacore.github.io/charts
helm repo update
cd stack/keda
helm upgrade --install keda kedacore/keda --namespace keda -f values.yaml --create-namespace
- name: Fetch RDS Endpoint for Metabase
if: contains(github.event.inputs.components, 'metabase')
run: |
RDS_ENDPOINT=$(aws rds describe-db-instances --db-instance-identifier metabaselab --query 'DBInstances[0].Endpoint.Address' --output text)
echo "RDS_ENDPOINT=$RDS_ENDPOINT" >> $GITHUB_ENV
- name: Helm install Metabase
if: contains(github.event.inputs.components, 'metabase')
run: |
if ! kubectl get namespace metabase; then
kubectl create namespace metabase
kubectl label namespace metabase istio-injection=enabled
fi
helm repo add pmint93 https://pmint93.github.io/helm-charts
helm repo update
cd stack/metabase
helm upgrade --install metabase pmint93/metabase --namespace metabase -f values.yaml --create-namespace \
--set database.host="$RDS_ENDPOINT" \
--set database.password="${{ secrets.RDS_PASSWORD }}"
kubectl apply -f metabase-hpa.yaml && kubectl apply -f metabase-scaling-dashboard.yaml