Skip to content

feat(k8s): argo cd's notifications controller posts the devops application's deploys and every failed sync to mattermost's deploys channel #1393

Closed

Description

@dan-petty

Problem

Checked on 2026-10-08: release/v0.2.29 at 910b823; the cluster, read-only; the argo-cd chart 10.9.6, Argo CD v3.5.3 and argoproj/notifications-engine.

  • The controller is off.
    • notifications.enabled: false (k8s/argocd/values.yaml:84-85).
    • Argo CD v3.5.3 (chart 10.9.6) ships the controller, with values for its Secret, notifiers, subscriptions, templates and triggers. The chart sets notifications.triggers: {} and notifications.templates: {}, so the catalog's triggers have to be copied in.
  • Deploys are checked by hand.
  • A failed sync shows only in Argo CD.
  • Argo CD's Mattermost service would put homelab values in git.
  • The controller picks up its Secret without a restart. It reads argocd-notifications-secret through an informer (nc_controller.go:94, :102 in v3.5.3), and notifications-engine drops its cached configuration on every change of that Secret (pkg/api/factory.go:60-70).
  • Only the Mattermost side can block this traffic today.
    • k8s/argocd/networkpolicy.yaml allows public egress on 80, 443, 22 and 9418, and nothing on 8065 (:67-81). But no Application syncs that file (test_perimeters_in_applications, tests/test_k8s_argocd_apps.py:342-354), and deploy-stack doesn't list it (src/devops_cli/commands/k8s/stack_lifecycle.py:168-194).
    • Live, namespace argocd has only the chart's Ingress-only policies, so its egress is open.
  • feat(k8s): argo cd records each single-source github application's deploy outcome as a github deployment on the synced commit, through its own deployments-only github app #1387 turns the same controller on. It sends deploy outcomes to the Service, and defines the notifications configuration both items share.

Acceptance criteria

In the gate. New tests touch no network, and each one's call phase stays under 1 s.

Pending a person, after merge and after #1391:

  • (a) After the push:
    • kubectl -n argocd rollout status deploy/argocd-notifications-controller succeeds;
    • its log has no error for service mattermost, and never shows a literal $mattermost-deploys-url.
  • (b) The next merge into main that changes what devops renders posts one message in deploys, naming devops and the revision.
  • (c) The next failed sync posts one message with Argo CD's error. Alternatively, force one with a scratch Application that points at a missing path, then delete it.

Key questions

Strategic alignment

Proposed design

Problem statement

Argo CD's notifications controller is disabled. Deploy outcomes and failed syncs are visible only in the Argo CD UI or CLI. A person must check them by hand after every merge. This item enables the controller to post devops Application deploy successes and any Application's failed sync to a Mattermost channel through a webhook service.

