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
24 changes: 24 additions & 0 deletions charts/glassflow-etl/templates/glassflow-notifier-configmap.yaml
Original file line number Diff line number Diff line change
@@ -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 }}

127 changes: 127 additions & 0 deletions charts/glassflow-etl/templates/glassflow-notifier-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
{{- if .Values.notificationService.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-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 }}

20 changes: 20 additions & 0 deletions charts/glassflow-etl/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
64 changes: 64 additions & 0 deletions charts/glassflow-etl/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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