Skip to content

Commit

Permalink
Recreate all infra [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
kaiohenricunha authored Jan 22, 2024
2 parents 8ee0e41 + f0c9274 commit 07afc1e
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 44 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/plan-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ jobs:
- name: Configure kubectl
run: |
aws eks --region ${{ env.AWS_DEFAULT_REGION }} update-kubeconfig --name ${{ env.EKS_CLUSTER_NAME }}
if aws eks --region ${{ env.AWS_DEFAULT_REGION }} describe-cluster --name ${{ env.EKS_CLUSTER_NAME }} &>/dev/null; then
aws eks --region ${{ env.AWS_DEFAULT_REGION }} update-kubeconfig --name ${{ env.EKS_CLUSTER_NAME }}
else
echo "EKS Cluster ${{ env.EKS_CLUSTER_NAME }} does not exist."
fi
- name: Terraform Plan
run: |
Expand Down
37 changes: 17 additions & 20 deletions .github/workflows/stack-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,24 @@ jobs:
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
helm upgrade --install istio-ingressgateway istio/gateway -n istio-system -f istio-ingress.yaml --wait
- 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
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')
Expand All @@ -68,28 +78,15 @@ jobs:
- 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
# - 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
7 changes: 7 additions & 0 deletions stack/istio/istio-ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 1200m
memory: 1024Mi
4 changes: 2 additions & 2 deletions stack/istio/istiod-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ global:
cpu: 100m
memory: 128Mi
limits:
cpu: 500m
memory: 500Mi
cpu: 200m
memory: 200Mi
meshConfig:
enablePrometheusMerge: true
11 changes: 0 additions & 11 deletions stack/keda/keda-dashboard.yaml

This file was deleted.

19 changes: 17 additions & 2 deletions stack/keda/values.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
operator:
serviceMonitor:
enabled: true
replicaCount: 2
prometheus:
metricServer:
Expand All @@ -9,3 +7,20 @@ prometheus:
enabled: true
podMonitor:
enabled: true
operator:
enabled: true
serviceMonitor:
enabled: true
podMonitor:
enabled: true
webhooks:
enabled: true
serviceMonitor:
enabled: true
logging:
operator:
level: info
metricServer:
level: 0
webhooks:
level: 0
17 changes: 9 additions & 8 deletions stack/metabase/metabase-hpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ spec:
failureThreshold: 1
replicas: 1
triggers:
# - type: prometheus
# metricType: AverageValue
# metadata:
# serverAddress: http://k8s-monitori-monitori-39ad27836a-893fa56697012ddb.elb.us-east-1.amazonaws.com:9090
# metricName: istio_requests_total_keda
# query: |
# sum(istio_requests_total{destination_app="metabase"})
# threshold: "10"
- type: prometheus
metricType: AverageValue
metadata:
# serverAddress: http://k8s-monitori-monitori-258d36c54c-f8bbba58531ba4a4.elb.us-east-1.amazonaws.com/:9090
serverAddress: http://prometheus-operated.monitoring:9090
metricName: istio_requests_total
query: |
sum(istio_requests_total{destination_workload="metabase"})
threshold: "100"
- type: memory
metricType: Utilization
metadata:
Expand Down
1 change: 1 addition & 0 deletions stack/metabase/metabase-scaling-dashboard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: keda-dashboard
namespace: monitoring
labels:
grafana_dashboard: "1"
annotations:
Expand Down
7 changes: 7 additions & 0 deletions stack/monitoring/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ kubeStateMetrics:
memory: 32Mi
grafana:
enabled: true
podAnnotations:
sidecar.istio.io/inject: "true"
resources:
limits:
cpu: 100m
Expand Down Expand Up @@ -46,6 +48,11 @@ prometheus:
prometheusSpec:
replicas: 1
retention: 6h
# below parameters are necessary to be able to scrape metrics from service/pod monitors in all namespaces
serviceMonitorNamespaceSelector: {}
serviceMonitorSelectorNilUsesHelmValues: false
podMonitorNamespaceSelector: {}
podMonitorSelectorNilUsesHelmValues: false
resources:
limits:
cpu: 500m
Expand Down

0 comments on commit 07afc1e

Please sign in to comment.