3 Commits
4 changed files with 62 additions and 8 deletions

No files matched your search

@@ -2,5 +2,5 @@ apiVersion: v2
name: pieced-threema-gateway name: pieced-threema-gateway
description: PieCed IT central Threema Gateway relay description: PieCed IT central Threema Gateway relay
type: application type: application
version: 0.1.8 version: 0.1.11
appVersion: "0.1.8" appVersion: "0.1.11"
@@ -43,6 +43,16 @@ spec:
value: {{ .Values.openclawUrlTemplate | quote }} value: {{ .Values.openclawUrlTemplate | quote }}
- name: FORWARD_TIMEOUT_MS - name: FORWARD_TIMEOUT_MS
value: {{ .Values.forwardTimeoutMs | quote }} value: {{ .Values.forwardTimeoutMs | quote }}
- name: FORWARD_URL_HOST_PATTERN
value: {{ .Values.forwardUrlHostPattern | quote }}
- name: MEDIA_TTL_SECONDS
value: {{ .Values.media.ttlSeconds | quote }}
- name: MEDIA_MAX_INBOUND_BYTES
value: {{ .Values.media.maxInboundBytes | int64 | quote }}
- name: MEDIA_MAX_OUTBOUND_BYTES
value: {{ .Values.media.maxOutboundBytes | int64 | quote }}
- name: MEDIA_STORE_MAX_BYTES
value: {{ .Values.media.storeMaxBytes | int64 | quote }}
- name: DATABASE_URL - name: DATABASE_URL
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
@@ -6,13 +6,15 @@
# 1. The cluster Ingress controller (nginx-ingress) — for Threema webhooks # 1. The cluster Ingress controller (nginx-ingress) — for Threema webhooks
# hitting us through the LB. # hitting us through the LB.
# 2. The portal namespace — calls /admin and reads /metrics. # 2. The portal namespace — calls /admin and reads /metrics.
# 3. Tenant namespaces (managed by pieced-operator) — call /api/send. # 3. Tenant namespaces (managed by pieced-operator) — call /api/*.
# 4. networkPolicy.extraClients namespaces (e.g. personal Hermes) — /api/*.
# #
# Egress: # Egress:
# - DNS (kube-system) # - DNS (kube-system)
# - Threema Gateway: msgapi.threema.ch:443 (FQDN-pinned) # - Threema Gateway: msgapi.threema.ch:443 (FQDN-pinned)
# - Postgres in same namespace # - Postgres in same namespace
# - HTTPS to tenant OpenClaw services in tenant namespaces (port 18789) # - HTTP to tenant OpenClaw services in tenant namespaces (port 18790)
# - HTTP to extraClients namespaces on their configured port
# ============================================================================= # =============================================================================
apiVersion: cilium.io/v2 apiVersion: cilium.io/v2
kind: CiliumNetworkPolicy kind: CiliumNetworkPolicy
@@ -50,6 +52,16 @@ spec:
- ports: - ports:
- port: "8080" - port: "8080"
protocol: TCP protocol: TCP
{{- range .Values.networkPolicy.extraClients }}
# Extra client: {{ .namespace }}
- fromEndpoints:
- matchLabels:
"k8s:io.kubernetes.pod.namespace": {{ .namespace | quote }}
toPorts:
- ports:
- port: "8080"
protocol: TCP
{{- end }}
egress: egress:
# DNS — with the proxy interceptor on so toFQDNs rules below # DNS — with the proxy interceptor on so toFQDNs rules below
# actually work. # actually work.
@@ -112,4 +124,14 @@ spec:
- ports: - ports:
- port: "18790" - port: "18790"
protocol: TCP protocol: TCP
{{- range .Values.networkPolicy.extraClients }}
# Extra client delivery: {{ .namespace }} (targetPort of its Service)
- toEndpoints:
- matchLabels:
"k8s:io.kubernetes.pod.namespace": {{ .namespace | quote }}
toPorts:
- ports:
- port: {{ .port | quote }}
protocol: TCP
{{- end }}
{{- end }} {{- end }}
+26 -4
View File
@@ -6,7 +6,7 @@ namespace: threema-gateway
image: image:
repository: registry.c5ai.ch/pieced/pieced-threema-gateway repository: registry.c5ai.ch/pieced/pieced-threema-gateway
tag: "0.1.8" tag: "0.1.11"
pullPolicy: IfNotPresent pullPolicy: IfNotPresent
# Pull from registry.c5ai.ch — matches operator + portal pattern. # Pull from registry.c5ai.ch — matches operator + portal pattern.
@@ -119,7 +119,7 @@ postgres:
# new CR exists and is preserved in the "newest N" window. # new CR exists and is preserved in the "newest N" window.
schedule: "45 4 * * *" schedule: "45 4 * * *"
keep: 14 keep: 14
image: bitnami/kubectl:1.31.6 image: bitnamilegacy/kubectl:1.33.4
# Secrets sourced from OpenBao via External Secrets Operator. # Secrets sourced from OpenBao via External Secrets Operator.
# Paths use the same convention as apps/portal/external-secrets.yaml: # Paths use the same convention as apps/portal/external-secrets.yaml:
@@ -138,6 +138,20 @@ openclawUrlTemplate: http://openclaw.tenant-{tenant}.svc.cluster.local:18789/web
forwardTimeoutMs: 8000 forwardTimeoutMs: 8000
# Per-tenant forward URLs (set via POST/PATCH /admin/tokens {forwardUrl})
# must point at a cluster Service whose hostname matches this pattern.
forwardUrlHostPattern: '^[a-z0-9]([-a-z0-9]*[a-z0-9])?\.[a-z0-9]([-a-z0-9]*[a-z0-9])?\.svc(\.cluster\.local)?$'
# Inbound media (voice notes, photos, files) for tenants with mediaEnabled.
# Decrypted blobs are held in memory only, for ttlSeconds, until the tenant
# plugin fetches them via GET /api/media/:id. Keep resources.limits.memory
# comfortably above storeMaxBytes.
media:
ttlSeconds: 600
maxInboundBytes: 26214400 # 25 MiB
maxOutboundBytes: 26214400 # 25 MiB
storeMaxBytes: 268435456 # 256 MiB
logLevel: info logLevel: info
# Resources for the relay pod # Resources for the relay pod
@@ -146,8 +160,9 @@ resources:
cpu: 100m cpu: 100m
memory: 128Mi memory: 128Mi
limits: limits:
cpu: 500m cpu: "1"
memory: 512Mi # Media store (256 MiB) + one 25 MiB upload in flight as base64 JSON.
memory: 768Mi
# CiliumNetworkPolicy — restricts who can talk in and out. # CiliumNetworkPolicy — restricts who can talk in and out.
networkPolicy: networkPolicy:
@@ -159,3 +174,10 @@ networkPolicy:
tenantNamespaceLabelValue: "pieced-operator" tenantNamespaceLabelValue: "pieced-operator"
# The portal pod runs in this namespace (per apps/portal in pieced-gitops). # The portal pod runs in this namespace (per apps/portal in pieced-gitops).
portalNamespace: pieced-system portalNamespace: pieced-system
# Agents outside operator-managed tenant namespaces (e.g. a personal
# Hermes). Each entry allows that namespace to call the relay API and the
# relay to deliver to it on `port` (the pod's targetPort, see the note on
# Cilium socket-LB in templates/networkpolicy.yaml).
extraClients:
- namespace: hermes
port: 8650