Skip to content

feat(k8s): Read homelab config from in-cluster Gitea, drop overrides #1291

Not planned

Description

@dan-petty

Problem

This repository is public, so since #1290 the homelab's private values reach Argo CD at deploy time rather than through git:

  • The hosts are Kustomize patches that devops k8s deploy-stack writes onto the Applications devops and ingress; the cluster app-of-apps ignores them.
  • ConfigMap devops-cli-config is rendered from config.yaml and is owned by no Application.

That keeps the values out of git, but they then live only in the cluster and in config.yaml:

  • Recreating an Application drops its hosts until deploy-stack runs again.
  • Argo CD's documentation calls overrides held on the Application "an anti-pattern to GitOps" [sourced: https://argo-cd.readthedocs.io/en/stable/user-guide/parameters/].
  • Its best practices recommend a separate configuration repository [sourced: https://argo-cd.readthedocs.io/en/stable/user-guide/best_practices/].

Once the in-cluster Gitea runs (#1081) and Argo CD reads from it (#1082), a private configuration repository there can hold these values. The same forge then serves dynamic environments for project iteration and sandbox testing (owner, 2026-10-07).

Acceptance criteria

  • A private repository on the in-cluster Gitea holds the homelab's Argo CD configuration:
    • Kustomize overlays that use this repository's k8s/ as a remote base pinned with ?ref=;
    • patches setting the hosts under the homelab domain;
    • a configMapGenerator for devops-cli.yaml.
  • The Applications devops and ingress (and any other Application that needs a homelab value) render from that repository. Argo CD reaches it with a repository Secret that devops k8s push-secrets creates from the keyring.
  • deploy-stack stops writing Application overrides and the ConfigMap on an Argo CD-managed cluster, and the ignoreDifferences added to k8s/argocd/bootstrap/cluster.yaml in fix(k8s): argo cd takes homelab values from deploy-time overrides, and the repository holds no private or placeholder config #1290 is removed. The native path keeps rendering the ConfigMap from config.yaml.
  • A documented cutover moves a running cluster from the deploy-time overrides to the Gitea repository without an Ingress outage.
  • uv run devops ci passes.

Key questions

  • Which Gitea repository holds the configuration: a mirror of the private homelab repository, or a dedicated configuration repository? (proposed) A dedicated homelab-config repository, so Argo CD's credential reaches nothing else.
  • How are the overlays kept in step with this repository's releases? (proposed) Pin ?ref= to the release tag and bump it in the same step that bumps the image tag.
  • Do the dynamic environments for open pull requests (feat(k8s): Point Argo CD to Gitea for git and PR dev images #1082) share this repository? (proposed) No. They get generated Applications that reference it; their scope stays in feat(k8s): Point Argo CD to Gitea for git and PR dev images #1082.

Strategic alignment

Alternatives check of 2026-11-25: in-use.
The repository already uses this tool.
Tool: argoproj/argo-cd (https://github.com/argoproj/argo-cd), Apache-2.0, last activity 2026-11-24, maintained.
Reason: Searches found no tool beyond Argo CD, which the project already runs: it renders Applications from a private config repository with a repository Secret, Kustomize remote bases and configMapGenerator. The deploy-stack, push-secrets and cutover work stays in the CLI.

Covers:

  • Applications render from a private config repository via a repository Secret
  • Kustomize remote base pinned with ?ref= to a release tag
  • configMapGenerator and host patches held outside the Application spec

Lacks:

  • No deploy-stack change; overrides and ConfigMap still written
  • No push-secrets row for the Gitea repository Secret
  • No cutover procedure that keeps the Ingress available

Proposed design

Problem statement

The public repository cannot hold the homelab's private hosts and CLI ConfigMap. #1290 keeps these values as Argo CD Application overrides and an unowned ConfigMap, so recreating an Application drops them, and Argo CD calls overrides held on the Application an anti-pattern to GitOps. The change moves the values to a dedicated private homelab-config repository on the in-cluster Gitea, has the devops, ingress and mattermost Applications render from it through a repository Secret, and removes the deploy-time overrides while the native path keeps the ConfigMap.

Acceptance criteria

Requirement: Private repository layout

The GitOps section of k8s/README.md SHALL show the private homelab-config repository layout: one Kustomize overlay per homelab Application, each remote base pinned to a release tag with ?ref=v<major>.<minor>.<patch>, the host patches under the homelab domain, and a configMapGenerator for devops-cli.yaml.

Scenario: Document shows the overlay layout

  • WHEN A test reads the GitOps section of k8s/README.md.
  • THEN The section shows a base URL under https://github.com/dan-petty/devops-cli//k8s/ with ?ref=v, a host patch, and a configMapGenerator named devops-cli-config with disableNameSuffixHash: true and the file devops-cli.yaml.

Requirement: Applications read from Gitea

The app-of-apps SHALL point the devops, ingress, and mattermost Applications at the private homelab-config repository on the in-cluster Gitea.

Scenario: Applications use the Gitea source

  • WHEN A test reads the Application manifests under k8s/argocd/apps.
  • THEN Each Application has spec.source.repoURL: http://gitea-http.gitea.svc.cluster.local:3000/gitea_admin/homelab-config.git, spec.source.targetRevision: main, and a spec.source.path that names its overlay.

Requirement: Argo CD repository Secret

devops k8s push-secrets SHALL create the Argo CD repository Secret argocd/homelab-config-repo from the keyring.

Scenario: push-secrets creates the repository Secret

  • WHEN devops k8s push-secrets --only argocd/homelab-config-repo runs with the Gitea repository URL and the keyring entry gitea.admin_password.
  • THEN The Secret has the label argocd.argoproj.io/secret-type: repository, the repository URL, the username gitea_admin, and the password from gitea.admin_password.

Requirement: Argo CD-managed cluster skips overrides

deploy-stack SHALL write no Application overrides and no devops-cli-config ConfigMap on an Argo CD-managed cluster.

Scenario: Argo CD-managed cluster gets no overrides

  • WHEN deploy-stack --stack devops runs against a cluster that has Application cluster in namespace argocd.
  • THEN It sends no kubectl patch application and creates no devops-cli-config ConfigMap.

Requirement: Native path keeps ConfigMap

deploy-stack SHALL keep rendering devops-cli-config from config.yaml on the native path.

Scenario: Native path renders the ConfigMap

  • WHEN deploy-stack --stack devops runs against a cluster that Argo CD does not manage.
  • THEN It applies devops-cli-config rendered from config.yaml.

Requirement: Narrow the kustomize ignore entries

k8s/argocd/bootstrap/cluster.yaml SHALL remove the /spec/source/kustomize ignoreDifferences entries for ingress and mattermost, and SHALL narrow the devops entry to /spec/source/kustomize/images.

Scenario: Cluster app-of-apps ignores only the Image Updater digest

  • WHEN A test reads k8s/argocd/bootstrap/cluster.yaml.
  • THEN No entry names ingress or mattermost under /spec/source/kustomize, the devops entry lists only /spec/source/kustomize/images, and the finalizer jqPathExpressions entry remains.

Requirement: Cutover keeps Ingress available

The GitOps section of k8s/README.md SHALL order the cutover so the private source renders the hosts before the deploy-time overrides are removed.

Scenario: Cutover order preserves Ingress

  • WHEN A test reads the GitOps section of k8s/README.md.
  • THEN The section orders repository creation, repository Secret creation, the merge, devops and ingress syncs, the Ingress check, and the removal of the old spec.source.kustomize patches last, keeping spec.source.kustomize.images on devops.

Requirement: CI passes

The change SHALL pass uv run devops ci.

Scenario: CI passes

  • WHEN uv run devops ci runs on the change.
  • THEN The command exits with status 0.

Existing Tool Considered

Argo CD covers the GitOps sync and the repository Secret (https://argo-cd.readthedocs.io/en/stable/user-guide/best_practices/). Gitea covers the private repository, served in-cluster at http://gitea-http.gitea.svc.cluster.local:3000 (k8s/README.md:965). Neither renders the overlays from this repository's k8s/ nor removes the deploy-time overrides; the change extends the existing devops CLI (push-secrets and deploy-stack) for those. The alternatives check recorded not-applicable with no tool. The written cost is about 10,000 to 15,000 tokens to build, keep and fix the CLI, manifest, test and document changes, and one to two days.

Key questions

  • Which Gitea repository holds the homelab configuration: a mirror of the private homelab repository, or a dedicated configuration repository?: Use a dedicated homelab-config repository. Argo CD's best practices recommend a separate configuration repository, and the repository Secret then reaches only that repository. (proposed)
    • Chosen: Dedicated homelab-config repository. It separates config from source and limits the Argo CD credential to the configuration repository.
    • Rejected: Mirror of the private homelab repository. The credential and Argo CD would reach the whole private homelab repository, and its history would mix source and configuration.
  • How are the overlays kept in step with this repository's releases?: Pin each remote base to the release tag with ?ref=v<major>.<minor>.<patch>. Bump the pin in the private repository after release-please publishes the tag; the image digest moves independently through Argo CD Image Updater, so the bump is not the image-tag step. (best practice) [sources: docs/adr/0013-releases-use-release-please-as-it-ships-and-agents-stay-out.md:11, docs/adr/0013-releases-use-release-please-as-it-ships-and-agents-stay-out.md:19, k8s/argocd/image-updater-values.yaml:5]
    • Chosen: Pin to the release tag. Argo CD's best practices require a tag or commit SHA for a remote base, and a release tag names a release that release-please creates.
    • Rejected: Pin to a commit SHA. A commit SHA is also stable, but it names no release and needs a lookup after each release.
    • Rejected: Track main. A remote base to a moving branch changes meaning without a change in the private repository; Argo CD's best practices call this out.
    • Rejected: Use no pin. The remote base resolves HEAD, the least stable option.
  • Do the dynamic environments for open pull requests (feat(k8s): Point Argo CD to Gitea for git and PR dev images #1082) share this repository?: No. The generated Applications for open pull requests stay in feat(k8s): Point Argo CD to Gitea for git and PR dev images #1082; they do not share the homelab-config repository. (best practice) [sources: k8s/argocd/values.yaml:187]
    • Chosen: Separate generated Applications. The homelab configuration repository keeps one purpose and one credential scope.
    • Rejected: Share the homelab configuration repository. Generated environments would mix with homelab values and the repository Secret.
  • Which Applications need a homelab value today?: devops, ingress, and mattermost. [sources: src/devops_cli/config/constants.py:1131, k8s/argocd/bootstrap/cluster.yaml:29]
  • Which ignoreDifferences entries in cluster.yaml does the change remove?: Remove the ingress and mattermost /spec/source/kustomize entries. Narrow the devops entry to /spec/source/kustomize/images, because Argo CD Image Updater writes the Service digest there and the cluster app-of-apps must keep ignoring it. Keep the finalizer jqPathExpressions entry. (best practice) [sources: k8s/argocd/bootstrap/cluster.yaml:29, k8s/argocd/image-updater-values.yaml:5, k8s/README.md:1181, tests/invariants/test_k8s_argocd_apps.py:466]
    • Chosen: Narrow devops to images and remove ingress and mattermost. The host patches leave git, but Image Updater still writes spec.source.kustomize.images on devops.
    • Rejected: Remove all three entries. The devops diff would show Image Updater's digest and the app-of-apps would keep reporting OutOfSync.
    • Rejected: Keep all three entries. The host patches no longer exist, so the ignores hide a future override and keep the anti-pattern.
  • What does deploy-stack do on an Argo CD-managed cluster?: It writes no Application overrides and creates no devops-cli-config ConfigMap; the private repository's configMapGenerator owns the ConfigMap. The native path still renders the ConfigMap from config.yaml. (best practice) [sources: src/devops_cli/commands/k8s/stack_lifecycle.py:1217, src/devops_cli/commands/k8s/stack_lifecycle.py:1416, src/devops_cli/commands/k8s/stack_lifecycle.py:1458, src/devops_cli/k8s/configmap.py:125]
    • Chosen: Skip overrides and ConfigMap on Argo CD-managed clusters. Argo CD owns the Application source, and the private repository owns the values.
    • Rejected: Keep writing overrides. Argo CD calls this an anti-pattern, and a recreated Application loses the values.
    • Rejected: Skip the ConfigMap on every cluster. The native path has no other source for devops-cli.yaml.
  • What is the cutover order that avoids an Ingress outage?: Create the private repository and the repository Secret first, then merge the change. Wait for devops and ingress to sync from the private source, check the Ingress, and remove the old spec.source.kustomize patches last, keeping spec.source.kustomize.images on devops. (best practice) [sources: k8s/README.md:1145, k8s/argocd/bootstrap/cluster.yaml:29]
    • Chosen: Repository and Secret before merge, remove the old patches last. The private source renders the hosts before the old patches go, so the Ingress never loses its host.
    • Rejected: Remove the old overrides first. A sync without the private source or the old patches drops the hosts and breaks the Ingress.
    • Rejected: Merge before the repository Secret. The Applications cannot render the private source until Argo CD has the credential.
  • Which keyring entry and stack does the Argo CD repository Secret use?: The Secret is argocd/homelab-config-repo in stack infra, with username gitea_admin and password from gitea.admin_password. (best practice) [sources: docs/ENV_VARS.md:88, src/devops_cli/k8s/cluster_secrets.py:514, src/devops_cli/k8s/cluster_secrets.py:488]
    • Chosen: Reuse gitea.admin_password. It is the existing Gitea credential, and the repository Secret is scoped to the homelab-config URL.
    • Rejected: Add a read-only Gitea token. It adds a credential and a manual token creation that no command does today; it is a follow-up when Gitea token provisioning exists.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#1081, #1082

Activity

  1. added
    type/feature
    scope/k8s
    priority/p2-medium
    on Oct 7, 2026
  2. dan-petty-bot commented on Oct 7, 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. The current deploy-time override workaround functions but is an acknowledged anti-pattern; the change is strategically important yet blocked on #1081 and #1082 and has no active outage.
    • Value: Medium. It restores a proper GitOps flow, makes Application recreation safe, and aligns with Argo CD best practices, but the existing workaround still works today.
    • Effort: Medium. Requires a dedicated Gitea repo, Kustomize overlays with pinned refs, a repository Secret, deploy-stack changes, a documented cutover, and removal of the #1290 overrides, but each piece is well-scoped.
  3. 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. The change improves GitOps practices and cluster management but is not critical or urgent.
    • Value: High. Improves cluster stability, avoids anti-patterns, and aligns with Argo CD best practices.
    • Effort: Medium. Requires setting up a new repository, updating configurations, and managing secrets.
    • Related: feat(k8s): Point Argo CD to Gitea for git and PR dev images #1082, which asks for a different change. Both items involve Argo CD pointing to Gitea, but the candidate focuses on reading private configuration while item 1082 covers general git and container registry access for development versions.
  4. dan-petty commented on Oct 28, 2026

    @dan-petty
    OwnerAuthor

    Status set to Ready at 69636b6 (see proposed design in issue body).

  5. added
    status/ready
    effort/medium
    value/high
    on Oct 28, 2026
  6. dan-petty commented on Oct 28, 2026

    @dan-petty
    OwnerAuthor

    This item cannot be built as written. Its goal stays valid: the homelab's hosts and devops-cli-config leave the hand-set overrides on the Applications, so a manual sync or a recreated Application no longer drops them (#2195). But the mechanism that the item specifies does not work with how the cluster deploys now, and its prerequisites are not in place. No code was written.

    Evidence (origin/main and the live cluster, 2026-10-28; Argo CD v3.5.3)

    1. The ?ref= pin conflicts with ADR 0013. The overlays use this repository's k8s/ as a remote base pinned with ?ref=, and the proposed answer pins it "to the release tag and bump[s] it in the same step that bumps the image tag". ADR 0013 (2026-10-23) says: "Because Argo CD tracks main, a tag deploys nothing", and it deletes the release path. No step bumps an image tag now: Image Updater follows the digest of service:latest by itself (k8s/argocd/image-updater-values.yaml). A release-tag pin would hold devops and ingress at the last release, while the other 26 Applications track main.
    2. A pin on main makes devops and ingress deploy late. Argo CD "aggressively caches generated manifests and uses the repository commit SHA as a cache key", for 24 h by default, and "with Kustomize remote bases ... the expected manifests can change even though the repo has not changed" (https://argo-cd.readthedocs.io/en/stable/operator-manual/high_availability/). The cache key would be the commit of the Gitea repository, so a change to k8s/overlays/homelab/ on GitHub main reaches the cluster only when that cache expires. A multi-source Application does not help: its ref is documented for Helm valueFiles only (https://argo-cd.readthedocs.io/en/stable/user-guide/multiple_sources/).
    3. Criterion 3 cannot hold for devops. Image Updater writes spec.source.kustomize.images on the live devops Application (its write-back target). The ignoreDifferences entry and ServerSideApply=true on devops must stay for that field, whatever holds the hosts.
    4. The prerequisites are not in place.
    5. feat(k8s): Point Argo CD to Gitea for git and PR dev images #1082 proposes the opposite rule. Its proposed "Safety rule" says that no Application in git reads Gitea, so that a broken Gitea can always be fixed by a commit on GitHub. Its owner direction of 2026-10-06 says that Applications point to Gitea. A person decides which one holds before either item is built.

    Proposed re-scope

  7. added
    status/new
    and removed
    status/ready
    on Oct 28, 2026
  8. devops-cli-service commented on Oct 29, 2026

    @devops-cli-service
    Contributor

    Refine cannot set this item to Ready at a408dee 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.

  9. devops-cli-service commented on Oct 29, 2026

    @devops-cli-service
    Contributor

    Alternatives check: not-applicable

    Tool: none found

    Checked on 2026-10-29. A person decides what this means for the item. The check changes no label and closes no issue.

  10. devops-cli-service commented on Nov 5, 2026

    @devops-cli-service
    Contributor

    Refine cannot set this item to Ready at 502219a 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.

    • The proposal has no problem statement, no acceptance criterion with its requirement, scenario, WHEN and THEN, or no answer to the existing-tool question. State the problem, the requirements with their scenarios, and the open tool that covers the need or the cost of building it.
  11. changed the title [-]feat(k8s): argo cd reads the homelab's private configuration from the in-cluster gitea, and the deploy-time application overrides retire[/-] [+]feat(k8s): Read homelab config from in-cluster Gitea, drop overrides[/+] on Nov 6, 2026
  12. dan-petty commented on Nov 6, 2026

    @dan-petty
    OwnerAuthor

    The job shortened the title of this item. The summary had 125 characters, and the limit is 60. The type and the scope stay.

    • Before: feat(k8s): argo cd reads the homelab's private configuration from the in-cluster gitea, and the deploy-time application overrides retire
    • After: feat(k8s): Read homelab config from in-cluster Gitea, drop overrides
    • Source of the summary: the background model
  13. devops-cli-service commented on Nov 12, 2026

    @devops-cli-service
    Contributor

    Refine cannot set this item to Ready at 87ae9ee while the items below stay open. The next refine round looks at the item again when they close, or when a person replies in a comment or edits the body.

    The next refine round also looks at the item again when a commit on the default branch changes one of these files: k8s/argocd/networkpolicy.yaml.

  14. dan-petty commented on Nov 12, 2026

    @dan-petty
    OwnerAuthor

    Superseded by #5134. The owner decided on 2026-11-12: "once infra environment repo management is supported, we can move homelab configuration artifacts to that repo and update argocd config". dan-petty/homelab is private, so it holds the private values in git, and #5134 keeps the goal of this item: Argo CD reads the homelab configuration from a private repository, deploy-stack stops writing the overrides, and the ignoreDifferences of #1290 goes away. The Gitea config repository is no longer the plan; #1082 can later mirror dan-petty/homelab. Tracker: #5120. This item stays open for a person to close.

  15. devops-cli-service commented on Nov 18, 2026

    @devops-cli-service
    Contributor

    The result in the alternatives block of the issue body changed. Before this check: not-applicable, no tool. A person decides what the new result means for the item.

    Searches (6)

    Tools considered:

    Searches run:

    • Argo CD Kustomize remote base private repository ?ref= configMapGenerator, results: 5
    • Argo CD private configuration repository repository secret best practices, results: 5
    • argocd private repo documentation, results: 5
    • argo-cd kustomize remote base, results: 5
    • gitops separate config repository tool, results: 5
    • kustomize remote base git ref pin release tag, results: 5

    Sources:

  16. dan-petty commented on Nov 25, 2026

    @dan-petty
    OwnerAuthor

    Superseded by step 14 and step 15 of #5134. The private repository is dan-petty/homelab on GitHub, not on the in-cluster Gitea. Its Application files hold the hosts (dan-petty/homelab#242), and deploy-stack writes no override (#7258).

    One criterion of this item is not covered: deploy-stack still renders ConfigMap devops-cli-config and its sandbox copy from config.yaml, and no Application owns them. File that as its own item if the homelab repository should render them.

  17. removed
    status/new
    on Nov 25, 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