Skip to content

feat(k8s): add the danielpetty-com namespace, project and Secret row #6642

Closed as not planned

Description

@dan-petty

Problem

Checked at devops-cli main 3f8f7a9.

  • The private repository dan-petty/danielpetty.com will run on this cluster at danielpetty-com.<domain>. Owner decision 2026-11-21: the k3s cluster is the only hosted deployment of the site. The site repository keeps its own Kustomize manifests (dan-petty/danielpetty.com#29). The platform side does not exist yet:
    • k8s/namespaces.yaml has no namespace for the site. Each namespace there sets its Pod Security level and argocd.argoproj.io/sync-options: Prune=false,Delete=false (for example mattermost, k8s/namespaces.yaml:125-134).
    • No AppProject admits the site repository. Project homelab allows every cluster-scoped kind (k8s/argocd/apps/projects.yaml:8-10), so a second repository in it could write any cluster-scoped object. Project trial is the narrow precedent: clusterResourceWhitelist: [] (projects.yaml:206-210).
    • The event-stream reads NOTE_API_KEY (the bearer key of POST /api/notes) and an optional GITHUB_TOKEN. Each cluster Secret is a row in src/devops_cli/k8s/cluster_secrets.py. A person pushes it before the merge of the manifest that reads it (docs/SERVICE_PATTERNS.md CF4, CF5).
    • DETACHED_STACKS (cluster_secrets.py:34) holds the stacks that deploy-stack never deploys. deploy-stack pushes a detached stack only where a namespace with the name of the stack exists (src/devops_cli/commands/k8s/stack_lifecycle.py:892-905). push-secrets skips each row whose namespace does not exist (src/devops_cli/k8s/secret_push.py:453-470). So the stack of the site takes the name of its namespace.
    • monitoring-default-perimeter lets Alloy reach only the namespaces and ports of its egress list (k8s/monitoring/networkpolicy.yaml). Alloy cannot scrape a new namespace until the list has it.
    • Argo CD reads a private repository only through a repository Secret. The only one is argocd/repo-homelab (k8s/README.md:1089), and project homelab ignores it as an orphan (projects.yaml:115-117).
    • The GitHub App devops-cli-argocd is installed on dan-petty/homelab (docs/HOMELAB_REPO_SWITCH.md:133). The CLI token cannot read the repository list of the installation (user/installations returns HTTP 403), so it is not known if the installation includes the site repository.

Proposed remedy

Use an Argo CD AppProject and the push-secrets table. Add no new code path.

  • k8s/namespaces.yaml: namespace danielpetty-com with Pod Security enforce, warn and audit restricted, and Prune=false,Delete=false.
  • k8s/argocd/apps/projects.yaml: a new AppProject danielpetty-com:
    • sourceRepos: only https://github.com/dan-petty/danielpetty.com;
    • destinations: only namespace danielpetty-com (feat(k8s): add the danielpetty-com-pixelfed namespace and Secrets #6645 adds the Pixelfed namespace);
    • clusterResourceWhitelist: [], and a namespaceResourceBlacklist with Role and RoleBinding;
    • orphanedResources.warn: true with an ignore entry for Secret event-stream.
  • Project homelab: an orphan ignore entry for Secret repo-danielpetty-com, as for repo-homelab.
  • cluster_secrets.py: add danielpetty-com to DETACHED_STACKS. Add row danielpetty-com/event-stream in stack danielpetty-com:
    • NOTE_API_KEY: keyring danielpetty_com_note_api_key, required, generator urlsafe with 32 bytes;
    • GITHUB_TOKEN: keyring danielpetty_com_github_token, not required, no generator;
    • restarts deployment/event-stream.
  • k8s/monitoring/networkpolicy.yaml: egress to namespace danielpetty-com on TCP 9090, the metrics port of feat(event-stream): export harvest metrics on a private port danielpetty.com#28.
  • k8s/README.md: the row in the Cluster Secrets table, and the repository Secret repo-danielpetty-com beside repo-homelab.
  • Change each test first. This pull request adds no Application: feat(argocd): deploy the danielpetty-com event-stream from its repository #6644 adds it after the push.

Premise check: #5134 plan step 12 adds a temporary check that refuses changes to the old environment paths in devops-cli. If that check is on main when you start, stop and return this item with the evidence. The change then goes to dan-petty/homelab.

Acceptance criteria

  • uv run devops ci --check --only k8s,kube-linter,domain passes.
  • kubectl kustomize k8s | yq 'select(.kind == "Namespace" and .metadata.name == "danielpetty-com") | .metadata' shows the three restricted labels and Prune=false,Delete=false.
  • yq 'select(.metadata.name == "danielpetty-com") | .spec' k8s/argocd/apps/projects.yaml shows one source repository, one destination, clusterResourceWhitelist: [] and the RBAC blacklist.
  • uv run devops k8s push-secrets --stack danielpetty-com --dry-run lists NOTE_API_KEY and GITHUB_TOKEN and no value.
  • A unit test shows that the row generates NOTE_API_KEY when the keyring has no value, and skips GITHUB_TOKEN.
  • After the merge and the sync of Application base: kubectl get ns danielpetty-com -L pod-security.kubernetes.io/enforce shows restricted.

Person steps

After the merge and the sync of Application base:

  1. Optional: put a fine-grained GitHub token with read access to public data only into keyring entry danielpetty_com_github_token. Without it, the harvester has the lower anonymous rate limit of the GitHub API.
  2. Run uv run devops k8s push-secrets --stack danielpetty-com --plan, then uv run devops k8s push-secrets --stack danielpetty-com. Copy the note key from keyring entry danielpetty_com_note_api_key into your note client.
  3. In the installation settings of the GitHub App devops-cli-argocd, add dan-petty/danielpetty.com to the selected repositories. The App has Contents: read (Argo CD reads the manifests) and Deployments: write (the deploy notifier of feat(argocd): deploy the danielpetty-com event-stream from its repository #6644 writes deployment statuses).
  4. Create the repository Secret repo-danielpetty-com in namespace argocd: label argocd.argoproj.io/secret-type: repository, type git, URL https://github.com/dan-petty/danielpetty.com, project: danielpetty-com, and the App ID, installation ID and private key of devops-cli-argocd (the values of repo-homelab). Never put this Secret in git. Check: argocd repo list --core shows the repository as Successful.

Dependencies

None. During the homelab switch (#5134), plan step 10 copies the new environment files into dan-petty/homelab.

Activity

  1. added
    type/feature
    scope/k8s
    source/agent
    status/new
    value/medium
    effort/medium
    on Nov 21, 2026
  2. dan-petty commented on Nov 21, 2026

    @dan-petty
    OwnerAuthor
    • Related: dan-petty/homelab#329, which asks for a different change. Both configure Argo CD AppProjects in projects.yaml, but 1646 restricts existing projects while the candidate adds a new project for the danielpetty-com site.
  3. added
    priority/p2-medium
    owner/agent
    status/in-progress
    and removed
    status/new
    on Nov 21, 2026
  4. dan-petty commented on Nov 21, 2026

    @dan-petty
    OwnerAuthor

    Closed as not planned. Owner direction of 2026-11-21: the platform holds no code, row or constant of one service, and Argo CD apps manage the service repositories with best practices. PR #6652 is already closed. Replacements: the tenant chart of dan-petty/infra (dan-petty/infra#10) makes the namespace with its Pod Security labels, a default-deny NetworkPolicy and an AppProject with one source repository, only its own namespaces, no cluster-scoped kind and an allow-list with no Secret or RBAC kind. One services entry in dan-petty/homelab (dan-petty/homelab#85) gives the values, through the services ApplicationSet (dan-petty/infra#11, dan-petty/homelab#80). The service Secrets come from External Secrets Operator in the site repository (ADR #6675, templates dan-petty/infra#12, operator dan-petty/homelab#82, dan-petty/danielpetty.com#29), not from a row in src/devops_cli/k8s/cluster_secrets.py. Monitoring reaches the namespace by a label (dan-petty/homelab#81). The repository credential is one credential template that the owner makes (person step of dan-petty/homelab#80).

  5. removed
    status/in-progress
    owner/agent
    on Nov 21, 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/k8ssource/agenttype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions