Compare commits

...
Author SHA1 Message Date
kasun 356f5b7ad4 bug: stop kubeconfig address change from replacing k8s resources
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 Infra / Pulumi Preview (pull_request) Successful in 45s
Deploy k8s Apps / Pulumi Preview (pull_request) Successful in 39s
Deploy Monitoring / Pulumi Preview (pull_request) Successful in 43s
Secret Scan / Betterleaks (pull_request) Successful in 7s
k8s-bootstrap now exports the control-plane VIP while these stacks have master-1 stored in state. Pulumi treats the new server address as a different cluster and plans to replace the provider and every resource under it, including Longhorn and PVCs. Ignore kubeconfig changes on the provider so the stacks keep their stored connection.
2026-11-23 01:03:05 +01:00
claude-bot Bot 6647d55050 Merge pull request 'Enhancement: Harden k8s-bootstrap commands against silent failures' (#56) from enhancement/harden-k8s-bootstrap into main
Secret Scan / Betterleaks (push) Successful in 6s
2026-11-23 00:40:14 +01:00
kasun 13330ef3fb enhancement(k8s-bootstrap): harden bootstrap commands against silent failures
Deploy k8s Bootstrap / Bootstrap k3s Cluster (pull_request) Skipped
Deploy k8s Bootstrap / Pulumi Preview (pull_request) Successful in 39s
Secret Scan / Betterleaks (pull_request) Successful in 7s
A changed node IP or SSH key could re-run the unpinned k3s installer on live nodes, so ignore connection changes and pin k3s to the version the cluster runs.

Several steps reported success without reaching the desired state: a failed Longhorn mount fell through to the root disk, any HTTP error passed the VIP check, and VM start errors were swallowed. Each step now checks its outcome. mkfs only runs when blkid reports an empty disk, and package installs wait for cloud-init.
2026-11-23 00:38:52 +01:00
claude-bot Bot 855d1cce85 Merge pull request 'Chore: Add Betterleaks secret scanning to commits and CI' (#55) from chore/add-secret-scanning into main
Deploy k8s Infra / Pulumi Preview (push) Skipped
Deploy k8s Apps / Pulumi Preview (push) Skipped
Deploy Monitoring / Pulumi Preview (push) Skipped
Deploy k8s Infra / Pulumi Deploy (push) Successful in 46s
Deploy Monitoring / Pulumi Deploy (push) Successful in 42s
Deploy k8s Apps / Pulumi Deploy (push) Successful in 41s
Secret Scan / Betterleaks (push) Successful in 5s
2026-11-23 00:16:16 +01:00
kasun 9b388ff8e2 chore(ci): scan full Git history for secrets
Deploy Proxmox Infra / Pulumi Deploy (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 Proxmox Infra / Pulumi Preview (pull_request) Successful in 53s
Deploy k8s Infra / Pulumi Preview (pull_request) Successful in 42s
Deploy k8s Apps / Pulumi Preview (pull_request) Successful in 38s
Deploy Monitoring / Pulumi Preview (pull_request) Successful in 38s
Secret Scan / Betterleaks (pull_request) Successful in 6s
Covers commits that never ran the local hook, such as edits made in the
Gitea web editor.
2026-11-23 00:12:57 +01:00
kasun 0d5f49591a chore: block secrets in commits with a Betterleaks hook
The ignore file covers one old Gitea token in deleted .env.local, which
was confirmed revoked (API returned 401).
2026-11-23 00:12:55 +01:00
kasun 12400b4c83 chore(ci): deploy stacks only on their own workflow changes
Any file under .gitea/workflows triggered pulumi up on 03, 04 and 05, so
adding an unrelated workflow would deploy all three. PR previews still
watch the whole folder.
2026-11-23 00:12:53 +01:00
claude-bot Bot 05bec1a5ff Merge pull request 'Chore: Upgrade pfSense provider bridge to 1.5.1' (#54) from chore/upgrade-pfsense-provider-bridge into main
Deploy Proxmox Infra / Pulumi Deploy (push) Successful in 46s
Deploy Proxmox Infra / Pulumi Preview (push) Skipped
2026-11-22 20:02:15 +01:00
kasun f6f74d9977 chore(proxmox-infra): upgrade pfSense provider bridge to 1.5.1
Deploy Proxmox Infra / Pulumi Deploy (pull_request) Skipped
Deploy Proxmox Infra / Pulumi Preview (pull_request) Successful in 50s
Pin the bridge and pfSense provider versions so local SDK generation
matches the deployed state. The regenerated SDK requires a newer
@pulumi/pulumi, which updates the lockfile.
2026-11-22 20:00:59 +01:00
claude-bot Bot f2b8704914 Merge pull request 'Docs: Update deploy triggers for automatic Proxmox deploys' (#53) from docs/update-deploy-triggers into main 2026-11-22 19:34:00 +01:00
kasun be09d7592f docs: update deploy triggers now that proxmox-infra deploys on merge 2026-11-22 19:31:45 +01:00
claude-bot Bot abac1bf532 Merge pull request 'Chore: Add read-only CI wait to the Gitea helper' (#52) from chore/add-ci-wait-command into main 2026-11-22 19:29:37 +01:00
kasun 282e1c5236 chore: add read-only CI wait to the Gitea helper
Polling CI with a shell loop triggered a permission prompt during /merge.
A dedicated WAIT command can be allowlisted on its own.
2026-11-22 19:27:04 +01:00
claude-bot Bot 339dcdd214 Merge pull request 'Enhancement: Deploy Proxmox infra automatically on merge' (#51) from enhancement/auto-deploy-proxmox-infra into main
Deploy Proxmox Infra / Pulumi Preview (push) Skipped
Deploy k8s Infra / Pulumi Preview (push) Skipped
Deploy k8s Apps / Pulumi Preview (push) Skipped
Deploy Monitoring / Pulumi Preview (push) Skipped
Deploy Proxmox Infra / Pulumi Deploy (push) Successful in 1m46s
Deploy k8s Infra / Pulumi Deploy (push) Successful in 48s
Deploy Monitoring / Pulumi Deploy (push) Successful in 44s
Deploy k8s Apps / Pulumi Deploy (push) Successful in 38s
2026-11-22 19:21:35 +01:00
kasun 9b15ea5d33 enhancement(ci): deploy proxmox-infra on merge to main
Deploy Proxmox Infra / Pulumi Deploy (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 Proxmox Infra / Pulumi Preview (pull_request) Successful in 1m1s
Deploy k8s Infra / Pulumi Preview (pull_request) Successful in 54s
Deploy k8s Apps / Pulumi Preview (pull_request) Successful in 34s
Deploy Monitoring / Pulumi Preview (pull_request) Successful in 43s
Skip the refresh on automatic deploys. A refresh that finds a VM missing
drops it from state, and the following up would create a blank replacement.
2026-11-22 18:42:30 +01:00
kasun 344f748b84 enhancement(proxmox-infra): protect resources and stop update reboots
Prepare the stack for deploying on merge. Protect templates, DHCP mappings
and the Ansible container, and stop in-place updates from rebooting k3s VMs.
2026-11-22 18:42:30 +01:00
claude-bot Bot 84cf39e7d9 Merge pull request 'Chore: Add merge skill for the commit-to-merge workflow' (#50) from chore/add-merge-skill into main 2026-11-22 18:29:07 +01:00
kasun afc9fd36d7 chore: add merge skill for the commit-to-merge workflow 2026-11-22 18:26:42 +01:00
claude-bot Bot 3e6c8188da Merge pull request 'Chore: Allow common read-only commands in Claude settings' (#49) from chore/allow-readonly-commands into main 2026-11-22 18:26:28 +01:00
claude-bot Bot 4c3a2b4226 Merge pull request 'Feature: Add Ansible control node LXC' (#48) from feature/add-ansible-control-node into main 2026-11-22 18:26:16 +01:00
kasun c40fc0caac chore: allow common read-only commands in Claude settings 2026-11-22 18:18:43 +01:00
kasun 49fd2ba307 feature(proxmox-infra): add Ansible control node LXC
Deploy Proxmox Infra / Pulumi Deploy (pull_request) Skipped
Deploy Proxmox Infra / Pulumi Preview (pull_request) Successful in 1m1s
Fix the container's MAC so its pfSense DHCP reservation exists before
first boot. Otherwise the first lease could come from the dynamic pool.
2026-11-22 18:08:02 +01:00
claude-bot Bot 85ce271fd6 Merge pull request 'Enhancement: Protect VM templates from deletion' (#47) from enhancement/protect-vm-templates into main 2026-11-22 03:26:42 +01:00
kasun 7548402542 enhancement(proxmox-infra): protect VM templates from deletion
Deploy Proxmox Infra / Pulumi Deploy (pull_request) Skipped
Deploy Proxmox Infra / Pulumi Preview (pull_request) Successful in 1m7s
2026-11-22 03:25:16 +01:00
claude-bot Bot 9e0ce35712 Merge pull request 'Enhancement: Protect k3s VMs from accidental replacement' (#46) from enhancement/protect-k3s-vms into main 2026-11-22 03:10:09 +01:00
kasun c1e409780d enhancement(proxmox-infra): protect k3s VMs from replacement
Deploy Proxmox Infra / Pulumi Deploy (pull_request) Skipped
Deploy Proxmox Infra / Pulumi Preview (pull_request) Successful in 1m0s
A stale state can make Pulumi plan new VMs for machines that already exist. Protection makes such an update fail instead of being applied.
2026-11-22 03:08:44 +01:00
claude-bot Bot 5a2d32ea84 Merge pull request 'Bug: Stop bootstrap from re-running k3s install on live nodes' (#45) from bug/stop-bootstrap-reruns into main 2026-11-22 02:59:35 +01:00
kasun e3fab0e151 bug(k8s-bootstrap): stop re-running install commands on live nodes
Deploy k8s Bootstrap / Bootstrap k3s Cluster (pull_request) Skipped
Deploy k8s Bootstrap / Pulumi Preview (pull_request) Successful in 40s
Bootstrap commands used VM IDs as triggers, so renumbering VMs would re-run the unpinned k3s installer on every node and append duplicate fstab entries. Treat them as run-once and re-run them explicitly after recreating a VM. Also start master-2 through pve-esprimo, where it now lives.
2026-11-22 02:58:30 +01:00
claude-bot Bot a1867b18c8 Merge pull request 'Bug: Stop permanent disk speed diffs on k3s VMs' (#43) from bug/ignore-disk-speed-diff into main 2026-11-22 02:27:45 +01:00
kasun 71b0f3ce7d bug(proxmox-infra): ignore permanent disk speed diff
Deploy Proxmox Infra / Pulumi Deploy (pull_request) Skipped
Deploy Proxmox Infra / Pulumi Preview (pull_request) Successful in 1m2s
The Pulumi bridge applies the provider's internal default for the disk speed block, but Proxmox stores nothing when no limit is set, so every preview shows a change that can never settle. Ignore the field per disk because the wildcard form is reported not to work with this provider.
2026-11-22 02:25:59 +01:00
claude-bot Bot d0600b9153 Merge pull request 'Chore: Let Claude Code commit, push and open PRs without a prompt' (#40) from chore/allow-git-write-commands into main 2026-11-21 15:57:10 +01:00
kasun 7acf83e68d chore: keep the permission prompt for merging PRs 2026-11-21 15:56:49 +01:00
kasun 088cb5add1 chore: allow Claude Code to commit, push and open PRs without a prompt
CLAUDE.md already requires an explicit request before committing or opening a PR, so the extra permission prompt only repeated that approval.
2026-11-21 15:54:45 +01:00
kasun b04ab52fd2 Merge pull request 'Bug: Prevent Longhorn disks filling up after node outages' (#39) from bug/longhorn-storage-exhaustion into main
Deploy k8s Infra / Pulumi Preview (push) Skipped
Deploy k8s Infra / Pulumi Deploy (push) Successful in 1m4s
Reviewed-on: #39
2026-11-21 15:52:36 +01:00
kasun ff2b565677 bug(k8s-infra): prevent Longhorn disks filling up after node outages
Deploy k8s Infra / Pulumi Deploy (pull_request) Skipped
Deploy k8s Infra / Pulumi Preview (pull_request) Successful in 51s
Orphaned replica data and a large snapshot left no room for a second Prometheus replica, so the volume faulted when its only replica failed. Clean up orphans and system snapshots, trim volumes daily, and lower the free-space reserve to 10% because longhorn-extra is a dedicated disk. Align the UI default with the StorageClass at 3 replicas so volumes keep two copies during a node reboot.
2026-11-21 15:49:07 +01:00
claude-bot Bot 4b22f4ad11 Feature: Expose the Longhorn UI at longhorn.<domain> behind basic auth
Deploy k8s Infra / Pulumi Preview (push) Skipped
Deploy k8s Infra / Pulumi Deploy (push) Successful in 48s
2026-11-21 02:41:43 +01:00
21 changed files with 818 additions and 1732 deletions

No files matched your search

+2
View File
@@ -0,0 +1,2 @@
# Old Gitea token in deleted .env.local. Confirmed revoked (API returned 401) on 2026-11-22.
8c69ec772ab5f0df73fa2614e5b8b22adb9bbd15:.env.local:gitea-access-token:2
+29 -2
View File
@@ -7,14 +7,18 @@
#
# Scope: used for PRs only (list, open, check CI status, merge after your OK).
# Technically it can call any endpoint; CLAUDE.md limits its use to PRs.
# In .claude/settings.json, GET runs without a prompt; POST, PATCH, PUT and
# DELETE (anything that changes something) always ask first.
# In .claude/settings.json, GET and POST (e.g. opening a PR) run without a
# prompt. Merging a PR (POST .../merge), PATCH, PUT and DELETE always ask first.
#
# Usage: gitea.sh METHOD PATH [BODY]
# METHOD GET | POST | PATCH | PUT | DELETE
# PATH path below /api/v1, e.g. /repos/kasun/homelab-infrastructure-as-code/pulls?state=open
# BODY JSON string, or @file to send a file
#
# Read-only CI wait: gitea.sh WAIT /repos/OWNER/REPO/commits/SHA/status
# Polls until checks finish. Exit 0: passed or no CI ran. 1: a check failed.
# 2: bad usage. 3: timed out after 15 minutes.
#
# Config (outside the repo, never committed):
# ${XDG_CONFIG_HOME:-~/.config}/homelab-agent/url e.g. http://192.168.1.208:3000
# ${XDG_CONFIG_HOME:-~/.config}/homelab-agent/token chmod 600
@@ -28,6 +32,29 @@ method=${1:?usage: gitea.sh METHOD PATH [BODY]}
path=${2:?usage: gitea.sh METHOD PATH [BODY]}
body=${3:-}
if [[ "$method" == "WAIT" ]]; then
[[ "$path" =~ ^/repos/[^/]+/[^/]+/commits/[0-9a-f]{40}/status$ ]] \
|| { echo "WAIT only accepts /repos/OWNER/REPO/commits/SHA/status" >&2; exit 2; }
for ((i = 1; i <= 45; i++)); do
status=$("$0" GET "$path") || status='{}'
total=$(jq '.statuses // [] | length' <<<"$status")
running=$(jq '[.statuses // [] | .[] | select(.status == "pending" or .status == "running")] | length' <<<"$status")
# Give checks time to register. Path-filtered workflows may never start any.
if (( total == 0 && i >= 7 )); then
echo "no CI ran"
exit 0
fi
if (( total > 0 && running == 0 && i >= 4 )); then
jq -r '.statuses[] | "\(.context): \(.status) \(.target_url)"' <<<"$status"
jq -e '[.statuses[].status] | any(. == "failure" or . == "error") | not' <<<"$status" >/dev/null || exit 1
exit 0
fi
sleep 20
done
echo "timed out waiting for CI" >&2
exit 3
fi
case "$method" in
GET | POST | PATCH | PUT | DELETE) ;;
*) echo "unsupported method: $method" >&2; exit 2 ;;
+44 -3
View File
@@ -20,9 +20,52 @@
"Bash(kubectl logs *)",
"Bash(kubectl top *)",
"Bash(kubectl config get-contexts *)",
"Bash(git log *)",
"Bash(git status *)",
"Bash(git diff *)",
"Bash(git show *)",
"Bash(git grep *)",
"Bash(git blame *)",
"Bash(git ls-files *)",
"Bash(git ls-tree *)",
"Bash(git rev-parse *)",
"Bash(git describe *)",
"Bash(git shortlog *)",
"Bash(git merge-base *)",
"Bash(git reflog show *)",
"Bash(git stash list *)",
"Bash(git branch --list *)",
"Bash(git branch -a *)",
"Bash(git branch -v *)",
"Bash(git tag --list *)",
"Bash(git remote -v)",
"Bash(git fetch *)",
"Bash(pulumi about *)",
"Bash(pulumi plugin ls *)",
"Bash(kubectl api-resources *)",
"Bash(kubectl api-versions *)",
"Bash(kubectl explain *)",
"Bash(kubectl version *)",
"Bash(kubectl events *)",
"Bash(kubectl cluster-info)",
"Bash(kubectl auth can-i *)",
"Bash(kubectl rollout status *)",
"Bash(kubectl rollout history *)",
"Bash(kubectl config current-context *)",
"Bash(npm ls *)",
"Bash(npm outdated *)",
"Bash(ls *)",
"Bash(pwd)",
"Bash(wc *)",
"Bash(which *)",
"Bash(jq *)",
"Bash(git add *)",
"Bash(git switch *)",
"Bash(.claude/scripts/gitea.sh GET *)",
"Bash(.claude/scripts/gitea.sh WAIT *)",
"Bash(.claude/scripts/gitea.sh POST *)",
"Bash(git commit *)",
"Bash(git push *)",
"WebFetch(domain:www.pulumi.com)",
"WebFetch(domain:github.com)",
"WebFetch(domain:raw.githubusercontent.com)",
@@ -51,9 +94,7 @@
"Bash(ssh *)",
"Bash(scp *)",
"Bash(curl *)",
"Bash(git commit *)",
"Bash(git push *)",
"Bash(.claude/scripts/gitea.sh POST *)",
"Bash(.claude/scripts/gitea.sh POST */merge*)",
"Bash(.claude/scripts/gitea.sh PATCH *)",
"Bash(.claude/scripts/gitea.sh PUT *)",
"Bash(.claude/scripts/gitea.sh DELETE *)"
+96
View File
@@ -0,0 +1,96 @@
---
name: merge
description: Commit the staged and unstaged changes that fit the branch with meaningful messages, push a branch, open a Gitea PR, wait for CI, and merge it, without stopping for confirmation.
argument-hint: [optional note on intent, or paths to limit the merge to]
disable-model-invocation: true
---
Take the working tree changes through commit, push, PR and merge in one run. If `$ARGUMENTS` names paths, include only those. If it describes intent, use it for the commit messages and PR.
Typing `/merge` is the user's explicit instruction to commit, push, open a PR and merge these changes. It satisfies the "commit" and "ask before opening or merging" rules in `CLAUDE.md` for this run. Do not ask for confirmation, and do not pause to show drafts. Stop only for a condition under "Stop conditions".
## Rules
- Follow `CONVENTIONS.md` for branch names, commit messages and PR titles.
- Add no AI attribution to commits or PRs.
- Never use `--no-verify`, force push, or commit directly to `main`.
- Use `.claude/scripts/gitea.sh` for PR calls, because `gh` does not work here. `$REPO` below means `/repos/kasun/homelab-infrastructure-as-code`, and must be written out in full in each command.
- Never stage `Pulumi.dev.yaml`, `.env` files, keys, credentials, `.claude/settings.local.json`, or anything in `sdks/`. Leave them out, carry on, and mention them in the report.
- Write commit messages and JSON bodies to files in the scratchpad directory with the Write tool.
- Run each command on its own, in the exact forms below, from the repo root. `cd` prefixes, pipes, loops and redirects cause permission prompts.
## Stop conditions
Stop and report only if:
- HEAD is detached, or a merge or rebase is in progress.
- There are no changes and no unpushed commits.
- Typecheck or `pulumi preview` fails.
- The preview shows a replace or delete of a VM, a PVC, or an imported resource.
- A file that looks like a secret is the only change.
- A commit hook, push or API call fails after one corrected retry of a message-format error.
- CI fails, or the PR is not mergeable.
Leave the branch and PR in place when stopping after they exist, and say what is needed to continue.
## 1. Inspect
1. Run `git status`, `git diff --staged`, `git diff`, and `git log --oneline -5`. Read any untracked files that would be included.
2. Run `git fetch origin main`.
3. On a non-`main` branch, run `.claude/scripts/gitea.sh GET $REPO/pulls?state=open`. If this branch has an open PR, reuse it only for changes that serve its purpose. If all remaining changes are unrelated to it, take that PR through steps 6 and 7 first, which returns you to `main`, then continue with the remaining changes as new work.
## 2. Group into commits
Split by reason for the change, and decide without asking. Each commit should make sense and be revertable alone.
- First decide the PR's purpose from `$ARGUMENTS`, the conversation, the branch name, or else the largest change.
- On the first `/merge`, leave out any change that does not serve that purpose, such as an unrelated `.claude/settings.json` edit. Keep it uncommitted and untouched, do not ask, and list it in the report.
- On a repeat `/merge`, meaning an earlier run this session left changes out or its PR is still open, handle all remaining changes in this run. Give each separate purpose its own branch and PR, and take them one at a time through steps 3 to 7, so each is merged and you are back on `main` before the next starts. If `$ARGUMENTS` names paths, handle only those.
- Use one commit when the remaining changes serve one purpose, and several when they are distinct steps toward it.
- Group whole files. If one file mixes purposes, put it in the commit for its main change.
- Scope is the stack (`01-proxmox-infra/` is `proxmox-infra`), or `ci` for `.gitea/workflows/`. Omit the scope for repo-wide or `.claude/` changes.
- Add a body only when the diff shows a reason that is not obvious. Never invent a reason.
## 3. Verify
For each stack with changed code, run:
- `npm run typecheck --prefix <stack-dir>`
- `pulumi preview --cwd <stack-dir> --stack dev`
## 4. Commit and push
1. If on `main`, run `git switch -c <type>/<short-kebab-description>`. This carries the changes across.
2. For each commit, run `git add -- <paths>`, then `git commit -F <message file> -- <paths>`. Naming the paths commits only those files, whatever else is staged.
3. Run `git status` to confirm only intentionally excluded files remain.
4. Run `git push -u origin <branch>`.
## 5. Open the PR
Unless one exists, run `.claude/scripts/gitea.sh POST $REPO/pulls @<json file>` with `title`, `body`, `head` and `base: "main"`. The body says what changed, why, and the preview result for each stack.
## 6. Wait for CI
Get the SHA with `git rev-parse HEAD`, then run `.claude/scripts/gitea.sh WAIT $REPO/commits/<sha>/status` as a background command. Do not write a polling loop, because that causes a permission prompt.
- Exit 0: checks passed, or it printed `no CI ran` because workflows are path-filtered. Continue.
- Exit 1: stop, and report the failing check and its `target_url`.
- Exit 3: CI timed out. Stop and report it.
Then run `.claude/scripts/gitea.sh GET $REPO/pulls/<number>` and confirm `mergeable` is true.
## 7. Merge
1. Run `.claude/scripts/gitea.sh POST $REPO/pulls/<number>/merge @<json file>` with `{"Do":"merge","head_commit_id":"<sha>"}`, so only the commit CI checked can merge.
2. Run `git fetch origin main:main`, then `git switch main`.
## 8. Report
Keep it short:
- PR link and commits.
- What the merge deploys, from the `on.push.paths` in `.gitea/workflows/`. `01`, `03`, `04` and `05` deploy on merge. A change under `.gitea/workflows/` can deploy `03`, `04` and `05`, and a change to `01`'s own workflow deploys `01`.
- For `02` changes, say that they are not live until someone runs the manual workflow.
- Anything left uncommitted, and a reminder to update `<STACK>_PULUMI_DEV_YAML` if local Pulumi config changed.
Do not delete the branch, dispatch a workflow, or change a live system.
+11 -1
View File
@@ -3,6 +3,13 @@ name: Deploy Proxmox Infra
on:
workflow_dispatch:
push:
branches:
- main
paths:
- "01-proxmox-infra/**"
- ".gitea/workflows/01-deploy-proxmox-infra.yaml"
pull_request:
branches:
- main
@@ -51,7 +58,7 @@ jobs:
deploy:
name: Pulumi Deploy
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch'
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
steps:
- name: Checkout Code
uses: actions/checkout@v4
@@ -75,7 +82,10 @@ jobs:
run: pulumi package add terraform-provider marshallford/pfsense 0.22.0
working-directory: 01-proxmox-infra
# Manual runs only: a refresh that finds a VM missing drops it from state,
# and `up` would then create a blank replacement without review.
- name: Refresh State
if: github.event_name == 'workflow_dispatch'
run: |
pulumi login "$PULUMI_BACKEND_URL"
pulumi refresh --yes --stack dev \
+1 -1
View File
@@ -7,7 +7,7 @@ on:
- main
paths:
- "03-k8s-infra/**"
- ".gitea/workflows/**"
- ".gitea/workflows/03-deploy-k8s-infra.yaml"
pull_request:
branches:
- main
+1 -1
View File
@@ -7,7 +7,7 @@ on:
- main
paths:
- "04-k8s-apps/**"
- ".gitea/workflows/**"
- ".gitea/workflows/04-deploy-k8s-apps.yaml"
pull_request:
branches:
- main
+1 -1
View File
@@ -7,7 +7,7 @@ on:
- main
paths:
- "05-monitoring/**"
- ".gitea/workflows/**"
- ".gitea/workflows/05-deploy-monitoring.yaml"
pull_request:
branches:
- main
+34
View File
@@ -0,0 +1,34 @@
name: Secret Scan
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
branches:
- main
env:
BETTERLEAKS_VERSION: "1.10.1"
BETTERLEAKS_SHA256: c174b42d7aa60caf58c0c3e555c0e4bed01fe6b0d99a412bce777b5af4ce913e
jobs:
scan:
name: Betterleaks
runs-on: ubuntu-latest
steps:
- name: Checkout Full History
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Betterleaks
run: |
curl -fsSL -o /tmp/betterleaks.tar.gz \
"https://github.com/betterleaks/betterleaks/releases/download/v${BETTERLEAKS_VERSION}/betterleaks_${BETTERLEAKS_VERSION}_linux_x64.tar.gz"
echo "${BETTERLEAKS_SHA256} /tmp/betterleaks.tar.gz" | sha256sum -c -
tar -xzf /tmp/betterleaks.tar.gz -C /tmp betterleaks
- name: Scan Git History
run: /tmp/betterleaks git . --redact --verbose --no-banner --no-color --log-opts="--all -m -p -U0"
+11
View File
@@ -0,0 +1,11 @@
#!/usr/bin/env bash
# Git pre-commit hook: blocks a commit if its staged changes contain a secret.
#
# Activate once per clone: git config core.hooksPath .githooks
# Skip in an emergency: git commit --no-verify
if ! command -v betterleaks >/dev/null 2>&1; then
echo "pre-commit: betterleaks is not installed, so staged changes can't be scanned" >&2
exit 1
fi
exec betterleaks git --pre-commit --staged --redact --no-banner --no-color .
+3 -1
View File
@@ -5,4 +5,6 @@ node_modules/
bin/
Pulumi.dev.yaml
sdks/
.env
.env
.env.*
!.env.example
+2 -1
View File
@@ -11,6 +11,7 @@ config:
packages:
pfsense:
source: terraform-provider
version: 1.1.3
version: 1.5.1
parameters:
- marshallford/pfsense
- 0.22.0
+90 -4
View File
@@ -25,6 +25,8 @@ const worker1Ip = config.requireSecret("worker1Ip");
const worker2Ip = config.requireSecret("worker2Ip");
const worker3Ip = config.requireSecret("worker3Ip");
const ansibleIp = config.requireSecret("ansibleIp");
// ---------------------------------------------------------------------------
// VM templates — one per node, cloned from the downloaded cloud image.
// Templates are not started and have no cloud-init config; that is applied
@@ -33,7 +35,9 @@ const worker3Ip = config.requireSecret("worker3Ip");
const templateSettings = {
template: true,
protection: true,
started: false,
operatingSystem: { type: "l26" },
stopOnDestroy: true,
scsiHardware: "virtio-scsi-pci",
cdrom: { fileId: "none" },
@@ -137,7 +141,7 @@ const pveNodes = pveNodeSeeds
},
],
},
{ provider: n.provider, ignoreChanges: ["disks"] },
{ provider: n.provider, protect: true, ignoreChanges: ["disks"] },
),
}));
@@ -287,12 +291,20 @@ const k3sVms = nodeConfigs.map(
agent: { enabled: true, timeout: "30s" },
cdrom: { fileId: "none" },
started: false,
stopOnDestroy: true,
rebootAfterUpdate: false,
},
{
provider: node.host.provider,
retainOnDelete: true,
ignoreChanges: ["clone", "started"],
protect: true,
ignoreChanges: [
"clone",
"started",
// Pulumi bridge bug: unset disk speed always shows a diff.
// https://github.com/muhlba91/pulumi-proxmoxve/issues/664
"disks[0].speed",
...(node.longhornDiskSize == null ? [] : ["disks[1].speed"]),
],
},
),
);
@@ -310,10 +322,84 @@ k3sVms.forEach((vmResource, i) => {
ipAddress: nodeConfigs[i].ip,
hostname: nodeConfigs[i].name,
},
{ dependsOn: vmResource, provider: pfSenseProvider },
{ dependsOn: vmResource, provider: pfSenseProvider, protect: true },
);
});
// ---------------------------------------------------------------------------
// Ansible control node — unprivileged LXC with a pfSense DHCP reservation.
// The MAC is fixed so the reservation can exist before the container's first
// boot; otherwise its first DHCP lease could come from the dynamic pool.
// ---------------------------------------------------------------------------
const ansibleHost = hostFor("pve-b550");
const ansibleMac = "02:A5:1B:00:01:54";
const ansibleTemplate = new proxmox.download.File(
"ubuntu-resolute-lxc-pve-b550",
{
nodeName: ansibleHost.nodeName,
datastoreId: ansibleHost.isoStore,
contentType: "vztmpl",
fileName: "ubuntu-26.04-standard_26.04-1_amd64.tar.zst",
url: "https://download.proxmox.com/images/system/ubuntu-26.04-standard_26.04-1_amd64.tar.zst",
overwrite: false,
overwriteUnmanaged: true,
},
{ provider: ansibleHost.provider },
);
const ansibleDhcp = new pfsense.Dhcpv4Staticmapping(
"ansible-dhcp",
{
interface: "lan",
macAddress: ansibleMac,
ipAddress: ansibleIp,
hostname: "ansible",
},
{ provider: pfSenseProvider, protect: true },
);
new proxmox.ContainerLegacy( // NOSONAR typescript:S1848
"ansible",
{
nodeName: ansibleHost.nodeName,
description: "Ansible control node — managed by Pulumi",
tags: ["ansible"],
unprivileged: true,
features: { nesting: true },
operatingSystem: {
templateFileId: ansibleTemplate.id,
type: "ubuntu",
},
cpu: { cores: 1 },
memory: { dedicated: 1024, swap: 0 },
disk: { datastoreId: ansibleHost.dataStore, size: 8 },
networkInterfaces: [
{ name: "eth0", bridge: "vmbr0", macAddress: ansibleMac },
],
initialization: {
hostname: "ansible",
ipConfigs: [{ ipv4: { address: "dhcp" } }],
userAccount: {
keys: [
pve1SshPublicKey.apply((k) => k.trim()),
pve2SshPublicKey.apply((k) => k.trim()),
pve3SshPublicKey.apply((k) => k.trim()),
],
},
},
started: true,
startOnBoot: true,
},
{
provider: ansibleHost.provider,
dependsOn: ansibleDhcp,
retainOnDelete: true,
protect: true,
},
);
export const vmIds = {
master1: k3sVms[0].vmId,
master2: k3sVms[1].vmId,
+365 -1691
View File
File diff suppressed because it is too large. Load diff
+56 -19
View File
@@ -3,6 +3,21 @@ import * as command from "@pulumi/command";
const config = new pulumi.Config();
// Bootstrap commands run once, on a fresh install. Without this, a changed VM
// ID, node IP, SSH key or command would re-run the k3s installer on the live
// cluster. After recreating a VM, re-run its commands explicitly with
// --target-replace.
pulumi.runtime.registerResourceTransform((args) =>
args.type.startsWith("command:")
? {
props: args.props,
opts: pulumi.mergeOptions(args.opts, {
ignoreChanges: ["create", "triggers", "connection"],
}),
}
: undefined,
);
const infraRef = new pulumi.StackReference(
`${pulumi.getOrganization()}/proxmox-infra/dev`,
);
@@ -37,6 +52,9 @@ const worker3Ip = infraRef.requireOutput("worker3Ip");
// Pre-shared k3s cluster token
const k3sToken = config.requireSecret("k3sToken");
// Version for fresh installs. Changing it does not upgrade the live cluster.
const k3sVersion = "v1.36.2+k3s1";
// Control-plane VIP — floating IP for API server access, ARP-announced by
// kube-vip on whichever master is alive. Added as a TLS SAN on master-1's
// cert below, then used (instead of master1Ip) for every other node's join
@@ -67,37 +85,46 @@ function conn(
}
// ---------------------------------------------------------------------------
// Step 1: Start all VMs (fire-and-forget — VMs are owned by proxmox-infra)
// triggers: vmId — forces re-run when VMs are deleted and recreated
// Step 1: Start all VMs (VMs are owned by proxmox-infra)
// ---------------------------------------------------------------------------
// Succeeds if the VM is already running, or reaches running after a start.
function startVmScript(
endpoint: pulumi.Input<string>,
apiToken: pulumi.Input<string>,
nodeName: string,
vmId: pulumi.Input<string>,
): pulumi.Output<string> {
return pulumi.interpolate`base="${endpoint}/api2/json/nodes/${nodeName}/qemu/${vmId}/status"; auth="Authorization: PVEAPIToken=${apiToken}"; is_running() { curl -sfk -H "$auth" "$base/current" | grep -Eq '"status" *: *"running"'; }; is_running && exit 0; curl -sfk -X POST -H "$auth" "$base/start" >/dev/null || exit 1; for i in $(seq 1 30); do is_running && exit 0; sleep 2; done; exit 1`;
}
const startMaster1 = new command.local.Command("start-master-1", {
create: pulumi.interpolate`curl -sf -k -X POST -H "Authorization: PVEAPIToken=${pve1ApiToken}" "${pve1Endpoint}/api2/json/nodes/pve/qemu/${master1VmId}/status/start" 2>/dev/null || true`,
create: startVmScript(pve1Endpoint, pve1ApiToken, "pve", master1VmId),
triggers: [master1VmId],
interpreter: ["/bin/bash", "-c"],
});
const startMaster2 = new command.local.Command("start-master-2", {
create: pulumi.interpolate`curl -sf -k -X POST -H "Authorization: PVEAPIToken=${pve1ApiToken}" "${pve1Endpoint}/api2/json/nodes/pve/qemu/${master2VmId}/status/start" 2>/dev/null || true`,
create: startVmScript(pve3Endpoint, pve3ApiToken, "pve", master2VmId),
triggers: [master2VmId],
interpreter: ["/bin/bash", "-c"],
});
const startWorker1 = new command.local.Command("start-worker-1", {
create: pulumi.interpolate`curl -sf -k -X POST -H "Authorization: PVEAPIToken=${pve1ApiToken}" "${pve1Endpoint}/api2/json/nodes/pve/qemu/${worker1VmId}/status/start" 2>/dev/null || true`,
create: startVmScript(pve1Endpoint, pve1ApiToken, "pve", worker1VmId),
triggers: [worker1VmId],
interpreter: ["/bin/bash", "-c"],
});
const startMaster3 = new command.local.Command("start-master-3", {
create: pulumi.interpolate`curl -sf -k -X POST -H "Authorization: PVEAPIToken=${pve2ApiToken}" "${pve2Endpoint}/api2/json/nodes/pve-bckp/qemu/${master3VmId}/status/start" 2>/dev/null || true`,
create: startVmScript(pve2Endpoint, pve2ApiToken, "pve-bckp", master3VmId),
triggers: [master3VmId],
interpreter: ["/bin/bash", "-c"],
});
const startWorker2 = new command.local.Command("start-worker-2", {
create: pulumi.interpolate`curl -sf -k -X POST -H "Authorization: PVEAPIToken=${pve2ApiToken}" "${pve2Endpoint}/api2/json/nodes/pve-bckp/qemu/${worker2VmId}/status/start" 2>/dev/null || true`,
create: startVmScript(pve2Endpoint, pve2ApiToken, "pve-bckp", worker2VmId),
triggers: [worker2VmId],
interpreter: ["/bin/bash", "-c"],
});
const startWorker3 = new command.local.Command("start-worker-3", {
create: pulumi.interpolate`curl -sf -k -X POST -H "Authorization: PVEAPIToken=${pve3ApiToken}" "${pve3Endpoint}/api2/json/nodes/pve/qemu/${worker3VmId}/status/start" 2>/dev/null || true`,
create: startVmScript(pve3Endpoint, pve3ApiToken, "pve", worker3VmId),
triggers: [worker3VmId],
interpreter: ["/bin/bash", "-c"],
});
@@ -129,7 +156,7 @@ const installMaster1 = new command.remote.Command(
"install-k3s-master-1",
{
connection: conn(master1Ip),
create: pulumi.interpolate`curl -sfL https://get.k3s.io | sudo K3S_TOKEN='${k3sToken}' sh -s - server --cluster-init --tls-san ${master1Ip} --tls-san ${controlPlaneVipAddress} --disable servicelb --node-name k3s-master-1`,
create: pulumi.interpolate`curl -sfL https://get.k3s.io | sudo INSTALL_K3S_VERSION='${k3sVersion}' K3S_TOKEN='${k3sToken}' sh -s - server --cluster-init --tls-san ${master1Ip} --tls-san ${controlPlaneVipAddress} --disable servicelb --node-name k3s-master-1`,
triggers: [master1VmId],
},
{ dependsOn: [waitMaster1Ssh] },
@@ -162,7 +189,9 @@ const waitControlPlaneVipReady = new command.remote.Command(
"wait-control-plane-vip-ready",
{
connection: conn(master1Ip),
create: pulumi.interpolate`for i in $(seq 1 60); do curl -sk --max-time 3 https://${controlPlaneVipAddress}:6443/healthz && exit 0; sleep 5; done; exit 1`,
// 401/403 still prove the API server answered through the VIP: the request
// is anonymous, and some clusters reject anonymous health checks.
create: pulumi.interpolate`for i in $(seq 1 60); do code=$(curl -sk --max-time 3 -o /dev/null -w '%{http_code}' https://${controlPlaneVipAddress}:6443/healthz); case "$code" in 200|401|403) exit 0;; esac; sleep 5; done; exit 1`,
triggers: [master1VmId],
},
{ dependsOn: [waitK3sMaster1Ready] },
@@ -196,7 +225,7 @@ const joinMaster2 = new command.remote.Command(
"join-k3s-master-2",
{
connection: conn(master2Ip),
create: pulumi.interpolate`curl -sfL https://get.k3s.io | sudo K3S_TOKEN='${k3sToken}' sh -s - server --server https://${controlPlaneVipAddress}:6443 --disable servicelb --node-name k3s-master-2`,
create: pulumi.interpolate`curl -sfL https://get.k3s.io | sudo INSTALL_K3S_VERSION='${k3sVersion}' K3S_TOKEN='${k3sToken}' sh -s - server --server https://${controlPlaneVipAddress}:6443 --disable servicelb --node-name k3s-master-2`,
triggers: [master2VmId],
},
{ dependsOn: [waitMaster2Ssh, waitControlPlaneVipReady] },
@@ -206,7 +235,7 @@ const joinMaster3 = new command.remote.Command(
"join-k3s-master-3",
{
connection: conn(master3Ip),
create: pulumi.interpolate`curl -sfL https://get.k3s.io | sudo K3S_TOKEN='${k3sToken}' sh -s - server --server https://${controlPlaneVipAddress}:6443 --disable servicelb --node-name k3s-master-3`,
create: pulumi.interpolate`curl -sfL https://get.k3s.io | sudo INSTALL_K3S_VERSION='${k3sVersion}' K3S_TOKEN='${k3sToken}' sh -s - server --server https://${controlPlaneVipAddress}:6443 --disable servicelb --node-name k3s-master-3`,
triggers: [master3VmId],
},
{ dependsOn: [waitMaster3Ssh, waitControlPlaneVipReady, joinMaster2] },
@@ -250,7 +279,7 @@ const joinWorker1 = new command.remote.Command(
"join-k3s-worker-1",
{
connection: conn(worker1Ip),
create: pulumi.interpolate`curl -sfL https://get.k3s.io | sudo K3S_URL=https://${controlPlaneVipAddress}:6443 K3S_TOKEN='${k3sToken}' sh -s - --node-name k3s-worker-1`,
create: pulumi.interpolate`curl -sfL https://get.k3s.io | sudo INSTALL_K3S_VERSION='${k3sVersion}' K3S_URL=https://${controlPlaneVipAddress}:6443 K3S_TOKEN='${k3sToken}' sh -s - --node-name k3s-worker-1`,
triggers: [worker1VmId],
},
{ dependsOn: [waitWorker1Ssh] },
@@ -260,7 +289,7 @@ const joinWorker2 = new command.remote.Command(
"join-k3s-worker-2",
{
connection: conn(worker2Ip),
create: pulumi.interpolate`curl -sfL https://get.k3s.io | sudo K3S_URL=https://${controlPlaneVipAddress}:6443 K3S_TOKEN='${k3sToken}' sh -s - --node-name k3s-worker-2`,
create: pulumi.interpolate`curl -sfL https://get.k3s.io | sudo INSTALL_K3S_VERSION='${k3sVersion}' K3S_URL=https://${controlPlaneVipAddress}:6443 K3S_TOKEN='${k3sToken}' sh -s - --node-name k3s-worker-2`,
triggers: [worker2VmId],
},
{ dependsOn: [waitWorker2Ssh] },
@@ -270,7 +299,7 @@ const joinWorker3 = new command.remote.Command(
"join-k3s-worker-3",
{
connection: conn(worker3Ip),
create: pulumi.interpolate`curl -sfL https://get.k3s.io | sudo K3S_URL=https://${controlPlaneVipAddress}:6443 K3S_TOKEN='${k3sToken}' sh -s - --node-name k3s-worker-3`,
create: pulumi.interpolate`curl -sfL https://get.k3s.io | sudo INSTALL_K3S_VERSION='${k3sVersion}' K3S_URL=https://${controlPlaneVipAddress}:6443 K3S_TOKEN='${k3sToken}' sh -s - --node-name k3s-worker-3`,
triggers: [worker3VmId],
},
{ dependsOn: [waitWorker3Ssh] },
@@ -290,11 +319,15 @@ workers.forEach((worker, i) => {
connection: conn(worker),
create: `set -euo pipefail;
DISK_ID=$(ls /dev/disk/by-id/ | grep 'scsi1');
[ "$(echo "$DISK_ID" | wc -l)" -eq 1 ];
DISK_PATH="/dev/disk/by-id/$DISK_ID";
sudo blkid "$DISK_PATH" >/dev/null 2>&1 || sudo mkfs.ext4 "$DISK_PATH";
BLKID_RC=0;
sudo blkid -p "$DISK_PATH" >/dev/null 2>&1 || BLKID_RC=$?;
if [ "$BLKID_RC" -eq 2 ]; then sudo mkfs.ext4 "$DISK_PATH"; elif [ "$BLKID_RC" -ne 0 ]; then exit "$BLKID_RC"; fi;
sudo mkdir -p /mnt/longhorn-extra;
echo ""$DISK_PATH" /mnt/longhorn-extra ext4 defaults,nofail 0 2" | sudo tee -a /etc/fstab;
grep -qs " /mnt/longhorn-extra " /etc/fstab || echo "$DISK_PATH /mnt/longhorn-extra ext4 defaults,nofail 0 2" | sudo tee -a /etc/fstab;
sudo mount -a;
mountpoint -q /mnt/longhorn-extra;
df -h /mnt/longhorn-extra`,
},
{ dependsOn: workerSshReader[i] },
@@ -312,7 +345,10 @@ const getKubeconfig = new command.remote.Command(
create: `sudo cat /etc/rancher/k3s/k3s.yaml`,
triggers: [master1VmId],
},
{ dependsOn: [joinWorker1, joinWorker2, joinWorker3] },
{
dependsOn: [joinWorker1, joinWorker2, joinWorker3],
additionalSecretOutputs: ["stdout"],
},
);
// ---------------------------------------------------------------------------
@@ -363,7 +399,8 @@ allVms.forEach(({ id, ip, name, readiness }) => {
`install-packages-${name}`,
{
connection: conn(ip),
create: pulumi.interpolate`sudo apt update && sudo apt install -y qemu-guest-agent && sudo systemctl enable --now qemu-guest-agent`,
// cloud-init exit code 2 means it finished with recoverable errors.
create: pulumi.interpolate`{ sudo cloud-init status --wait >/dev/null || [ $? -eq 2 ]; } && sudo apt-get -o DPkg::Lock::Timeout=300 update && sudo apt-get -o DPkg::Lock::Timeout=300 install -y qemu-guest-agent && sudo systemctl enable --now qemu-guest-agent`,
triggers: [id],
},
{ dependsOn: readiness },
+54 -2
View File
@@ -23,7 +23,13 @@ const domain = config.requireSecret("domain");
const longhornUiUser = config.requireSecret("longhornUiUser");
const longhornUiPassword = config.requireSecret("longhornUiPassword");
const k8sProvider = new k8s.Provider("k3s", { kubeconfig });
// Keep the kubeconfig stored in state. A changed API address would otherwise
// make Pulumi replace the provider and every resource in this stack.
const k8sProvider = new k8s.Provider(
"k3s",
{ kubeconfig },
{ ignoreChanges: ["kubeconfig"] },
);
const opts = (extras?: pulumi.ResourceOptions): pulumi.ResourceOptions => ({
provider: k8sProvider,
...extras,
@@ -138,15 +144,61 @@ const longhorn = new k8s.helm.v3.Release(
version: "1.12.0",
values: {
defaultSettings: {
defaultReplicaCount: 2,
defaultReplicaCount: 3,
nodeDownPodDeletionPolicy: "delete-both-statefulset-and-deployment-pod",
createDefaultDiskLabeledNodes: true,
orphanResourceAutoDeletion: "replica-data;instance",
// Longhorn's recommendation for dedicated disks (longhorn-extra).
// Docs: https://longhorn.io/docs/1.12.0/best-practices/
storageMinimalAvailablePercentage: 10,
},
},
},
opts(),
);
// Purges system snapshots, which can otherwise grow to a full volume's size
// on every replica. Docs:
// https://longhorn.io/docs/1.12.0/snapshots-and-backups/scheduling-backups-and-snapshots/
new k8s.apiextensions.CustomResource(
"longhorn-snapshot-cleanup",
{
apiVersion: "longhorn.io/v1beta2",
kind: "RecurringJob",
metadata: { name: "snapshot-cleanup", namespace: "longhorn-system" },
spec: {
name: "snapshot-cleanup",
task: "snapshot-cleanup",
cron: "30 3 * * *",
groups: ["default"],
retain: 0,
concurrency: 1,
},
},
opts({ dependsOn: [longhorn] }),
);
// Returns blocks deleted inside a volume (e.g. expired Prometheus data) to the
// disk. Runs after snapshot-cleanup, since trim can't reclaim valid snapshots.
// Docs: https://longhorn.io/docs/1.12.0/nodes-and-volumes/volumes/trim-filesystem/
new k8s.apiextensions.CustomResource(
"longhorn-filesystem-trim",
{
apiVersion: "longhorn.io/v1beta2",
kind: "RecurringJob",
metadata: { name: "filesystem-trim", namespace: "longhorn-system" },
spec: {
name: "filesystem-trim",
task: "filesystem-trim",
cron: "30 4 * * *",
groups: ["default"],
retain: 0,
concurrency: 1,
},
},
opts({ dependsOn: [longhorn] }),
);
// Patches Longhorn instances to use the mountend Longhorn storage on the worker nodes.
["k3s-worker-1", "k3s-worker-2", "k3s-worker-3"].forEach(
(nodeName) =>
+7 -1
View File
@@ -10,7 +10,13 @@ const bootstrapRef = new pulumi.StackReference(
const kubeconfig = bootstrapRef.requireOutput("kubeconfig");
export const domain = config.requireSecret("domain");
const k8sProvider = new k8s.Provider("k3s", { kubeconfig });
// Keep the kubeconfig stored in state. A changed API address would otherwise
// make Pulumi replace the provider and every resource in this stack.
const k8sProvider = new k8s.Provider(
"k3s",
{ kubeconfig },
{ ignoreChanges: ["kubeconfig"] },
);
const opts = (extras?: pulumi.ResourceOptions): pulumi.ResourceOptions => ({
provider: k8sProvider,
...extras,
+7 -1
View File
@@ -18,7 +18,13 @@ const grafanaDbPassword = config.requireSecret("grafanaDbPassword");
const grafanaDbHost = config.requireSecret("grafanaDbHost");
const grafanaDbName = config.require("grafanaDbName");
const k8sProvider = new k8s.Provider("k3s", { kubeconfig });
// Keep the kubeconfig stored in state. A changed API address would otherwise
// make Pulumi replace the provider and every resource in this stack.
const k8sProvider = new k8s.Provider(
"k3s",
{ kubeconfig },
{ ignoreChanges: ["kubeconfig"] },
);
const monitoringNs = new k8s.core.v1.Namespace(
"monitoring",
+1 -1
View File
@@ -26,7 +26,7 @@ proxmox-infra → k8s-bootstrap → k8s-infra
- **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.
- **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
+1 -1
View File
@@ -60,4 +60,4 @@ This repo uses Gitea Actions (see root `CLAUDE.md`); Gitea's merge commit reuses
- `Enhancement: Refactor k8s-bootstrap for clearer deployment order`
- `Chore: Upgrade Pulumi packages across all stacks`
Since `01`/`02` deploys are manual (`workflow_dispatch`) and `03`–`05` deploy on merge to `main`, a clear PR title also doubles as a quick changelog of what just went live.
Since `02` deploys are manual (`workflow_dispatch`) and `01` and `03`–`05` deploy on merge to `main`, a clear PR title also doubles as a quick changelog of what just went live.
+2 -1
View File
@@ -120,10 +120,11 @@ One workflow per stack, `.gitea/workflows/0N-deploy-<stack>.yaml`, scoped to cha
| Trigger | Stacks | Action |
| --- | --- | --- |
| PR → `main` | all | `pulumi preview` (read-only) |
| Push to `main` | 01 | `pulumi up` (no refresh) |
| Push to `main` | 03–05 | `pulumi refresh` + `pulumi up` |
| Manual dispatch | all | `pulumi refresh` + `pulumi up` |
Stacks 01/02 (VM provisioning, cluster bootstrap) deploy **only** via manual dispatch — they're riskier to automate.
Stack 02 (cluster bootstrap) deploys **only** via manual dispatch, because re-running it restarts the bootstrap sequence. Stack 01 (VM provisioning) skips the refresh on automatic deploys so a VM missing from Proxmox can't be recreated blank. After changing VMs in the Proxmox GUI, run its workflow manually to sync state.
### Required secrets