-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathaks-deployment.yml
More file actions
269 lines (264 loc) · 6.41 KB
/
Copy pathaks-deployment.yml
File metadata and controls
269 lines (264 loc) · 6.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
# This file contains the Kubernetes deployment configuration for the Copilot Usage Advanced Dashboard
# --- PersistentVolumeClaim ---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: shared-pvc
spec:
accessModes:
- ReadWriteMany
storageClassName: azurefile-csi-nfs
resources:
requests:
storage: 5Gi
# --- Secrets ---
---
apiVersion: v1
kind: Secret
metadata:
name: github-pat
type: Opaque
stringData:
GITHUB_PAT: "__GITHUB_PAT__" # Replace with your GitHub PAT
---
apiVersion: v1
kind: Secret
metadata:
name: grafana-credentials
type: Opaque
stringData:
GRAFANA_USERNAME: "__GRAFANA_USERNAME__"
GRAFANA_PASSWORD: "__GRAFANA_PASSWORD__"
# --- Elasticsearch Deployment ---
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: elasticsearch
spec:
replicas: 1
selector:
matchLabels:
app: elasticsearch
template:
metadata:
labels:
app: elasticsearch
spec:
containers:
- name: elasticsearch
image: ghcr.io/satomic/copilot-usage-advanced-dashboard/elastic-search:main
ports:
- containerPort: 9200
volumeMounts:
- name: elasticsearch
mountPath: /usr/share/elasticsearch/data
subPath: data
- name: elasticsearch
mountPath: /usr/share/elasticsearch/logs
subPath: logs
resources:
requests:
cpu: "1"
memory: "2Gi"
limits:
cpu: "2"
memory: "4Gi"
livenessProbe:
httpGet:
path: /_cluster/health
port: 9200
initialDelaySeconds: 30
periodSeconds: 10
readinessProbe:
httpGet:
path: /_cluster/health
port: 9200
initialDelaySeconds: 10
periodSeconds: 10
volumes:
- name: elasticsearch
persistentVolumeClaim:
claimName: shared-pvc
---
apiVersion: v1
kind: Service
metadata:
name: elasticsearch
spec:
selector:
app: elasticsearch
ports:
- protocol: TCP
port: 9200
targetPort: 9200
# --- Grafana Deployment ---
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: grafana
spec:
replicas: 1
selector:
matchLabels:
app: grafana
template:
metadata:
labels:
app: grafana
spec:
containers:
- name: grafana
image: ghcr.io/satomic/copilot-usage-advanced-dashboard/grafana:main
ports:
- containerPort: 80
envFrom:
- secretRef:
name: grafana-credentials
env:
- name: GF_LOG_LEVEL
value: debug
- name: GF_SERVER_HTTP_PORT
value: "80"
- name: GF_SECURITY_ADMIN_USER
valueFrom:
secretKeyRef:
name: grafana-credentials
key: GRAFANA_USERNAME
- name: GF_SECURITY_ADMIN_PASSWORD
valueFrom:
secretKeyRef:
name: grafana-credentials
key: GRAFANA_PASSWORD
volumeMounts:
- name: grafana-data
mountPath: /var/lib/grafana
subPath: grafana
resources:
requests:
cpu: "0.5"
memory: "512Mi"
limits:
cpu: "1"
memory: "1Gi"
livenessProbe:
httpGet:
path: /api/health
port: 8080
initialDelaySeconds: 90
periodSeconds: 30
failureThreshold: 5
readinessProbe:
httpGet:
path: /api/health
port: 8080
initialDelaySeconds: 30
periodSeconds: 10
securityContext:
runAsUser: 472
runAsGroup: 472
volumes:
- name: grafana-data
persistentVolumeClaim:
claimName: shared-pvc
---
apiVersion: v1
kind: Service
metadata:
name: grafana
spec:
selector:
app: grafana
ports:
- protocol: TCP
port: 80
targetPort: 8080
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: grafana-ingress
spec:
ingressClassName: webapprouting.kubernetes.azure.com
rules:
- http:
paths:
- backend:
service:
name: grafana
port:
number: 80
path: /
pathType: Prefix
# --- cpuad-updater CronJob ---
---
apiVersion: batch/v1
kind: CronJob
metadata:
name: cpuad-updater
spec:
schedule: "0 */6 * * *" # every 6 hours
jobTemplate:
spec:
template:
spec:
containers:
- name: cpuad-updater
image: ghcr.io/satomic/copilot-usage-advanced-dashboard/cpuad-updater:main
envFrom:
- secretRef:
name: github-pat
env:
- name: ORGANIZATION_SLUGS
value: "__ORGANIZATION_SLUGS__"
- name: ELASTICSEARCH_URL
value: "http://elasticsearch:9200"
- name: LOG_PATH
value: "logs"
- name: EXECUTION_INTERVAL
value: "6"
volumeMounts:
- name: cpuad-updater-logs
mountPath: /app/logs
subPath: cpuad
resources:
requests:
cpu: "0.5"
memory: "512Mi"
limits:
cpu: "1"
memory: "1Gi"
restartPolicy: OnFailure
volumes:
- name: cpuad-updater-logs
persistentVolumeClaim:
claimName: shared-pvc
# --- update-grafana Job (runs once) ---
---
apiVersion: batch/v1
kind: Job
metadata:
name: update-grafana-once
spec:
template:
spec:
containers:
- name: update-grafana
image: ghcr.io/satomic/copilot-usage-advanced-dashboard/grafana-updater:main
envFrom:
- secretRef:
name: grafana-credentials
env:
- name: ELASTICSEARCH_URL
value: "http://elasticsearch:9200"
- name: GRAFANA_URL
value: "http://grafana:80"
resources:
requests:
cpu: "0.25"
memory: "256Mi"
limits:
cpu: "0.5"
memory: "512Mi"
restartPolicy: Never