From df7a108380a8a9c6a217036200b8b9d700964a17 Mon Sep 17 00:00:00 2001 From: Ashish Bagri Date: Tue, 9 Dec 2025 09:50:52 +0100 Subject: [PATCH 1/2] Add glassflow-notifer deployment --- .../glassflow-notifier-configmap.yaml | 24 ++++ .../glassflow-notifier-deployment.yaml | 127 ++++++++++++++++++ charts/glassflow-etl/templates/service.yaml | 20 +++ charts/glassflow-etl/values.yaml | 64 +++++++++ 4 files changed, 235 insertions(+) create mode 100644 charts/glassflow-etl/templates/glassflow-notifier-configmap.yaml create mode 100644 charts/glassflow-etl/templates/glassflow-notifier-deployment.yaml diff --git a/charts/glassflow-etl/templates/glassflow-notifier-configmap.yaml b/charts/glassflow-etl/templates/glassflow-notifier-configmap.yaml new file mode 100644 index 0000000..e510d00 --- /dev/null +++ b/charts/glassflow-etl/templates/glassflow-notifier-configmap.yaml @@ -0,0 +1,24 @@ +{{- if .Values.notificationService.enabled }} +apiVersion: v1 +kind: ConfigMap +metadata: + name: glassflow-notifier-config + namespace: {{ .Release.Namespace }} + labels: + {{- include "glassflow-etl.labels" . | nindent 4 }} + app.kubernetes.io/component: glassflow-notifier +data: + GLASSFLOW_NATS_SERVER: "{{ .Values.global.nats.address | default (printf "nats://%s-nats.%s.svc.cluster.local:4222" .Release.Name .Release.Namespace) }}" + NATS_STREAM_NAME: "glassflow-notifications" + SLACK_ENABLED: "{{ .Values.notificationService.slack.enabled }}" + SLACK_WEBHOOK_URL: "{{ .Values.notificationService.slack.webhookUrl }}" + SLACK_DEFAULT_CHANNEL: "{{ .Values.notificationService.slack.defaultChannel }}" + EMAIL_ENABLED: "{{ .Values.notificationService.email.enabled }}" + SMTP_HOST: "{{ .Values.notificationService.email.smtpHost }}" + SMTP_PORT: "{{ .Values.notificationService.email.smtpPort }}" + SMTP_USERNAME: "{{ .Values.notificationService.email.smtpUsername }}" + SMTP_PASSWORD: "{{ .Values.notificationService.email.smtpPassword }}" + EMAIL_FROM_ADDRESS: "{{ .Values.notificationService.email.fromAddress }}" + EMAIL_TO_ADDRESS: "{{ .Values.notificationService.email.toAddress }}" +{{- end }} + diff --git a/charts/glassflow-etl/templates/glassflow-notifier-deployment.yaml b/charts/glassflow-etl/templates/glassflow-notifier-deployment.yaml new file mode 100644 index 0000000..38a7c15 --- /dev/null +++ b/charts/glassflow-etl/templates/glassflow-notifier-deployment.yaml @@ -0,0 +1,127 @@ +{{- if .Values.notificationService.enabled }} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Release.Name }}-glassflow-notifier + namespace: {{ .Release.Namespace }} + labels: + {{- include "glassflow-etl.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.notificationService.replicas }} + selector: + matchLabels: + {{- include "glassflow-etl.selectorLabels" . | nindent 6 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 6 }} + {{- end }} + app.kubernetes.io/component: glassflow-notifier + template: + metadata: + labels: + {{- include "glassflow-etl.selectorLabels" . | nindent 8 }} + app.kubernetes.io/component: glassflow-notifier + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + annotations: + checksum/glassflow-notifier-config: {{ include (print $.Template.BasePath "/glassflow-notifier-configmap.yaml") . | sha256sum }} + {{- with .Values.podAnnotations }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- if .Values.affinity }} + affinity: + {{- toYaml .Values.affinity | nindent 8 }} + {{- end }} + {{- if .Values.tolerations }} + tolerations: + {{- toYaml .Values.tolerations | nindent 8 }} + {{- end }} + {{- if or .Values.postgresql.enabled true }} + initContainers: + {{- if .Values.postgresql.enabled }} + - name: wait-for-postgres + image: "busybox:1.35" + command: + - sh + - -c + - | + echo "Waiting for PostgreSQL to be ready..." + until nc -z {{ .Release.Name }}-postgresql.{{ .Release.Namespace }}.svc.cluster.local 5432; do + echo "PostgreSQL not ready, waiting..." + sleep 2 + done + echo "PostgreSQL is ready!" + {{- end }} + {{- $natsAddress := .Values.global.nats.address | default (printf "nats://%s-nats.%s.svc.cluster.local:4222" .Release.Name .Release.Namespace) }} + - name: wait-for-nats + image: "busybox:1.35" + command: + - sh + - -c + - | + echo "Waiting for NATS to be ready..." + NATS_URL="{{ $natsAddress }}" + # Remove protocol prefix if present + NATS_HOST_PORT="${NATS_URL#nats://}" + NATS_HOST_PORT="${NATS_HOST_PORT#nats-secure://}" + # Extract host and port + if echo "$NATS_HOST_PORT" | grep -q ":"; then + NATS_HOST=$(echo "$NATS_HOST_PORT" | cut -d: -f1) + NATS_PORT=$(echo "$NATS_HOST_PORT" | cut -d: -f2) + else + NATS_HOST="$NATS_HOST_PORT" + NATS_PORT="4222" + fi + echo "Checking NATS at $NATS_HOST:$NATS_PORT..." + until nc -z "$NATS_HOST" "$NATS_PORT"; do + echo "NATS not ready, waiting..." + sleep 2 + done + echo "NATS is ready!" + {{- end }} + containers: + - name: glassflow-notifier + image: "{{ .Values.global.imageRegistry | default "" }}{{ .Values.notificationService.image.repository }}:{{ .Values.notificationService.image.tag }}" + imagePullPolicy: {{ .Values.notificationService.image.pullPolicy }} + {{- with .Values.notificationService.resources }} + resources: + {{- toYaml . | nindent 12 }} + {{- end }} + envFrom: + - configMapRef: + name: glassflow-notifier-config + env: + {{- if .Values.postgresql.enabled }} + - name: POSTGRES_URL + valueFrom: + secretKeyRef: + name: glassflow-postgresql + key: connection-url + {{- else }} + - name: POSTGRES_URL + value: {{ .Values.global.postgres_connection_url | quote }} + {{- end }} + {{- if .Values.notificationService.env }} + {{- range .Values.notificationService.env }} + - name: {{ .name | quote }} + value: {{ .value | quote }} + {{- end }} + {{- end }} + {{- with .Values.notificationService.livenessProbe }} + livenessProbe: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.notificationService.readinessProbe }} + readinessProbe: + {{- toYaml . | nindent 12 }} + {{- end }} + securityContext: {{- toYaml .Values.securityContext | nindent 12 }} + serviceAccountName: {{ include "glassflow-etl.serviceAccountName" . }} + securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} +{{- end }} + diff --git a/charts/glassflow-etl/templates/service.yaml b/charts/glassflow-etl/templates/service.yaml index b33ba69..168a6bb 100644 --- a/charts/glassflow-etl/templates/service.yaml +++ b/charts/glassflow-etl/templates/service.yaml @@ -33,3 +33,23 @@ spec: selector: {{- include "glassflow-etl.selectorLabels" . | nindent 4 }} app.kubernetes.io/component: api +--- +{{- if .Values.notificationService.enabled }} +apiVersion: v1 +kind: Service +metadata: + name: {{ .Release.Name }}-notifier + namespace: {{ .Release.Namespace }} + labels: + {{- include "glassflow-etl.labels" . | nindent 4 }} +spec: + type: {{ .Values.notificationService.service.type | default "ClusterIP" }} + ports: + - port: {{ .Values.notificationService.service.port | default 8080 }} + targetPort: {{ .Values.notificationService.service.targetPort | default 8080 }} + protocol: TCP + name: http + selector: + {{- include "glassflow-etl.selectorLabels" . | nindent 4 }} + app.kubernetes.io/component: glassflow-notifier +{{- end }} diff --git a/charts/glassflow-etl/values.yaml b/charts/glassflow-etl/values.yaml index 896215f..c091c96 100644 --- a/charts/glassflow-etl/values.yaml +++ b/charts/glassflow-etl/values.yaml @@ -472,3 +472,67 @@ autoscaling: # Target memory utilization percentage for scaling (commented out) # Uncomment and set a value to enable memory-based scaling # targetMemoryUtilizationPercentage: 80 + +# ============================================================================= +# NOTIFICATION SERVICE COMPONENT CONFIGURATION +# ============================================================================= +# Notification service for sending Slack and Email notifications +notificationService: + # Enable or disable the notification service + enabled: false + replicas: 1 + image: + repository: glassflow-notifier + tag: main + pullPolicy: IfNotPresent + resources: + requests: + memory: "100Mi" + cpu: "100m" + limits: + memory: "200Mi" + cpu: "250m" + + service: + type: ClusterIP + port: 8082 + targetPort: 8080 + + # Slack Configuration + slack: + enabled: "false" # Set to true and add webhook URL + webhookUrl: "" # Add your Slack webhook URL here + defaultChannel: "#notifications" + + # Email Configuration + email: + enabled: "false" # Set to true and add SMTP details + smtpHost: "" # Add your SMTP host + smtpPort: 587 + smtpUsername: "" # Add your SMTP username + smtpPassword: "" # Add your SMTP password + fromAddress: "" # Add sender email address + toAddress: "" # Add recipient email address + + # Environment variables for the notification service + # Example: + # env: + # - name: CUSTOM_VAR + # value: "custom_value" + env: [] + + # Liveness probe configuration (optional) + # livenessProbe: + # httpGet: + # path: /health + # port: 8080 + # initialDelaySeconds: 30 + # periodSeconds: 10 + + # Readiness probe configuration (optional) + # readinessProbe: + # httpGet: + # path: /ready + # port: 8080 + # initialDelaySeconds: 5 + # periodSeconds: 5 From 749d05e931e51253dce19f48c8b13fa6b8625d41 Mon Sep 17 00:00:00 2001 From: Ashish Bagri Date: Thu, 11 Dec 2025 11:48:35 +0100 Subject: [PATCH 2/2] update deployment name --- .../glassflow-etl/templates/glassflow-notifier-deployment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/glassflow-etl/templates/glassflow-notifier-deployment.yaml b/charts/glassflow-etl/templates/glassflow-notifier-deployment.yaml index 38a7c15..87e8d17 100644 --- a/charts/glassflow-etl/templates/glassflow-notifier-deployment.yaml +++ b/charts/glassflow-etl/templates/glassflow-notifier-deployment.yaml @@ -2,7 +2,7 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: {{ .Release.Name }}-glassflow-notifier + name: {{ .Release.Name }}-notifier namespace: {{ .Release.Namespace }} labels: {{- include "glassflow-etl.labels" . | nindent 4 }}