Files
homelab-infrastructure-as-code/CLAUDE.md
kasun 897813a916 docs: trim CLAUDE.md files to what the code doesn't show
Following the Claude Code memory docs: drop architecture lists, generic commands and CI details Claude can read from the code, keep the reasons behind decisions, and fix the outdated provider and pfSense SDK statements.
2026-11-20 21:48:20 +01:00

3.5 KiB
Raw Permalink Blame History

CLAUDE.md

Pulumi (TypeScript) IaC for a Proxmox-based k3s homelab. Each 0N-* directory is an independent Pulumi project ("stack"), all using the Pulumi stack name dev.

Deployment order & StackReferences

proxmox-infra → k8s-bootstrap → k8s-infra
                              ↘ k8s-apps → monitoring
  • k8s-bootstrap reads VM IDs, node IPs, Proxmox credentials, and the SSH private key from proxmox-infra.
  • k8s-infra, k8s-apps, and monitoring read kubeconfig from k8s-bootstrap (requireOutput("kubeconfig")). Never set kubeconfig as Pulumi config in these stacks.
  • monitoring additionally reads domain from k8s-apps.
  • StackReference format: ${pulumi.getOrganization()}/<stack-name>/dev.
  • A stack's outputs must exist (it must have been deployed) before a downstream stack referencing it will succeed.

Shared conventions

  • Secrets: read via config.requireSecret(), never via environment variables or hardcoded values.
  • Pulumi.dev.yaml: gitignored (contains the encryption salt). Never delete it or secrets become unrecoverable. CI restores it from a base64 Gitea secret <STACK>_PULUMI_DEV_YAML; after changing local config, remind me to update that secret.
  • Environment: PULUMI_BACKEND_URL (self-hosted Postgres backend) and PULUMI_CONFIG_PASSPHRASE must be set.
  • CI: PRs run pulumi preview. 03–05 deploy on push to main; 01/02 deploy only via manual dispatch.

Git conventions

Branch names, commit messages and PR titles follow @CONVENTIONS.md. The commit-msg hook needs git config core.hooksPath .githooks once per clone.

Only commit when I explicitly say "commit" for that change. A yes to a question that also mentioned committing is not enough; when unsure, ask.

The remote is a self-hosted Gitea, so gh doesn't work. For PRs and their CI status use .claude/scripts/gitea.sh (acts as claude-bot), e.g. .claude/scripts/gitea.sh GET '/repos/kasun/homelab-infrastructure-as-code/pulls?state=open'. Use it for PRs only, and ask before opening or merging one.

Live infrastructure

  • Don't change live systems (cluster, pfSense, Proxmox, VMs, my local kubeconfig) on your own initiative, even for small or reversible changes. Give me the exact steps and let me decide who runs them.
  • Code edits in the repo are fine without asking.
  • Never recreate VMs to apply a change. Write code for a clean fresh install, plus separate manual steps for the running cluster.

Looking things up

  • Reading is free: files in this repo, git history, read-only kubectl and pulumi commands.
  • Search targeted. If two or three searches don't find it, stop and ask me where it is instead of searching the whole filesystem.
  • Stay inside this repo unless I point you somewhere else.

Verifying changes

After editing a stack, run npm run typecheck in that stack's directory, then pulumi preview, and show the output of both. A passing typecheck only proves the code compiles; the preview is what shows which resources would be created, updated or replaced.

Don't silence a check to make it pass (@ts-ignore, as any, git commit --no-verify) without a stated reason and my OK.