Skip to content

Commit

Permalink
Add loop for resources
Browse files Browse the repository at this point in the history
  • Loading branch information
max5dt committed Nov 28, 2024
1 parent bcf1e79 commit a65c447
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 18 deletions.
6 changes: 4 additions & 2 deletions helm/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{{- range .Values.currency }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "helm-chart.fullname" . }}
name: {{ include "helm-chart.fullname" . }}-{{ . }}
labels:
{{- include "helm-chart.labels" . | nindent 4 }}
spec:
Expand Down Expand Up @@ -36,7 +37,7 @@ spec:
imagePullPolicy: {{ .Values.image.pullPolicy }}
envFrom:
- secretRef:
name: {{ .Values.envFromSecret }}
name: {{ .Values.envFromSecret }}-{{ . }}
ports:
- name: http
containerPort: {{ .Values.service.port }}
Expand Down Expand Up @@ -70,3 +71,4 @@ spec:
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
36 changes: 22 additions & 14 deletions helm/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{{- if .Values.ingress.enabled -}}
{{- range .Values.currency }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ include "helm-chart.fullname" . }}
name: {{ include "helm-chart.fullname" . }}-{{ . }}
labels:
{{- include "helm-chart.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
Expand All @@ -25,19 +26,26 @@ spec:
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ .path }}
{{- with .pathType }}
pathType: {{ . }}
{{- $hostParts := split "." .host }}
{{- $subdomain := index $hostParts 0 }}
{{- $domain := join "." (slice $hostParts 1 (len $hostParts)) }}
{{- range $.Values.currency }}
- host: {{ printf "%s-%s.%s" $subdomain . $domain | quote }}
http:
paths:
{{- range .paths }}
- path: {{ .path }}
{{- with .pathType }}
pathType: {{ . }}
{{- end }}
backend:
service:
name: {{ include "helm-chart.fullname" $ }}-{{ . }}
port:
number: {{ $.Values.service.adminPort }}
{{- end }}
backend:
service:
name: {{ include "helm-chart.fullname" $ }}
port:
number: {{ $.Values.service.adminPort }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}

4 changes: 3 additions & 1 deletion helm/templates/service-monitor.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{{- range .Values.currency }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "helm-chart.fullname" . }}-metrics
name: {{ include "helm-chart.fullname" . }}-{{ . }}
spec:
selector:
matchLabels:
Expand All @@ -13,3 +14,4 @@ spec:
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
{{- end }}
4 changes: 3 additions & 1 deletion helm/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{{- range .Values.currency }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "helm-chart.fullname" . }}
name: {{ include "helm-chart.fullname" . }}-{{ . }}
labels:
{{- include "helm-chart.labels" . | nindent 4 }}
spec:
Expand All @@ -17,3 +18,4 @@ spec:
name: admin
selector:
{{- include "helm-chart.selectorLabels" . | nindent 4 }}
{{- end }}
2 changes: 2 additions & 0 deletions helm/templates/static-secret-app.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- range .Values.currency }}
apiVersion: secrets.hashicorp.com/v1beta1
kind: VaultStaticSecret
metadata:
Expand All @@ -16,3 +17,4 @@ spec:
rolloutRestartTargets:
- kind: Deployment
name: {{ include "helm-chart.fullname" . }}
{{- end }}
3 changes: 3 additions & 0 deletions helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,6 @@ resources: {}
# requests:
# cpu: 100m
# memory: 128Mi

currency:
- "usdc-usdt"

0 comments on commit a65c447

Please sign in to comment.