Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions helm-charts/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -209,3 +209,35 @@ Define the MySQL hostname
{{- .Values.mysql.hostname | default (printf "%s-mysql" .Release.Name) }}
{{- end }}
{{- end }}

{{/*
Create the name for the Hypersense Backend
*/}}
{{- define "decision-engine.hypersenseBackendName" -}}
{{- printf "%s-hypersense-backend" (include "decision-engine.fullname" .) }}
{{- end }}

{{/*
Create the name for the Hypersense ETL
*/}}
{{- define "decision-engine.hypersenseEtlName" -}}
{{- printf "%s-hypersense-etl" (include "decision-engine.fullname" .) }}
{{- end }}

{{/*
Name of the shared Hypersense ConfigMap (DB/Redis connection coordinates).
Mirrors hypersense-main's configMapName: referenced by backend + etl via configMapKeyRef.
Override hypersenseShared.configMapName to point at a pre-existing (external) ConfigMap.
*/}}
{{- define "decision-engine.hypersenseConfigMapName" -}}
{{- .Values.hypersenseShared.configMapName | default (printf "%s-hypersense-config" (include "decision-engine.fullname" .)) }}
{{- end }}

{{/*
Name of the shared Hypersense Secret (DB password).
Mirrors hypersense-main's secretsName: referenced by backend + etl via secretKeyRef.
Override hypersenseShared.secretName to point at a pre-existing (external) Secret.
*/}}
{{- define "decision-engine.hypersenseSecretName" -}}
{{- .Values.hypersenseShared.secretName | default (printf "%s-hypersense-secret" (include "decision-engine.fullname" .)) }}
{{- end }}
Comment on lines +227 to +243
18 changes: 18 additions & 0 deletions helm-charts/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,26 @@ spec:
env:
- name: GROOVY_RUNNER_HOST
value: "{{ include "decision-engine.groovyRunnerName" . }}:{{ .Values.groovyRunner.service.port }}"
{{- if .Values.decisionEngine.usePostgreSQL }}
- name: DECISION_ENGINE__PG_DATABASE__PG_HOST
value: {{ include "decision-engine.postgresqlHost" . | quote }}
- name: DECISION_ENGINE__PG_DATABASE__PG_USERNAME
value: {{ .Values.postgresql.auth.username | quote }}
- name: DECISION_ENGINE__PG_DATABASE__PG_PASSWORD
value: {{ .Values.postgresql.auth.password | quote }}
- name: DECISION_ENGINE__PG_DATABASE__PG_DBNAME
value: {{ .Values.postgresql.auth.database | quote }}
{{- end }}
- name: DECISION_ENGINE__SERVER__HOST
value: "0.0.0.0"
- name: DECISION_ENGINE__REDIS__HOST
value: {{ include "decision-engine.redisHost" . | quote }}
- name: DECISION_ENGINE__ANALYTICS__ENABLED
value: {{ ternary "true" "false" .Values.analytics.enabled | quote }}
- name: DECISION_ENGINE__ANALYTICS__KAFKA__ENABLED
value: {{ ternary "true" "false" .Values.analytics.enabled | quote }}
- name: DECISION_ENGINE__ANALYTICS__CLICKHOUSE__ENABLED
value: {{ ternary "true" "false" .Values.analytics.enabled | quote }}
- name: DECISION_ENGINE__ANALYTICS__KAFKA__BROKERS
value: {{ .Values.analytics.kafka.brokers | quote }}
- name: DECISION_ENGINE__ANALYTICS__KAFKA__API_TOPIC
Expand Down
153 changes: 153 additions & 0 deletions helm-charts/templates/hypersense-backend-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
{{- if .Values.hypersenseBackend.enabled -}}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "decision-engine.hypersenseBackendName" . }}
labels:
{{- include "decision-engine.labels" . | nindent 4 }}
app.kubernetes.io/component: {{ .Values.hypersenseBackend.metadata.labels.component }}
spec:
replicas: 1
selector:
matchLabels:
{{- include "decision-engine.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: {{ .Values.hypersenseBackend.metadata.labels.component }}
template:
metadata:
labels:
{{- include "decision-engine.selectorLabels" . | nindent 8 }}
app.kubernetes.io/component: {{ .Values.hypersenseBackend.metadata.labels.component }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "decision-engine.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
{{- if .Values.initContainers.enabled }}
initContainers:
{{- if .Values.decisionEngine.usePostgreSQL }}
- name: wait-for-postgresql
image: "{{ .Values.initContainers.busybox.repository }}:{{ .Values.initContainers.busybox.tag }}"
imagePullPolicy: {{ .Values.initContainers.busybox.pullPolicy }}
command: ['sh', '-c', 'until nc -z {{ include "decision-engine.postgresqlHost" . }} 5432; do echo waiting for postgresql; sleep 2; done;']
{{- end }}
{{- if .Values.decisionEngine.useRedis }}
- name: wait-for-redis
image: "{{ .Values.initContainers.busybox.repository }}:{{ .Values.initContainers.busybox.tag }}"
imagePullPolicy: {{ .Values.initContainers.busybox.pullPolicy }}
command: ['sh', '-c', 'until nc -z {{ include "decision-engine.redisHost" . }} 6379; do echo waiting for redis; sleep 2; done;']
{{- end }}
{{- end }}
containers:
- name: hypersense-backend
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.hypersenseBackend.image.repository }}:{{ .Values.hypersenseBackend.image.tag }}"
imagePullPolicy: {{ .Values.hypersenseBackend.image.pullPolicy }}
ports:
- name: http
containerPort: {{ .Values.hypersenseBackend.service.port }}
protocol: TCP
env:
# ── Connection coordinates: from the shared Hypersense ConfigMap ──
- name: DB_HOST
valueFrom:
configMapKeyRef:
name: {{ include "decision-engine.hypersenseConfigMapName" . }}
key: DB_HOST
- name: DB_PORT
valueFrom:
configMapKeyRef:
name: {{ include "decision-engine.hypersenseConfigMapName" . }}
key: DB_PORT
- name: DB_USER
valueFrom:
configMapKeyRef:
name: {{ include "decision-engine.hypersenseConfigMapName" . }}
key: DB_USER
- name: DB_NAME
valueFrom:
configMapKeyRef:
name: {{ include "decision-engine.hypersenseConfigMapName" . }}
key: DB_NAME
- name: REDIS_URL
valueFrom:
configMapKeyRef:
name: {{ include "decision-engine.hypersenseConfigMapName" . }}
key: REDIS_URL
# ── DB password: from the shared Hypersense Secret ──
- name: DB_PASSWD
valueFrom:
secretKeyRef:
name: {{ include "decision-engine.hypersenseSecretName" . }}
key: DB_PASSWD
# ── Application config: direct values ──
- name: RUNNING_ENV
value: {{ .Values.hypersenseBackend.env.runningEnv | quote }}
- name: MODE
value: {{ .Values.hypersenseBackend.env.mode | quote }}
- name: DB_SCHEMA
value: {{ .Values.hypersenseBackend.env.dbSchema | quote }}
- name: DB_SCHEMA_RE
value: {{ .Values.hypersenseBackend.env.dbSchemaRe | quote }}
- name: DB_SCHEMA_AUTH
value: {{ .Values.hypersenseBackend.env.dbSchemaAuth | quote }}
- name: KAFKA_BOOTSTRAP_SERVERS
value: {{ .Values.hypersenseBackend.env.kafkaBootstrapServers | quote }}
- name: KAFKA_TOPIC
value: {{ .Values.hypersenseBackend.env.kafkaTopic | quote }}
- name: KAFKA_GROUP_ID
value: {{ .Values.hypersenseBackend.env.kafkaGroupId | quote }}
- name: AWS_REGION
value: {{ .Values.hypersenseBackend.env.awsRegion | quote }}
- name: S3_BUCKET
value: {{ .Values.hypersenseBackend.env.s3Bucket | quote }}
- name: AI_BACKEND_HOST
value: {{ .Values.hypersenseBackend.env.aiBackendHost | quote }}
- name: HYPER_SWITCH_BASE_URL
value: {{ .Values.hypersenseBackend.env.hyperSwitchBaseUrl | quote }}
{{- if .Values.hypersenseBackend.migration.runOnStartup }}
- name: RUN_RDS_MIGRATIONS
value: "TRUE"
{{- end }}
{{- range $name, $value := .Values.hypersenseBackend.extraEnvVars }}
- name: {{ $name }}
{{- if and (kindIs "map" $value) $value.valueFrom }}
valueFrom:
{{- toYaml $value.valueFrom | nindent 16 }}
{{- else }}
value: {{ $value | quote }}
{{- end }}
{{- end }}
livenessProbe:
httpGet:
path: {{ .Values.hypersenseBackend.healthcheck.path }}
port: http
initialDelaySeconds: {{ .Values.hypersenseBackend.healthcheck.initialDelaySeconds }}
periodSeconds: {{ .Values.hypersenseBackend.healthcheck.periodSeconds }}
timeoutSeconds: {{ .Values.hypersenseBackend.healthcheck.timeoutSeconds }}
failureThreshold: {{ .Values.hypersenseBackend.healthcheck.failureThreshold }}
readinessProbe:
httpGet:
path: {{ .Values.hypersenseBackend.healthcheck.path }}
port: http
initialDelaySeconds: {{ .Values.hypersenseBackend.healthcheck.initialDelaySeconds }}
periodSeconds: {{ .Values.hypersenseBackend.healthcheck.periodSeconds }}
timeoutSeconds: {{ .Values.hypersenseBackend.healthcheck.timeoutSeconds }}
resources:
{{- toYaml .Values.hypersenseBackend.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
19 changes: 19 additions & 0 deletions helm-charts/templates/hypersense-backend-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{- if .Values.hypersenseBackend.enabled -}}
apiVersion: v1
kind: Service
metadata:
name: {{ include "decision-engine.hypersenseBackendName" . }}
labels:
{{- include "decision-engine.labels" . | nindent 4 }}
app.kubernetes.io/component: {{ .Values.hypersenseBackend.metadata.labels.component }}
spec:
type: ClusterIP
ports:
- name: http
port: 80
targetPort: {{ .Values.hypersenseBackend.service.port }}
protocol: TCP
selector:
{{- include "decision-engine.selectorLabels" . | nindent 4 }}
app.kubernetes.io/component: {{ .Values.hypersenseBackend.metadata.labels.component }}
{{- end }}
19 changes: 19 additions & 0 deletions helm-charts/templates/hypersense-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{- if and (or .Values.hypersenseBackend.enabled .Values.hypersenseEtl.enabled) .Values.hypersenseShared.create -}}
# Shared connection coordinates for the Hypersense backend + etl services.
# Mirrors the external ConfigMap referenced by the hypersense-main chart; the
# deployments consume these keys via configMapKeyRef. Set hypersenseShared.create
# to false and point hypersenseShared.configMapName at your own ConfigMap to use
# an externally-managed one instead (e.g. pointing DB_HOST at RDS).
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "decision-engine.hypersenseConfigMapName" . }}
labels:
{{- include "decision-engine.labels" . | nindent 4 }}
data:
DB_HOST: {{ include "decision-engine.postgresqlHost" . | quote }}
DB_PORT: "5432"
DB_USER: {{ .Values.postgresql.auth.username | quote }}
DB_NAME: {{ .Values.hypersenseShared.dbName | quote }}
REDIS_URL: {{ printf "redis://%s:6379" (include "decision-engine.redisHost" .) | quote }}
{{- end }}
Loading
Loading