Cluster Stack Management #49
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: 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' | |
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 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- | |
kubectl apply -f keda-dashboard.yaml | |
- 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: | | |
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 | |
# - name: Istio Injection | |
# if: contains(github.event.inputs.components, 'istio') && contains(github.event.inputs.components, 'metabase') || contains(github.event.inputs.components, 'istio') && contains(github.event.inputs.components, 'keda') | |
# run: | | |
# kubectl label namespace metabase istio-injection=enabled --overwrite | |
# kubectl rollout restart deployment -n metabase | |
# kubectl label namespace keda istio-injection=enabled --overwrite | |
# kubectl rollout restart deployment -n keda | |
# - 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 |