k8s-infra-cluster/infra/benthos/benthos-deployment.yaml
2026-03-25 11:46:39 +01:00

122 lines
4.0 KiB
YAML

apiVersion: v1
kind: Secret
metadata:
name: postgres-ha-app
namespace: infra # Matches your benthos namespace
type: Opaque
stringData:
# This must be the base64 encoded version of your password
# PowerShell: [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("your_password"))
password: 0lkzPxlwj6JVOXwwoLYROZJsONJoPK3MtrqkxnH3iaXUs0gFg0WL78RxyDdB86Sk
---
apiVersion: v1
kind: Secret
metadata:
name: postgres-ha-superuser
namespace: infra # Matches your benthos namespace
type: Opaque
stringData:
# This must be the base64 encoded version of your password
# PowerShell: [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("your_password"))
password: CuUwr9dPXJibVFygh7oGastvIJb4syMZXKljsf0dbEl91TwuYLqvEW35hN98ytKe
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: benthos
#namespace: infra
spec:
replicas: 3
selector:
matchLabels:
app: benthos
template:
metadata:
labels:
app: benthos
spec:
automountServiceAccountToken: false # Fixes SonarQube RBAC warning
# initContainers: # InitContainer that "pings" the database port before benthos start. FQDN: yb-tservers.db.svc.cluster.local
# - name: wait-for-yugabyte
# image: busybox:latest
# command: ['sh', '-c', 'until nc -vz yb-tservers.db.svc.cluster.local 5433; do echo waiting for yugabyte; sleep 2; done;']
initContainers:
- name: wait-for-postgres
image: busybox:latest
# We now ping the -rw service on port 5432
command: ['sh', '-c', 'until nc -vz postgres-ha-rw.db.svc.cluster.local 5432; do echo waiting for postgres; sleep 2; done;']
containers:
- name: benthos
image: jeffail/benthos
# Commands to look for your streams and templates
args: ["--chilled", "-r", "/configs/resources/resources.yaml", "-t", "/configs/templates/*.yaml", "streams", "/configs/streams/*.yaml"]
# - "-r"
# - "/configs/templates/*.yaml"
# - "streams"
# - "/configs/streams/*.yaml"
ports:
- name: dashboard
containerPort: 4195
env:
- name: ECOM_PASS # This is the name Benthos will see
valueFrom:
secretKeyRef:
name: postgres-ha-app # This must match your Secret metadata.name
key: password
resources: # Fixes CPU request warning
requests:
cpu: "100m"
memory: "128Mi"
limits:
cpu: "500m"
memory: "512Mi"
volumeMounts:
- name: resources-vol
mountPath: /configs/resources
- name: streams-vol
mountPath: /configs/streams
- name: templates-vol
mountPath: /configs/templates
volumes:
- name: resources-vol
configMap:
name: benthos-resources
- name: streams-vol
configMap:
name: benthos-streams # Matches the name in kustomization.yaml
- name: templates-vol
configMap:
name: benthos-templates
---
apiVersion: v1
kind: Service
metadata:
name: benthos-ui
#namespace: infra
spec:
selector:
app: benthos # This MUST match the labels in your deployment
ports:
- protocol: TCP
port: 4195
targetPort: 4195
type: ClusterIP
# benthos:
# image: jeffail/benthos
# container_name: benthos
# volumes:
# - ./benthos-configs:/configs # A folder containing your pass1.yaml and pass2.yaml
# - ./benthos-configs/streams:/configs/streams # A folder containing your pass1.yaml and pass2.yaml
# - ./benthos-configs/templates:/configs/templates # Maps a local folder to the cache
# # 'streams' mode watches the folder and runs everything inside it
# command: ["--chilled", "-r", "/configs/resources.yaml", "-t", "/configs/templates/*.yaml", "streams", "/configs/streams/*.yaml"]
# depends_on:
# - nats
# - yb-master
# ports:
# - "4195:4195" # Dashboard/Metrics port
# networks:
# - nats-network