4.4 KiB
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-bootstrapreads VM IDs, node IPs, Proxmox credentials, and the SSH private key fromproxmox-infra.k8s-infra,k8s-apps, andmonitoringreadkubeconfigfromk8s-bootstrap(requireOutput("kubeconfig")). Never setkubeconfigas Pulumi config in these stacks.monitoringadditionally readsdomainfromk8s-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: in.pulumi-config/<stack-dir>/(set bystackConfigDir)..pulumi-config/is a separate private repo, gitignored here and not a submodule, so this repo'sgit statusdoesn't show its changes; usegit -C .pulumi-config status. These files contain the encryption salt: never delete them or secrets become unrecoverable, and never commit them to this repo. Any0N-*/Pulumi.dev.yamlis an unused old copy; don't edit it.- Config changes: CI checks out the config repo's
main, so a local preview can use config that CI doesn't have yet. After config changes, remind me to commit and push them there, before opening or updating a PR that needs them. That push doesn't start a deploy. The commit rule below applies to that repo too. Setup steps are in.pulumi-config/README.md. - Private repos: don't write a private repo's name, owner/name path or URL in READMEs or other docs. Say "the private config repo", or use a placeholder. Naming it in workflows is fine, and so is the local folder name
.pulumi-config/. - Environment:
PULUMI_BACKEND_URL(self-hosted Postgres backend) andPULUMI_CONFIG_PASSPHRASEmust be set. - CI: PRs run
pulumi preview.01and03–05deploy on push tomain;02deploys only via manual dispatch. Automatic01deploys skippulumi refresh, so run its workflow manually after changing VMs in the Proxmox GUI.
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.