Skip to content

Commit 699a3f0

Browse files
committed
Refactor ArgoCD and monitoring setup: update kubeconfig, delete monitoring stack, and enhance Helm chart configurations; add secrets management for MongoDB
1 parent 0a2f16b commit 699a3f0

File tree

10 files changed

+96
-55
lines changed

10 files changed

+96
-55
lines changed

.github/workflows/deploy.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,12 @@ jobs:
8181
git add helm/values.yaml
8282
git commit -m "Update image tag to ${{ inputs.image-tag || github.sha }}" || exit 0
8383
git push https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
84-
84+
85+
- name: Deploy ArgoCD Applications
86+
if: ${{ inputs.terraform-action == 'apply' || inputs.terraform-action == '' }}
87+
run: |
88+
kubectl apply -f ./argocd/application.yml
89+
8590
- name: Get Application URL
8691
run: |
8792
echo "Application URL: http://$(kubectl get svc solar-system-svc -o jsonpath='{.status.loadBalancer.ingress[0].hostname}')"

.github/workflows/destroy.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,18 @@ jobs:
2424
with:
2525
terraform_version: 1.5.7
2626

27-
- name: Delete LoadBalancer Services
27+
- name: Update kubeconfig
28+
run: aws eks update-kubeconfig --name otel-cluster --region us-east-1
29+
30+
- name: Delete Monitoring Stack
2831
run: |
29-
aws eks update-kubeconfig --name otel-cluster --region us-east-1 || true
32+
kubectl delete application kube-prometheus-stack -n argocd || true
33+
kubectl delete namespace monitoring || true
3034
35+
- name: Uninstall ArgoCD
36+
run: |
3137
helm uninstall argocd -n argocd || true
32-
33-
kubectl delete svc argocd-server -n argocd || true
34-
kubectl delete svc solar-system-svc -n default || true
38+
kubectl delete namespace argocd || true
3539
3640
- name: Terraform Init
3741
run: terraform init

.github/workflows/terraform.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,13 @@ jobs:
7676
run: |
7777
kubectl create namespace monitoring --dry-run=client -o yaml | kubectl apply -f -
7878
kubectl create secret generic grafana-admin-secret \
79+
--from-literal=admin-user=admin \
7980
--from-literal=admin-password='${{ secrets.GRAFANA_ADMIN_PASSWORD }}' \
8081
--namespace monitoring \
8182
--dry-run=client -o yaml | kubectl apply -f -
8283
8384
- name: Deploy Monitoring
8485
if: ${{ inputs.terraform-action == 'apply' || inputs.terraform-action == '' }}
8586
run: |
86-
kubectl apply -f ./argocd/monitoring-stack.yaml
87+
kubectl apply -f ./argocd/monitoring.yml
88+

argocd/application.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
apiVersion: argoproj.io/v1alpha1
2+
kind: Application
3+
metadata:
4+
name: my-app
5+
namespace: argocd
6+
spec:
7+
project: default
8+
source:
9+
repoURL: 'https://github.com/KarimZakzouk/Graduation-Project-Devops'
10+
targetRevision: main
11+
path: helm
12+
helm:
13+
valueFiles:
14+
- values.yaml
15+
parameters:
16+
- name: mongo.uri
17+
value: <secret>
18+
- name: mongo.username
19+
value: <secret>
20+
- name: mongo.password
21+
value: <secret>
22+
destination:
23+
server: https://kubernetes.default.svc
24+
namespace: my-app-namespace
25+
syncPolicy:
26+
automated:
27+
prune: true
28+
selfHeal: true

argocd/monitoring.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ spec:
1010
chart: kube-prometheus-stack
1111
targetRevision: "45.7.1"
1212
helm:
13+
skipCrds: false
1314
values: |
15+
crds:
16+
enabled: true # Enable CRD installation
1417
prometheus:
1518
service:
1619
type: LoadBalancer
@@ -31,4 +34,6 @@ spec:
3134
prune: true
3235
selfHeal: true
3336
syncOptions:
34-
- CreateNamespace=true
37+
- CreateNamespace=true
38+
- ServerSideApply=true
39+
- SkipDryRunOnMissingResource=true

helm/templates/secrets.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
apiVersion: v1
2+
kind: Secret
3+
metadata:
4+
name: mongo-secrets
5+
namespace: {{ .Release.Namespace }}
6+
type: Opaque
7+
stringData:
8+
MONGO_URI: {{ .Values.mongo.uri }}
9+
MONGO_USERNAME: {{ .Values.mongo.username }}
10+
MONGO_PASSWORD: {{ .Values.mongo.password }}
11+
env:
12+
- name: MONGO_URI
13+
valueFrom:
14+
secretKeyRef:
15+
name: mongo-secrets
16+
key: MONGO_URI
17+
- name: MONGO_USERNAME
18+
valueFrom:
19+
secretKeyRef:
20+
name: mongo-secrets
21+
key: MONGO_USERNAME
22+
- name: MONGO_PASSWORD
23+
valueFrom:
24+
secretKeyRef:
25+
name: mongo-secrets
26+
key: MONGO_PASSWORD

helm/templates/servicemonitor.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: monitoring.coreos.com/v1
2+
kind: ServiceMonitor
3+
metadata:
4+
name: {{ .Release.Name }}-monitor
5+
namespace: monitoring
6+
spec:
7+
selector:
8+
matchLabels:
9+
app: {{ .Release.Name }}
10+
endpoints:
11+
- port: http
12+
path: /metrics
13+
interval: 30s

helm/values.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,8 @@ service:
99
type: LoadBalancer
1010
port: 80
1111
targetPort: 3000
12+
13+
mongo:
14+
uri: "YOUR_URI"
15+
username: "YOUR_USERNAME"
16+
password: "YOUR_PASSWORD"

kubernetes/deployment.template.yml

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

kubernetes/service.yml

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

0 commit comments

Comments
 (0)