Skip to content

Commit 0a2f16b

Browse files
committed
Add monitoring stack for Grafana and Prometheus; remove unused ServiceMonitor template
1 parent f0500c6 commit 0a2f16b

File tree

3 files changed

+44
-46
lines changed

3 files changed

+44
-46
lines changed

.github/workflows/terraform.yml

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
name: Terraform Infrastructure
2-
32
on:
43
workflow_dispatch:
54
workflow_call:
@@ -13,7 +12,6 @@ on:
1312
terraform-result:
1413
description: "Terraform execution result"
1514
value: ${{ jobs.terraform.outputs.result }}
16-
1715
jobs:
1816
terraform:
1917
name: Terraform Deployment
@@ -25,27 +23,22 @@ jobs:
2523
steps:
2624
- name: Checkout Repository
2725
uses: actions/checkout@v5
28-
2926
- name: Login to AWS
3027
uses: aws-actions/[email protected]
3128
with:
3229
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
3330
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
3431
aws-region: us-east-1
35-
3632
- name: Setup Terraform
3733
uses: hashicorp/[email protected]
3834
with:
3935
terraform_version: 1.5.7
40-
4136
- name: Terraform Init
4237
run: terraform init
4338
working-directory: ./Terraform
44-
4539
- name: Terraform Plan
4640
run: terraform plan
4741
working-directory: ./Terraform
48-
4942
- name: Terraform Apply
5043
id: terraform-apply
5144
if: ${{ inputs.terraform-action == 'apply' || inputs.terraform-action == '' }}
@@ -59,19 +52,16 @@ jobs:
5952
if: ${{ inputs.terraform-action == 'apply' || inputs.terraform-action == '' }}
6053
run: |
6154
aws eks update-kubeconfig --name otel-cluster --region us-east-1
62-
6355
- name: Install Helm
6456
if: ${{ inputs.terraform-action == 'apply' || inputs.terraform-action == '' }}
6557
uses: azure/[email protected]
6658
with:
6759
version: v3.14.0
68-
6960
- name: Add ArgoCD Helm Repo
7061
if: ${{ inputs.terraform-action == 'apply' || inputs.terraform-action == '' }}
7162
run: |
7263
helm repo add argo https://argoproj.github.io/argo-helm
7364
helm repo update
74-
7565
- name: Install/Upgrade ArgoCD
7666
if: ${{ inputs.terraform-action == 'apply' || inputs.terraform-action == '' }}
7767
run: |
@@ -81,24 +71,16 @@ jobs:
8171
--set server.service.type=LoadBalancer \
8272
--wait
8373
84-
# ---------------------------
85-
# Get ArgoCD Server URL
86-
# ---------------------------
87-
- name: Get ArgoCD URL
74+
- name: Create Grafana Secret
8875
if: ${{ inputs.terraform-action == 'apply' || inputs.terraform-action == '' }}
8976
run: |
90-
echo "Waiting for ArgoCD LoadBalancer..."
91-
kubectl wait --for=condition=available deployment/argocd-server -n argocd --timeout=300s || true
92-
93-
ARGOCD_URL=$(kubectl get svc argocd-server -n argocd -o jsonpath='{.status.loadBalancer.ingress[0].hostname}')
94-
if [ -z "$ARGOCD_URL" ]; then
95-
ARGOCD_URL=$(kubectl get svc argocd-server -n argocd -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
96-
fi
97-
98-
echo "ArgoCD URL: http://$ARGOCD_URL"
77+
kubectl create namespace monitoring --dry-run=client -o yaml | kubectl apply -f -
78+
kubectl create secret generic grafana-admin-secret \
79+
--from-literal=admin-password='${{ secrets.GRAFANA_ADMIN_PASSWORD }}' \
80+
--namespace monitoring \
81+
--dry-run=client -o yaml | kubectl apply -f -
9982
100-
PASS=$(kubectl get secret argocd-initial-admin-secret -n argocd -o jsonpath="{.data.password}" | base64 --decode)
101-
echo "username=admin"
102-
echo "password=$PASS"
103-
104-
83+
- name: Deploy Monitoring
84+
if: ${{ inputs.terraform-action == 'apply' || inputs.terraform-action == '' }}
85+
run: |
86+
kubectl apply -f ./argocd/monitoring-stack.yaml

argocd/monitoring.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
apiVersion: argoproj.io/v1alpha1
2+
kind: Application
3+
metadata:
4+
name: kube-prometheus-stack
5+
namespace: argocd
6+
spec:
7+
project: default
8+
source:
9+
repoURL: https://prometheus-community.github.io/helm-charts
10+
chart: kube-prometheus-stack
11+
targetRevision: "45.7.1"
12+
helm:
13+
values: |
14+
prometheus:
15+
service:
16+
type: LoadBalancer
17+
grafana:
18+
service:
19+
type: LoadBalancer
20+
admin:
21+
existingSecret: grafana-admin-secret
22+
passwordKey: admin-password
23+
alertmanager:
24+
service:
25+
type: LoadBalancer
26+
destination:
27+
server: https://kubernetes.default.svc
28+
namespace: monitoring
29+
syncPolicy:
30+
automated:
31+
prune: true
32+
selfHeal: true
33+
syncOptions:
34+
- CreateNamespace=true

helm/templates/servicemonitor.yml

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)