Basic impl added

This commit is contained in:
2025-10-16 21:22:51 -07:00
parent 097ca99788
commit 9087a710e5
43 changed files with 7616 additions and 107 deletions
+43
View File
@@ -0,0 +1,43 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: notifier-config
labels:
app: notifier
data:
config.yaml: |
server:
grpc_port: 50051
rest_port: 8080
host: "0.0.0.0"
mode: "both"
queue:
type: "local"
max_size: 10000
worker_count: 10
retry_attempts: 3
retry_backoff: "exponential"
local:
buffer_size: 1000
persist_to_disk: false
notifiers:
stdout: true
logging:
level: "info"
format: "json"
output_path: "stdout"
metrics:
enabled: true
port: 9090
path: "/metrics"
prometheus_enabled: true
health_check:
enabled: true
port: 8081
path: "/health"
interval: 30
+97
View File
@@ -0,0 +1,97 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: notifier
labels:
app: notifier
version: v1
spec:
replicas: 3
selector:
matchLabels:
app: notifier
template:
metadata:
labels:
app: notifier
version: v1
spec:
serviceAccountName: notifier
containers:
- name: notifier
image: notifier:latest
imagePullPolicy: Always
ports:
- name: rest
containerPort: 8080
protocol: TCP
- name: grpc
containerPort: 50051
protocol: TCP
- name: metrics
containerPort: 9090
protocol: TCP
- name: health
containerPort: 8081
protocol: TCP
env:
- name: NOTIFIER_SERVER_MODE
value: "both"
- name: NOTIFIER_LOGGING_LEVEL
value: "info"
- name: NOTIFIER_LOGGING_FORMAT
value: "json"
- name: NOTIFIER_QUEUE_TYPE
value: "local"
volumeMounts:
- name: config
mountPath: /app/config.yaml
subPath: config.yaml
readOnly: true
- name: queue-storage
mountPath: /var/lib/notifier
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 500m
memory: 512Mi
livenessProbe:
httpGet:
path: /health
port: health
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
readinessProbe:
httpGet:
path: /health
port: health
initialDelaySeconds: 10
periodSeconds: 5
timeoutSeconds: 3
failureThreshold: 3
securityContext:
runAsNonRoot: true
runAsUser: 1000
allowPrivilegeEscalation: false
readOnlyRootFilesystem: false
capabilities:
drop:
- ALL
volumes:
- name: config
configMap:
name: notifier-config
- name: queue-storage
emptyDir: {}
restartPolicy: Always
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: notifier
labels:
app: notifier
+43
View File
@@ -0,0 +1,43 @@
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: notifier-hpa
labels:
app: notifier
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: notifier
minReplicas: 3
maxReplicas: 10
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 70
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: 80
behavior:
scaleDown:
stabilizationWindowSeconds: 300
policies:
- type: Percent
value: 50
periodSeconds: 60
scaleUp:
stabilizationWindowSeconds: 60
policies:
- type: Percent
value: 100
periodSeconds: 60
- type: Pods
value: 2
periodSeconds: 60
selectPolicy: Max
+26
View File
@@ -0,0 +1,26 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: notifier-ingress
labels:
app: notifier
annotations:
kubernetes.io/ingress.class: nginx
cert-manager.io/cluster-issuer: letsencrypt-prod
nginx.ingress.kubernetes.io/ssl-redirect: "true"
spec:
tls:
- hosts:
- notifier.example.com
secretName: notifier-tls
rules:
- host: notifier.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: notifier-rest
port:
number: 8080
+20
View File
@@ -0,0 +1,20 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: notifier
resources:
- deployment.yaml
- service.yaml
- configmap.yaml
- ingress.yaml
- hpa.yaml
commonLabels:
app: notifier
managed-by: kustomize
images:
- name: notifier
newName: your-registry/notifier
newTag: latest
+45
View File
@@ -0,0 +1,45 @@
# Example secret for notifier credentials
# DO NOT commit actual secrets to version control
# Use sealed-secrets, external-secrets, or vault in production
apiVersion: v1
kind: Secret
metadata:
name: notifier-secrets
labels:
app: notifier
type: Opaque
stringData:
# SMTP credentials
smtp-username: "your-email@gmail.com"
smtp-password: "your-app-password"
# Slack webhook URL
slack-webhook-url: "https://hooks.slack.com/services/YOUR/WEBHOOK/URL"
# Ntfy token
ntfy-token: "tk_your_token"
# Kafka credentials (if using Kafka)
kafka-username: "kafka-user"
kafka-password: "kafka-password"
---
# Example of using secrets in deployment
# Add this to deployment.yaml under spec.template.spec.containers[0].env
# - name: NOTIFIER_NOTIFIERS_SMTP_USERNAME
# valueFrom:
# secretKeyRef:
# name: notifier-secrets
# key: smtp-username
# - name: NOTIFIER_NOTIFIERS_SMTP_PASSWORD
# valueFrom:
# secretKeyRef:
# name: notifier-secrets
# key: smtp-password
# - name: NOTIFIER_NOTIFIERS_SLACK_WEBHOOK_URL
# valueFrom:
# secretKeyRef:
# name: notifier-secrets
# key: slack-webhook-url
+50
View File
@@ -0,0 +1,50 @@
apiVersion: v1
kind: Service
metadata:
name: notifier-rest
labels:
app: notifier
service: rest
spec:
type: ClusterIP
ports:
- port: 8080
targetPort: rest
protocol: TCP
name: http
selector:
app: notifier
---
apiVersion: v1
kind: Service
metadata:
name: notifier-grpc
labels:
app: notifier
service: grpc
spec:
type: ClusterIP
ports:
- port: 50051
targetPort: grpc
protocol: TCP
name: grpc
selector:
app: notifier
---
apiVersion: v1
kind: Service
metadata:
name: notifier-metrics
labels:
app: notifier
service: metrics
spec:
type: ClusterIP
ports:
- port: 9090
targetPort: metrics
protocol: TCP
name: metrics
selector:
app: notifier