From 60dfba9f7b35c274d9a39d224d5e7415c2a68254 Mon Sep 17 00:00:00 2001 From: Danijel Simeunovic Date: Tue, 20 Oct 2026 23:13:47 +0200 Subject: [PATCH] slack relay namespace --- apps/overlays/upc-dev/slack-relay/README.md | 33 +++++++++++++++---- .../upc-dev/slack-relay/kustomization.yaml | 1 + .../upc-dev/slack-relay/namespace.yaml | 19 +++++++++++ 3 files changed, 47 insertions(+), 6 deletions(-) create mode 100644 apps/overlays/upc-dev/slack-relay/namespace.yaml diff --git a/apps/overlays/upc-dev/slack-relay/README.md b/apps/overlays/upc-dev/slack-relay/README.md index 36770d7..8862d56 100644 --- a/apps/overlays/upc-dev/slack-relay/README.md +++ b/apps/overlays/upc-dev/slack-relay/README.md @@ -34,8 +34,12 @@ kubeseal --format=yaml --namespace=slack-relay \ > apps/overlays/upc-dev/slack-relay/slack-relay-secrets-sealed.yaml ``` -Then uncomment `slack-relay-secrets-sealed.yaml` in `kustomization.yaml` and -commit. +Then add `slack-relay-secrets-sealed.yaml` to `kustomization.yaml` and commit. + +`namespace.yaml` in this directory exists for ordering: the app-of-apps applies +the SealedSecret, so the namespace has to be created by the same sync rather +than by the child Application's chart (`namespace.create: false` in the values). +Without it the parent sync fails with `namespaces "slack-relay" not found`. | Key | Purpose | |---|---| @@ -59,13 +63,30 @@ add `SLACK_MODE=bot` to `app.extraEnv` in the values file. ## 3. Verify +Port-forward the service, then post a signed event. No Node needed — the +signature is an HMAC that `openssl` can compute: + ```bash -kubectl -n slack-relay port-forward svc/slack-relay-app 3000:3000 -AIGITBOT_WEBHOOK_SECRET=... node scripts/send-test-event.js http://localhost:3000 +kubectl -n slack-relay port-forward svc/slack-relay-app 3000:3000 & + +SECRET=$(kubectl -n slack-relay get secret slack-relay-secrets \ + -o jsonpath='{.data.AIGITBOT_WEBHOOK_SECRET}' | base64 -d) + +BODY='{"schemaVersion":1,"id":"smoke-1","eventType":"prworkflow.completed","timestamp":"2026-10-20T12:00:00Z","integration":{"botName":"review-bot","platform":"gitea"},"repository":{"owner":"Forte","name":"launchpad","pullRequest":42},"data":{"workflowKey":"review","status":"SUCCESS","durationMs":41230}}' + +curl -i -X POST http://localhost:3000/hooks/ai-git-bot \ + -H 'Content-Type: application/json' \ + -H "X-EventHook-Signature-256: sha256=$(printf '%s' "$BODY" | openssl dgst -sha256 -hmac "$SECRET" -r | cut -d' ' -f1)" \ + --data "$BODY" ``` -(`scripts/send-test-event.js` lives in the slack-relay repo.) A real check is -ai-git-bot's own delivery log, which shows the response code per delivery. +`200 {"status":"delivered"}` means the message reached Slack. Re-running with +the same `id` returns `{"status":"duplicate"}` — bump the id to send another. +The same request is in `scripts/send-test-event.js` in the slack-relay repo if +Node is available. + +The real check afterwards is ai-git-bot's own delivery log, which shows the +response code per delivery. ## Reading the logs diff --git a/apps/overlays/upc-dev/slack-relay/kustomization.yaml b/apps/overlays/upc-dev/slack-relay/kustomization.yaml index c3d4ee1..89a0bce 100644 --- a/apps/overlays/upc-dev/slack-relay/kustomization.yaml +++ b/apps/overlays/upc-dev/slack-relay/kustomization.yaml @@ -1,5 +1,6 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: +- namespace.yaml - slack-relay.yaml - slack-relay-secrets-sealed.yaml diff --git a/apps/overlays/upc-dev/slack-relay/namespace.yaml b/apps/overlays/upc-dev/slack-relay/namespace.yaml new file mode 100644 index 0000000..d8ba8da --- /dev/null +++ b/apps/overlays/upc-dev/slack-relay/namespace.yaml @@ -0,0 +1,19 @@ +--- +# Owned by the app-of-apps rather than the forteapp chart (namespace.create is +# false in values) because the SealedSecret next to this file is applied by the +# same sync and needs the namespace to exist first. ArgoCD applies Namespace +# before other kinds, so one sync is enough. +# Labels mirror what the chart would have set. +apiVersion: v1 +kind: Namespace +metadata: + name: slack-relay + annotations: + argocd.argoproj.io/sync-wave: "-1" + labels: + app.kubernetes.io/name: slack-relay + app.kubernetes.io/part-of: apps + app.kubernetes.io/managed-by: argocd + pod-security.kubernetes.io/enforce: baseline + pod-security.kubernetes.io/audit: restricted + pod-security.kubernetes.io/warn: restricted