Skip to content

Commit 6aa9620

Browse files
committed
feat(upsd): convert to app-template
convert this raw deployment into an app-template driven one, and update the configuration so that it will actually monitor the UPS over USB
1 parent 43ab488 commit 6aa9620

File tree

8 files changed

+389
-156
lines changed

8 files changed

+389
-156
lines changed

clusters/apps/env/production/observability/ups/app/deployment.yaml

-148
This file was deleted.

clusters/apps/env/production/observability/ups/app/kustomization.yaml renamed to clusters/apps/env/production/observability/ups/config/kustomization.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@
22
apiVersion: kustomize.config.k8s.io/v1beta1
33
kind: Kustomization
44
resources:
5-
- deployment.yaml
65
- secret.enc.yaml

clusters/apps/env/production/observability/ups/app/secret.enc.yaml renamed to clusters/apps/env/production/observability/ups/config/secret.enc.yaml

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: v1
22
stringData:
3-
UPS_API_PASSWORD: ENC[AES256_GCM,data:eP85yp3Mm/yj3lewc8xwdO/sIVc=,iv:qDcQunhlD11SYJs7mGeNdnRKpuJB8hffSeHPm1nZOR4=,tag:xPNjPBPpp32lL9mR1atqcQ==,type:str]
4-
UPS_API_USER: ENC[AES256_GCM,data:U0hBfBAN,iv:KRdf9xCkbquWrq+3q24vyDihwrbG1jeE3ZX80iATedE=,tag:NvLYS81gssPDZWJQbYlqag==,type:str]
3+
API_PASSWORD: ENC[AES256_GCM,data:OqdOpqHKiR0/E3xoMbt0IpFHV4o=,iv:DwmJBFvgvbZNSWJvunSs5ZE1JpaGOimKgzGvnFMwSFs=,tag:3HXnK3DIEIhJEBnb+nWTEw==,type:str]
4+
API_USER: ENC[AES256_GCM,data:Ek3R0NI9,iv:sUBQwgDH0rVOG8eSOEnEAcDG1ZIGWDHY0Cz3hiuNcKs=,tag:p9R4hKE3dEhHJai7iXQ6Yg==,type:str]
55
kind: Secret
66
metadata:
77
name: ups-env
@@ -17,8 +17,8 @@ sops:
1717
azure_kv: []
1818
hc_vault: []
1919
age: []
20-
lastmodified: "2022-11-26T04:15:13Z"
21-
mac: ENC[AES256_GCM,data:cuVtY4H9HPYzd1A7NTTG2Z96AdZgkvKpvv1vLjI8o5P/uGQtpmaaiTRkZxOh/KNSFp63hpqRsaOo7zbIQWqx60fAV0Hj5xPar/HWzVrEbuwe+KikkypZH6zUiLLhIgW8AMDaTVJCEcaI8kRGAinl06aJl1/76ef2SjGJZwOXgbw=,iv:gHnePBlEtnFqnEYVMLRV0Jo55s7X7G8hVvy9j7TS02M=,tag:eod6PknC74z2t7kiOkg2Xw==,type:str]
20+
lastmodified: "2024-06-03T15:17:43Z"
21+
mac: ENC[AES256_GCM,data:XJ8X+J4d16SsdgZXFPDjIH0OFRQa2sGw1bv+5DK30LGOnxKgDNWLb5/dnT3ANDTuLN8EMotxLlzHr0xc0/dqiQ2kqcSqe/6m3oct5aV8ff98XLv72Y+DT/q15fHdr8OWLGSwNKITkJdYiEC26NM1sSBPLBTCPoFruOGf03geVz8=,iv:vZPS7it2Wf9CSAPdU908QkgWMjREKEeEqCdzQdkxolk=,tag:6o3YPQDy9vgjukI71YK5+A==,type:str]
2222
pgp: []
2323
encrypted_regex: ^(data|stringData)$
24-
version: 3.7.3
24+
version: 3.8.1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
apiVersion: kustomize.config.k8s.io/v1beta1
3+
kind: Kustomization
4+
resources:
5+
- ../../../../../base/app-template
6+
patches:
7+
- path: patch.edison.yaml
8+
- patch: |-
9+
- op: replace
10+
path: /metadata/name
11+
value: upsd-exporter-edison
12+
target:
13+
kind: HelmRelease
14+
name: .*
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
---
2+
apiVersion: helm.toolkit.fluxcd.io/v2
3+
kind: HelmRelease
4+
metadata:
5+
name: app-template
6+
spec:
7+
interval: 30m
8+
chart:
9+
spec:
10+
chart: app-template
11+
version: 3.1.0
12+
sourceRef:
13+
kind: HelmRepository
14+
name: bjw-s-charts
15+
namespace: flux-system
16+
install:
17+
remediation:
18+
retries: 3
19+
upgrade:
20+
cleanupOnFail: true
21+
remediation:
22+
strategy: rollback
23+
retries: 3
24+
values:
25+
controllers:
26+
edison:
27+
annotations:
28+
reloader.stakater.com/auto: "true"
29+
pod:
30+
labels:
31+
component: upsd-edison
32+
containers:
33+
collector:
34+
image:
35+
repository: upshift/nut-upsd
36+
tag: 2.8.0
37+
env:
38+
TZ: America/New_York
39+
UPS_NAME: ${APP}
40+
UPS_DESC: "Cyberpower Rackmount ${APP}"
41+
envFrom:
42+
- secretRef:
43+
name: ups-env
44+
probes:
45+
liveness: &probes
46+
enabled: false
47+
custom: true
48+
spec:
49+
httpGet:
50+
path: /
51+
port: 3493
52+
initialDelaySeconds: 10
53+
periodSeconds: 30
54+
timeoutSeconds: 1
55+
failureThreshold: 3
56+
readiness: *probes
57+
securityContext:
58+
privileged: true
59+
resources:
60+
limits:
61+
cpu: 50m
62+
memory: 128Mi
63+
requests:
64+
cpu: 20m
65+
memory: 128Mi
66+
exporter:
67+
image:
68+
# TO-DO: recreate this container image in my repo
69+
repository: jzck/upsc-exporter
70+
tag: latest
71+
env:
72+
TZ: America/New_York
73+
UPS_TARGET: "edison@localhost:3493"
74+
envFrom:
75+
- secretRef:
76+
name: ups-env
77+
probes:
78+
liveness: &probes
79+
enabled: false
80+
custom: true
81+
spec:
82+
httpGet:
83+
path: /metrics
84+
port: 9614
85+
initialDelaySeconds: 10
86+
periodSeconds: 30
87+
timeoutSeconds: 1
88+
failureThreshold: 3
89+
readiness: *probes
90+
securityContext:
91+
privileged: true
92+
resources:
93+
limits:
94+
cpu: 50m
95+
memory: 128Mi
96+
requests:
97+
cpu: 20m
98+
memory: 128Mi
99+
defaultPodOptions:
100+
affinity:
101+
nodeAffinity:
102+
requiredDuringSchedulingIgnoredDuringExecution:
103+
nodeSelectorTerms:
104+
- matchExpressions:
105+
- key: feature.node.kubernetes.io/cyberpower-ups
106+
operator: In
107+
values:
108+
- "true"
109+
podAntiAffinity:
110+
requiredDuringSchedulingIgnoredDuringExecution:
111+
- labelSelector:
112+
matchExpressions:
113+
- key: component
114+
operator: In
115+
values:
116+
- upsd-tesla
117+
topologyKey: kubernetes.io/hostname
118+
119+
service:
120+
app:
121+
controller: edison
122+
annotations:
123+
prometheus.io/port: "9614"
124+
prometheus.io/scrape: "true"
125+
ports:
126+
collector:
127+
enabled: true
128+
primary: true
129+
port: 3493
130+
protocol: TCP
131+
targetPort: 3493
132+
exporter:
133+
enabled: true
134+
primary: false
135+
port: 9614
136+
protocol: TCP
137+
targetPort: 9614
138+
ingress:
139+
main:
140+
enabled: false
141+
persistence:
142+
ups:
143+
type: hostPath
144+
hostPath: /dev/usb/hiddev0
145+
hostPathType: CharDevice
146+
globalMounts:
147+
- path: /dev/usb/hiddev0

0 commit comments

Comments
 (0)