Acceptance criteria

  • Criterion 1: The shared notifications configuration is present in k8s/argocd/values.yaml, with notifications.enabled true, notifications.secret.create false, an empty notifications.argocdUrl, the controller's requests and limits, the catalog triggers, and the argocd/argocd-notifications-secret row.
    Verification: Read k8s/argocd/values.yaml and confirm each key is set as stated. Run uv run devops pr check-readiness.
  • Criterion 2: The webhook service is declared under notifications.notifiers with url $mattermost-deploys-url, header Content-Type application/json, and retryMax 1.
    Verification: Read the values file and confirm the service.webhook.mattermost block. Run the new or existing tests in tests/test_k8s_argocd_notifications.py.
  • Criterion 3: The on-deployed and on-sync-failed triggers and their templates app-deployed and app-sync-failed are defined, each with a webhook.mattermost body that POSTs a JSON object whose only value is a toJson pipeline.
    Verification: Read the triggers and templates in the values file. Run the test that asserts both bodies use toJson and dig with an empty default.
  • Criterion 4: The on-sync-failed subscription covers every Application through notifications.subscriptions with the mattermost webhook and no selector. The on-deployed subscription covers only the devops Application through an annotation in k8s/argocd/apps/devops.yaml.
    Verification: Read notifications.subscriptions in the values file and the annotation in k8s/argocd/apps/devops.yaml. Run the subscription-split test.
  • Criterion 5: The argocd/argocd-notifications-secret gains key mattermost-deploys-url as a derived entry from the base URL constant and the managed option mattermost.deploys_hook. The entry is optional: a missing keyring key skips it with a warning. --dry-run lists the key with no value.
    Verification: Run uv run devops k8s push-secrets --only argocd/argocd-notifications-secret --dry-run and confirm the key appears with no value. Confirm the skip-with-warning path in the push-secrets code.
  • Criterion 6: The mattermost perimeter admits only the notifications controller on port 8065, with pod label app.kubernetes.io/name: argocd-notifications-controller. k8s/argocd/networkpolicy.yaml gains egress to namespace mattermost on 8065.
    Verification: Read k8s/argocd/networkpolicy.yaml and the mattermost perimeter. Run tests/test_k8s_network_policies.py.
  • Criterion 7: Tests in tests/test_k8s_argocd_notifications.py or tests/test_k8s_argocd_apps.py cover the values, the subscription split, and the absence of any channel ID, homelab host or hook key in any value.
    Verification: Run uv run devops ci and confirm the new tests pass. Inspect the test file for the three coverage areas.
  • Criterion 8: The GitOps section of k8s/README.md gains a Notifications subsection with the hook creation steps, the config set command, the push-secrets command, and what posts versus what Metrics for the rest of the platform #551 and feat(k8s): argo cd records each single-source github application's deploy outcome as a github deployment on the synced commit, through its own deployments-only github app #1387 cover.
    Verification: Read the Notifications subsection in k8s/README.md and confirm all four points are present.
  • Criterion 9: uv run devops pr check-readiness passes and uv run devops ci passes within its 5-minute budget.
    Verification: Run both commands and confirm exit code 0 within the time limit.

Key questions

Open questions

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#1391

Activity

  1. added
    type/feature
    scope/k8s
    on Oct 8, 2026
  2. dan-petty-bot commented on Oct 8, 2026

    @dan-petty-bot
    Collaborator

    Intake placed this item to the backlog: at intake only a critical fix goes into a release; a release start pulls Ready items in, P0 features first.

    • Priority: P2-Medium. Improves operational visibility and removes a manual check, but the cluster functions without it and no incident is blocked.
    • Value: Medium. Reduces the chance of missed failed syncs or unreported restarts, but the team can still detect issues via Argo CD UI or metrics once dan-petty/devops-cli#551 lands.
    • Effort: Medium. Requires enabling the controller, defining the Mattermost service, triggers, templates, subscriptions, and wiring the Secret via push-secrets, but the chart already ships the controller and the Secret-informer path is confirmed.
  3. dan-petty commented on Oct 8, 2026

    @dan-petty
    OwnerAuthor

    The '#913 follow-up' this item names is #1371 (v0.2.31), which applies k8s/argocd/networkpolicy.yaml; whichever lands second rebases on the file. Found by the 2026-10-08 backlog review.

  4. dan-petty commented on Oct 26, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones on the board.

    • Priority: P2-Medium. This item improves operational visibility and automation but is not critical or urgent.
    • Value: High. It provides valuable real-time feedback on deployments and sync failures, improving team responsiveness.
    • Effort: Medium. Implementation requires configuring notifications engine, secrets, and network policies, which is moderately complex.
    • Related: dan-petty/homelab#330, which asks for a different change. Both items involve Argo CD notifications but the candidate focuses on Mattermost while dan-petty/homelab#330 focuses on GitHub notifications.
  5. dan-petty commented on Oct 28, 2026

    @dan-petty
    OwnerAuthor

    Refine cannot set this item to Ready at d509dba until a person answers the questions below. Reply in a comment or edit the body, and the next refine round looks at the item again.

  6. added
    priority/p2-medium
    status/new
    effort/medium
    value/high
    on Oct 28, 2026
  7. added
    status/in-progress
    and removed
    status/new
    on Oct 31, 2026
  8. removed
    status/in-progress
    on Oct 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p2-mediumscope/k8stype/featurevalue/high

    Type

    No type

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions