Skip to content
This repository was archived by the owner on Jan 27, 2026. It is now read-only.

Commit 329897b

Browse files
authored
refactor helm charts (#527)
* orchestrator: refactor helm chart * validator: refactor helm chart * discovery: create new helm chart
1 parent 80a8727 commit 329897b

37 files changed

Lines changed: 600 additions & 305 deletions
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
values.yaml
2+
values-*
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apiVersion: v2
2+
name: discovery
3+
description: A Helm chart for Prime Discovery
4+
version: 0.1.0
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{{/* Helm helper templates */}}
2+
3+
{{- define "discovery.fullname" -}}
4+
{{- if .Values.fullnameOverride -}}
5+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
6+
{{- else -}}
7+
{{- printf "discovery" -}}
8+
{{- end -}}
9+
{{- end -}}
10+
11+
{{- define "discovery.namespace" -}}
12+
{{- .Values.namespace | default .Release.Namespace -}}
13+
{{- end -}}
14+
15+
{{- define "discovery.container" -}}
16+
{{- $mode := .mode }}
17+
{{- $root := .root }}
18+
- name: discovery
19+
image: {{ $root.Values.image }}
20+
ports:
21+
- containerPort: {{ $root.Values.port }}
22+
readinessProbe:
23+
httpGet:
24+
path: /health
25+
port: {{ $root.Values.port }}
26+
initialDelaySeconds: 5
27+
periodSeconds: 10
28+
livenessProbe:
29+
httpGet:
30+
path: /health
31+
port: {{ $root.Values.port }}
32+
initialDelaySeconds: 15
33+
periodSeconds: 20
34+
resources:
35+
requests:
36+
memory: "256Mi"
37+
cpu: "500m"
38+
limits:
39+
memory: "512Mi"
40+
cpu: "2000m"
41+
env:
42+
- name: MODE
43+
value: {{ $mode }}
44+
- name: PORT
45+
value: {{ $root.Values.port | quote }}
46+
{{- range $key, $value := $root.Values.env }}
47+
- name: {{ $key }}
48+
value: {{ $value | quote }}
49+
{{- end }}
50+
{{- range $root.Values.envFromSecret }}
51+
- name: {{ .name }}
52+
valueFrom:
53+
secretKeyRef:
54+
name: {{ .secretKeyRef.name }}
55+
key: {{ .secretKeyRef.key }}
56+
{{- end -}}
57+
{{- end -}}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: cloud.google.com/v1
2+
kind: BackendConfig
3+
metadata:
4+
name: {{ include "discovery.fullname" . }}-api-backend-config
5+
namespace: {{ include "discovery.namespace" . }}
6+
spec:
7+
healthCheck:
8+
type: HTTP
9+
requestPath: /health
10+
port: {{ .Values.port }}
11+
checkIntervalSec: 15
12+
timeoutSec: 5
13+
healthyThreshold: 1
14+
unhealthyThreshold: 2
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "discovery.fullname" . }}-api
5+
namespace: {{ include "discovery.namespace" . }}
6+
spec:
7+
selector:
8+
matchLabels:
9+
app: {{ include "discovery.fullname" . }}-api
10+
template:
11+
metadata:
12+
labels:
13+
app: {{ include "discovery.fullname" . }}-api
14+
spec:
15+
containers: {{- include "discovery.container" (dict "root" . "mode" "api") | nindent 6 }}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{{- if .Values.api.hpa.enabled }}
2+
apiVersion: autoscaling/v2
3+
kind: HorizontalPodAutoscaler
4+
metadata:
5+
name: {{ include "discovery.fullname" . }}-api
6+
namespace: {{ include "discovery.namespace" . }}
7+
spec:
8+
scaleTargetRef:
9+
apiVersion: apps/v1
10+
kind: Deployment
11+
name: {{ include "discovery.fullname" . }}-api
12+
minReplicas: {{ .Values.api.hpa.minReplicas }}
13+
maxReplicas: {{ .Values.api.hpa.maxReplicas }}
14+
{{- if or .Values.api.hpa.metrics.cpu.enabled .Values.api.hpa.metrics.memory.enabled }}
15+
metrics:
16+
{{- if .Values.api.hpa.metrics.cpu.enabled }}
17+
- type: Resource
18+
resource:
19+
name: cpu
20+
target:
21+
type: Utilization
22+
averageUtilization: {{ .Values.api.hpa.metrics.cpu.targetUtilization }}
23+
{{- end }}
24+
{{- if .Values.api.hpa.metrics.memory.enabled }}
25+
- type: Resource
26+
resource:
27+
name: memory
28+
target:
29+
type: Utilization
30+
averageUtilization: {{ .Values.api.hpa.metrics.memory.targetUtilization }}
31+
{{- end }}
32+
{{- end }}
33+
{{- end }}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
apiVersion: v1
3+
kind: Service
4+
metadata:
5+
name: {{ include "discovery.fullname" . }}
6+
namespace: {{ include "discovery.namespace" . }}
7+
labels:
8+
app: {{ include "discovery.fullname" . }}-api
9+
spec:
10+
selector:
11+
app: {{ include "discovery.fullname" . }}-api
12+
ports:
13+
- port: {{ .Values.port }}
14+
targetPort: {{ .Values.port }}
15+
type: ClusterIP
16+
---
17+
apiVersion: v1
18+
kind: Service
19+
metadata:
20+
name: {{ include "discovery.fullname" . }}-api
21+
namespace: {{ include "discovery.namespace" . }}
22+
labels:
23+
app: {{ include "discovery.fullname" . }}-api
24+
annotations:
25+
cloud.google.com/backend-config: '{"default": "{{ include "discovery.fullname" . }}-api-backend-config"}'
26+
spec:
27+
selector:
28+
app: {{ include "discovery.fullname" . }}-api
29+
ports:
30+
- port: {{ .Values.port }}
31+
targetPort: {{ .Values.port }}
32+
type: ClusterIP
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: cloud.google.com/v1
2+
kind: BackendConfig
3+
metadata:
4+
name: {{ include "discovery.fullname" . }}-processor-backend-config
5+
namespace: {{ include "discovery.namespace" . }}
6+
spec:
7+
healthCheck:
8+
type: HTTP
9+
requestPath: /health
10+
port: {{ .Values.port }}
11+
checkIntervalSec: 15
12+
timeoutSec: 5
13+
healthyThreshold: 1
14+
unhealthyThreshold: 2
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "discovery.fullname" . }}-processor
5+
namespace: {{ include "discovery.namespace" . }}
6+
spec:
7+
replicas: 1
8+
selector:
9+
matchLabels:
10+
app: {{ include "discovery.fullname" . }}-processor
11+
template:
12+
metadata:
13+
labels:
14+
app: {{ include "discovery.fullname" . }}-processor
15+
spec:
16+
containers: {{- include "discovery.container" (dict "root" . "mode" "processor") | nindent 6 }}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ include "discovery.fullname" . }}-processor
5+
namespace: {{ include "discovery.namespace" . }}
6+
labels:
7+
app: {{ include "discovery.fullname" . }}-processor
8+
annotations:
9+
cloud.google.com/backend-config: '{"default": "{{ include "discovery.fullname" . }}-processor-backend-config"}'
10+
spec:
11+
selector:
12+
app: {{ include "discovery.fullname" . }}-processor
13+
ports:
14+
- port: {{ .Values.port }}
15+
targetPort: {{ .Values.port }}
16+
type: ClusterIP

0 commit comments

Comments
 (0)