Repository navigation
Description
Friction
The argocd namespace has no default-deny perimeter on the Argo CD-managed homelab, although #1371 put one in git. k8s/argocd/networkpolicy.yaml is listed only in deploy-stack's native manifest list, deploy-stack skips every manifest once Application cluster exists, and no Application syncs the file. CI stays green because the deploy guard counts the native list as deployed. In the same namespace, k8s/argocd/values.yaml "disables" the ApplicationSet controller with a key the argo-cd chart does not have, so an unused controller with an Application-creating token runs with no NetworkPolicy selecting it, and open #1082 plans on the false premise that it is off.
Evidence
Live, read-only, 2026-10-17 (main = 3dd7fa6; release/v0.2.37 = 4ee3e01 has no change here):
kubectl get networkpolicy -n argocdlists only the chart's four ingress-only policies: argocd-application-controller, argocd-redis, argocd-repo-server, argocd-server (tracking idargocd:networking.k8s.io/NetworkPolicy). argocd-server's isingress: [{}].argocd-default-perimeterdoes not exist.- Pods
argocd-applicationset-controllerandargocd-image-updater-controllermatch no NetworkPolicy. No argocd pod has egress limits. - Every other namespace with a git perimeter has it live (cloudflared, devops, llm, logging, monitoring, otel).
- Deployment
argocd/argocd-applicationset-controller(chart argo-cd-10.9.6, v3.5.3) runs 1 replica, with a Service on 7000, and a Role granting create/delete/patch/update on applications and applicationsets and get/list/watch on secrets in argocd.kubectl auth can-i create applications.argoproj.io -n argocd --as=system:serviceaccount:argocd:argocd-applicationset-controller= yes.get applicationsets -Areturns nothing. AppProjectdefaultallows*/*, so a created Application reaches cluster-admin through the application controller. - argocd-server runs
--port=8080 --metrics-port=8083 --insecure; the Service is NodePort by design (k8s/argocd/values.yaml:25-30), and Ingressargocd-ingress(traefik) exists. - Nothing scrapes argocd today (
up{namespace="argocd"}is empty). Nodes are bare-metal k3s with no cloud metadata service, so the 169.254.169.254 exclusion is defence in depth.
Repo:
k8s/argocd/networkpolicy.yaml(ingress from Traefik and monitoring on 8082/8084/9121 at:31-41; egress to DNS, the API server and git/Helm with the metadata IP excluded) is registered only atsrc/devops_cli/commands/k8s/stack_lifecycle.py:178(_MANIFESTS_BY_STACK["infra"])._handle_argo_managed_deployment(stack_lifecycle.py:917-943, message at:941) applies no manifests whenclusterexists.k8s/argocd/apps/argocd.yamlis chart plus$valuesonly.tests/test_k8s_network_policies.py:84-106treats_MANIFESTS_BY_STACKmembership as deployed.tests/test_k8s_argocd_apps.py:354-367forbids any app syncingk8s/argocd/networkpolicy.yaml, and reads only single-sourcespec.source.path.docs/agent/tasks/task-1371-argocd-otel-perimeters.mdstill lists itskubectl diffstep as pending a person; fix(k8s): the argocd and otel perimeters admit 0.0.0.0/0 ingress and deploy-stack applies neither #1371 closed in v0.2.31.k8s/argocd/values.yaml:80("Disable components unnecessary for local dev") and:87-88applicationSet: enabled: false. Chart 10.9.6values.yaml:3546-3551hasapplicationSet.nameandreplicas: 1, noenabled; its applicationset Deployment template has no if-guard.helm templatewith the repo values renders the controller with replicas 1. WithapplicationSet.replicas: 0it renders replicas 0, and a server dry run of that Deployment was accepted.- feat(k8s): Point Argo CD to Gitea for git and PR dev images #1082 says the ApplicationSet Pull Request generator is "off today,
k8s/argocd/values.yaml:87-88".
Remedy
Tests first:
- Change
tests/test_k8s_network_policies.py:84-106so a policy counts as deployed only when an Argo CD Application path or source renders it as well as a native list (or it carries an owned exemption). Replacetests/test_k8s_argocd_apps.py:354-367with a test that exactly one Application rendersargocd-default-perimeter, reading bothsourceandsources. Add an offline test thatapplicationSet.replicas == 0and thatapplicationSethas noenabledkey. - Deploy the perimeter through Argo CD: add
{repoURL: https://github.com/dan-petty/devops-cli, targetRevision: main, path: k8s/argocd}as a third source ofk8s/argocd/apps/argocd.yaml(the directory's kustomization lists onlynetworkpolicy.yaml), or a smallargocd-perimeterApplication. Do not apply it from_handle_argo_managed_deployment; that would leave an object outside git ownership. - Before enabling it, settle argocd-server's exposure: either Service type ClusterIP behind Ingress
argocd-ingressand the chart'sglobal.networkPolicy.create: false(or a narrowed argocd-server policy) so the chart'singress: [{}]stops admitting everything, or keep NodePort and admit it explicitly in the perimeter. The NodePort is a documented access path (.devops/review.md:100-101), so this is the owner's choice; the perimeter must not silently cut it. k8s/argocd/values.yaml:87-88: replaceapplicationSet: enabled: falsewithapplicationSet: replicas: 0, with a comment that the chart has no enable switch for this controller, that its SA, Role, RoleBinding and Service still render, and that feat(k8s): Point Argo CD to Gitea for git and PR dev images #1082 turns it back on (with replicas >= 1 and a policy for webhook port 7000).- Add metrics ports to the perimeter only when a scrape exists (Metrics for the rest of the platform #551): 8083 server, 8080 applicationset, 8443 image-updater. Existing egress rules already cover DNS, the API server, GitHub/Helm and ghcr.io.
- Verify with
kubectl apply --dry-run=serveron a throwaway copy, then after the sync: repo-server still pulls git and Helm, the controller reaches the API server, Image Updater resolves ghcr.io digests, Traefik reaches argocd-server, and the applicationset Deployment shows 0/0. Finish the fix(k8s): the argocd and otel perimeters admit 0.0.0.0/0 ingress and deploy-stack applies neither #1371 checklist in its task file. changelog.d/<issue>.mdunder### Security.
Priority: P2. Severity medium: chart ingress policies already confine redis, repo-server and the controller; the open surface is argocd-server, the applicationset controller and image-updater, plus unrestricted egress from cluster-admin pods.
Proposed design
Problem statement
The argocd namespace lacks a default-deny perimeter policy, and the ApplicationSet controller runs with no replicas despite being disabled in configuration. This creates security vulnerabilities by exposing unnecessary services and allowing unrestricted access to the cluster.
Acceptance criteria
- Criterion 1: The argocd-default-perimeter NetworkPolicy is deployed through Argo CD and properly configured with ingress from Traefik and monitoring namespace, and egress to DNS, API server, and git/Helm with metadata IP exclusion
Verification: kubectl get networkpolicy -n argocd shows argocd-default-perimeter policy exists and matches k8s/argocd/networkpolicy.yaml - Criterion 2: The ApplicationSet controller Deployment runs with 0 replicas as configured in k8s/argocd/values.yaml
Verification: kubectl get deployment -n argocd argocd-applicationset-controller shows replicas: 0 - Criterion 3: No Argo CD Application syncs k8s/argocd/networkpolicy.yaml directly, but the policy is deployed via Argo CD's application controller
Verification: Tests verify that exactly one Application renders argocd-default-perimeter by checking both source and sources fields - Criterion 4: The argocd-server Service uses ClusterIP type with Ingress and NetworkPolicy controls, rather than exposing NodePort without restrictions
Verification: kubectl get service -n argocd argocd-server shows type: ClusterIP and appropriate NetworkPolicy is applied
Key questions
- What is the current state of the argocd namespace perimeter?: The argocd namespace has no default-deny perimeter policy. Only the chart's four ingress-only policies exist (argocd-application-controller, argocd-redis, argocd-repo-server, argocd-server) and no argocd-default-perimeter policy is deployed. [sources: src/devops_cli/commands/k8s/stack_lifecycle.py:178, k8s/argocd/networkpolicy.yaml]
- Why does the ApplicationSet controller run with 1 replica despite being disabled?: The configuration in k8s/argocd/values.yaml uses 'applicationSet: enabled: false' which doesn't map to the chart's actual parameter structure. The chart has no 'enabled' key for applicationSet, only 'replicas'. [sources: k8s/argocd/values.yaml:87-88, src/devops_cli/commands/k8s/stack_lifecycle.py:917-943]
- How should the argocd-server exposure be handled?: The decision is to either use Service type ClusterIP behind Ingress with chart's global.networkPolicy.create: false, or keep NodePort but explicitly admit it in the perimeter. The NodePort is a documented access path so this choice is left to the owner. (proposed) [sources: k8s/argocd/values.yaml:25-30, .devops/review.md:100-101]
- What is the expected behavior for the ApplicationSet controller?: The ApplicationSet controller should run with 0 replicas to disable it, as configured in k8s/argocd/values.yaml by changing 'applicationSet: enabled: false' to 'applicationSet: replicas: 0'. [sources: k8s/argocd/values.yaml:87-88, src/devops_cli/commands/k8s/stack_lifecycle.py:917-943]
Fit
Needs splitting into 4 items:
- Test changes to verify the perimeter is deployed through Argo CD
- Deploy the argocd-default-perimeter NetworkPolicy via Argo CD
- Configure ApplicationSet controller with 0 replicas
- Update argocd-server exposure handling
Suspected block
None.
Dependencies
None.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
dan-petty commentedon Oct 18, 2026
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.
The candidate describes a bug where Argo CD syncs the namespace perimeter and an unused controller runs no replicas.The issue affects security by leaving the argocd namespace without a default-deny perimeter and has an unused controller running with no NetworkPolicy.This change fixes critical security issues in the argocd namespace and ensures proper network policy enforcement.The fix involves modifying manifest lists, application syncing logic, and test assertions, which requires moderate development effort.dan-petty commentedon Oct 18, 2026
Proposal needs splitting into 4 items at 25e2cda (see proposed design in issue body).
fix(k8s): argocd namespace perimeter and ApplicationSet controller re…
dan-petty commentedon Oct 20, 2026
What changed
#1714, merged into
release/v0.2.37as 2871b72.7 file(s) changed.
How it was verified
Check runs at 98e15a2:
Acceptance Criteria of
docs/agent/tasks/task-1673-argocd-namespace-perimeter.md:No Acceptance Criteria section.