Skip to content

Commit 56b88b0

Browse files
authored
Merge pull request #42 from nomansadiq11/features/eks-deployment
EKS Deployment
2 parents 1a8301f + 50f64b9 commit 56b88b0

1 file changed

Lines changed: 250 additions & 0 deletions

File tree

deploy/eks-deployment.yaml

Lines changed: 250 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,250 @@
1+
# This file contains the Kubernetes deployment configuration for the Copilot Usage Advanced Dashboard
2+
3+
# --- elasticsearch ---
4+
apiVersion: apps/v1
5+
kind: Deployment
6+
metadata:
7+
name: copilot-elasticsearch
8+
namespace: default
9+
spec:
10+
replicas: 1
11+
selector:
12+
matchLabels:
13+
app: elasticsearch
14+
template:
15+
metadata:
16+
labels:
17+
app: elasticsearch
18+
spec:
19+
securityContext:
20+
runAsUser: 1000
21+
fsGroup: 1000
22+
containers:
23+
- name: elasticsearch
24+
image: ghcr.io/satomic/copilot-usage-advanced-dashboard/elastic-search:main
25+
ports:
26+
- containerPort: 9200
27+
volumeMounts:
28+
- name: elasticsearch
29+
mountPath: /usr/share/elasticsearch/data
30+
subPath: data
31+
- name: elasticsearch
32+
mountPath: /usr/share/elasticsearch/log
33+
subPath: logs
34+
resources:
35+
requests:
36+
cpu: "1"
37+
memory: "2Gi"
38+
limits:
39+
cpu: "2"
40+
memory: "4Gi"
41+
livenessProbe:
42+
httpGet:
43+
path: /_cluster/health
44+
port: 9200
45+
initialDelaySeconds: 30
46+
periodSeconds: 10
47+
readinessProbe:
48+
httpGet:
49+
path: /_cluster/health
50+
port: 9200
51+
initialDelaySeconds: 10
52+
periodSeconds: 10
53+
volumes:
54+
- name: elasticsearch
55+
emptyDir: {}
56+
57+
---
58+
59+
# --- elasticsearch service ----
60+
61+
apiVersion: v1
62+
kind: Service
63+
metadata:
64+
name: elasticsearch
65+
namespace: default
66+
spec:
67+
selector:
68+
app: elasticsearch
69+
ports:
70+
- name: http
71+
port: 9200
72+
targetPort: 9200
73+
74+
---
75+
# --- cronjob which pull data from github api, please also create secret for cronjob deployment github-pat ----
76+
apiVersion: batch/v1
77+
kind: CronJob
78+
metadata:
79+
name: cpuad-updater
80+
spec:
81+
schedule: "*/12 * * * *" # every 12 hour
82+
jobTemplate:
83+
spec:
84+
template:
85+
spec:
86+
securityContext:
87+
runAsUser: 1000
88+
fsGroup: 1000
89+
containers:
90+
- name: cpuad-updater
91+
image: ghcr.io/satomic/copilot-usage-advanced-dashboard/cpuad-updater:main
92+
envFrom:
93+
- secretRef:
94+
name: github-pat
95+
env:
96+
- name: ORGANIZATION_SLUGS
97+
value: "name of the ORGANIZATION_SLUGS"
98+
- name: ELASTICSEARCH_URL
99+
value: "http://elasticsearch:9200"
100+
- name: LOG_PATH
101+
value: "logs"
102+
- name: EXECUTION_INTERVAL
103+
value: "6"
104+
volumeMounts:
105+
- name: cpuad-updater-logs
106+
mountPath: /app/logs
107+
subPath: cpuad
108+
resources:
109+
requests:
110+
cpu: "0.5"
111+
memory: "512Mi"
112+
limits:
113+
cpu: "1"
114+
memory: "1Gi"
115+
securityContext:
116+
runAsUser: 1000 # match your app user if needed
117+
runAsGroup: 3000 # optional
118+
allowPrivilegeEscalation: false
119+
restartPolicy: OnFailure
120+
volumes:
121+
- name: cpuad-updater-logs
122+
emptyDir: {}
123+
124+
# --- Grafana Deployment ---
125+
---
126+
apiVersion: apps/v1
127+
kind: Deployment
128+
metadata:
129+
name: grafana
130+
spec:
131+
replicas: 1
132+
selector:
133+
matchLabels:
134+
app: grafana
135+
template:
136+
metadata:
137+
labels:
138+
app: grafana
139+
spec:
140+
containers:
141+
- name: grafana
142+
image: ghcr.io/satomic/copilot-usage-advanced-dashboard/grafana:main
143+
ports:
144+
- containerPort: 80
145+
envFrom:
146+
- secretRef:
147+
name: grafana-credentials
148+
env:
149+
- name: GF_LOG_LEVEL
150+
value: debug
151+
- name: GF_SERVER_HTTP_PORT
152+
value: "80"
153+
- name: GF_SECURITY_ADMIN_USER
154+
valueFrom:
155+
secretKeyRef:
156+
name: grafana-credentials
157+
key: GRAFANA_USERNAME
158+
- name: GF_SECURITY_ADMIN_PASSWORD
159+
valueFrom:
160+
secretKeyRef:
161+
name: grafana-credentials
162+
key: GRAFANA_PASSWORD
163+
volumeMounts:
164+
- name: grafana-data
165+
mountPath: /var/lib/grafana
166+
subPath: grafana
167+
resources:
168+
requests:
169+
cpu: "0.5"
170+
memory: "512Mi"
171+
limits:
172+
cpu: "1"
173+
memory: "1Gi"
174+
livenessProbe:
175+
httpGet:
176+
path: /api/health
177+
port: 8080
178+
initialDelaySeconds: 90
179+
periodSeconds: 30
180+
failureThreshold: 5
181+
readinessProbe:
182+
httpGet:
183+
path: /api/health
184+
port: 8080
185+
initialDelaySeconds: 30
186+
periodSeconds: 10
187+
securityContext:
188+
runAsUser: 472
189+
runAsGroup: 472
190+
volumes:
191+
- name: grafana-data
192+
emptyDir: {}
193+
---
194+
apiVersion: v1
195+
kind: Service
196+
metadata:
197+
name: grafana
198+
spec:
199+
selector:
200+
app: grafana
201+
ports:
202+
- protocol: TCP
203+
port: 80
204+
targetPort: 8080
205+
---
206+
apiVersion: networking.k8s.io/v1
207+
kind: Ingress
208+
metadata:
209+
name: grafana-ingress
210+
spec:
211+
ingressClassName: nginx
212+
rules:
213+
- http:
214+
paths:
215+
- backend:
216+
service:
217+
name: grafana
218+
port:
219+
number: 80
220+
path: /
221+
pathType: Prefix
222+
223+
# --- update-grafana Job (runs once) ---
224+
---
225+
apiVersion: batch/v1
226+
kind: Job
227+
metadata:
228+
name: update-grafana-once
229+
spec:
230+
template:
231+
spec:
232+
containers:
233+
- name: update-grafana
234+
image: ghcr.io/satomic/copilot-usage-advanced-dashboard/grafana-updater:main
235+
envFrom:
236+
- secretRef:
237+
name: grafana-credentials
238+
env:
239+
- name: ELASTICSEARCH_URL
240+
value: "http://elasticsearch:9200"
241+
- name: GRAFANA_URL
242+
value: "http://grafana:80"
243+
resources:
244+
requests:
245+
cpu: "0.25"
246+
memory: "256Mi"
247+
limits:
248+
cpu: "0.5"
249+
memory: "512Mi"
250+
restartPolicy: Never

0 commit comments

Comments
 (0)