Deploy Proxmox Infra / Pulumi Deploy (pull_request) Skipped
Deploy Proxmox Infra / Pulumi Preview (pull_request) Successful in 59s
Deploy k8s Bootstrap / Pulumi Preview (pull_request) Successful in 41s
Deploy k8s Infra / Pulumi Preview (pull_request) Successful in 43s
Deploy Monitoring / Pulumi Preview (pull_request) Successful in 42s
Secret Scan / Betterleaks (pull_request) Successful in 6s
Deploy k8s Bootstrap / Bootstrap k3s Cluster (pull_request) Skipped
Deploy k8s Infra / Pulumi Deploy (pull_request) Skipped
Deploy k8s Apps / Pulumi Deploy (pull_request) Skipped
Deploy Monitoring / Pulumi Deploy (pull_request) Skipped
Deploy k8s Apps / Pulumi Preview (pull_request) Successful in 41s
58 lines
4.4 KiB
Markdown
58 lines
4.4 KiB
Markdown
# CLAUDE.md
|
||
|
||
<!-- Notes for the human, stripped before this file reaches Claude:
|
||
- Start Claude Code sessions from the repository root: the permission rules and
|
||
hooks in .claude/settings.json only load from there.
|
||
- Keep this file to what Claude can't work out from the code. Stack-specific notes
|
||
go in the stack's own CLAUDE.md, which loads when Claude touches that stack. -->
|
||
|
||
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`**: in `.pulumi-config/<stack-dir>/` (set by `stackConfigDir`). `.pulumi-config/` is a separate private repo, gitignored here and not a submodule, so this repo's `git status` doesn't show its changes; use `git -C .pulumi-config status`. These files contain the encryption salt: never delete them or secrets become unrecoverable, and never commit them to this repo. Any `0N-*/Pulumi.dev.yaml` is 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) and `PULUMI_CONFIG_PASSPHRASE` must be set.
|
||
- **CI**: PRs run `pulumi preview`. `01` and `03`–`05` deploy on push to `main`; `02` deploys only via manual dispatch. Automatic `01` deploys skip `pulumi 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.
|