Compare commits
40
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
01999ce28f | ||
|
|
8e87e33937 | ||
|
|
1c1a1b2441 | ||
|
|
eb7794962f | ||
|
|
f25d2fdfe9 | ||
|
|
2b5637516a | ||
|
|
ce6173b06a | ||
|
|
22dfe9a26b | ||
|
|
185e0c96d5 | ||
|
|
e55e46d020 | ||
|
|
cf139cd580 | ||
|
|
0623e151bb | ||
|
|
17a8061722 | ||
|
|
f6a708e897 | ||
|
|
b8516bae50 | ||
|
|
6d05f426d0 | ||
|
|
0466bd6929 | ||
|
|
8f9b6fda24 | ||
|
|
6ad6007df4 | ||
|
|
c5e545ef33 | ||
|
|
9d11189f3d | ||
|
|
5dde0da0d2 | ||
|
|
d93d1810f1 | ||
|
|
cdf033686a | ||
|
|
b1aff90ffd | ||
|
|
c6aa571a5c | ||
|
|
ffe976fb16 | ||
|
|
17648b53ae | ||
|
|
46b6593682 | ||
|
|
52e780f4af | ||
|
|
99f5f58a08 | ||
|
|
c2bd27c9a7 | ||
|
|
b21d5fc268 | ||
|
|
3d5b2ba097 | ||
|
|
3320f11e4b | ||
|
|
39dbfafe1c | ||
|
|
356f5b7ad4 | ||
|
|
6647d55050 | ||
|
|
13330ef3fb | ||
|
|
855d1cce85 |
No files matched your search
@@ -91,6 +91,6 @@ Keep it short:
|
|||||||
- PR link and commits.
|
- 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`.
|
- 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.
|
- 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.
|
- Anything left uncommitted. Also run `git -C .pulumi-config status --short --branch`, and if it shows uncommitted or unpushed changes, remind the user to commit and push them there because CI uses that repo's `main`. Don't commit or push that repo as part of `/merge`.
|
||||||
|
|
||||||
Do not delete the branch, dispatch a workflow, or change a live system.
|
Do not delete the branch, dispatch a workflow, or change a live system.
|
||||||
@@ -31,8 +31,14 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
node-version: "24"
|
node-version: "24"
|
||||||
|
|
||||||
- name: Restore Stack Config
|
- name: Checkout Stack Config
|
||||||
run: echo "${{ secrets.PROXMOX_INFRA_PULUMI_DEV_YAML }}" | base64 -d > 01-proxmox-infra/Pulumi.dev.yaml
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
repository: kasun/homelab-pulumi-config
|
||||||
|
ref: main
|
||||||
|
token: ${{ secrets.PULUMI_CONFIG_REPO_TOKEN }}
|
||||||
|
path: .pulumi-config
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
@@ -68,8 +74,14 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
node-version: "24"
|
node-version: "24"
|
||||||
|
|
||||||
- name: Restore Stack Config
|
- name: Checkout Stack Config
|
||||||
run: echo "${{ secrets.PROXMOX_INFRA_PULUMI_DEV_YAML }}" | base64 -d > 01-proxmox-infra/Pulumi.dev.yaml
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
repository: kasun/homelab-pulumi-config
|
||||||
|
ref: main
|
||||||
|
token: ${{ secrets.PULUMI_CONFIG_REPO_TOKEN }}
|
||||||
|
path: .pulumi-config
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
@@ -89,8 +101,8 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
pulumi login "$PULUMI_BACKEND_URL"
|
pulumi login "$PULUMI_BACKEND_URL"
|
||||||
pulumi refresh --yes --stack dev \
|
pulumi refresh --yes --stack dev \
|
||||||
--target 'urn:pulumi:dev::proxmox-infra::proxmoxve*' \
|
--target 'urn:pulumi:dev::proxmox-infra::proxmoxve**' \
|
||||||
--target 'urn:pulumi:dev::proxmox-infra::tls*'
|
--target 'urn:pulumi:dev::proxmox-infra::tls**'
|
||||||
working-directory: 01-proxmox-infra
|
working-directory: 01-proxmox-infra
|
||||||
env:
|
env:
|
||||||
PULUMI_CONFIG_PASSPHRASE: ${{ secrets.PULUMI_CONFIG_PASSPHRASE }}
|
PULUMI_CONFIG_PASSPHRASE: ${{ secrets.PULUMI_CONFIG_PASSPHRASE }}
|
||||||
|
|||||||
@@ -23,8 +23,14 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
node-version: "24"
|
node-version: "24"
|
||||||
|
|
||||||
- name: Restore Stack Config
|
- name: Checkout Stack Config
|
||||||
run: echo "${{ secrets.K8S_BOOTSTRAP_PULUMI_DEV_YAML }}" | base64 -d > 02-k8s-bootstrap/Pulumi.dev.yaml
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
repository: kasun/homelab-pulumi-config
|
||||||
|
ref: main
|
||||||
|
token: ${{ secrets.PULUMI_CONFIG_REPO_TOKEN }}
|
||||||
|
path: .pulumi-config
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: npm install
|
run: npm install
|
||||||
@@ -53,8 +59,14 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
node-version: "24"
|
node-version: "24"
|
||||||
|
|
||||||
- name: Restore Stack Config
|
- name: Checkout Stack Config
|
||||||
run: echo "${{ secrets.K8S_BOOTSTRAP_PULUMI_DEV_YAML }}" | base64 -d > 02-k8s-bootstrap/Pulumi.dev.yaml
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
repository: kasun/homelab-pulumi-config
|
||||||
|
ref: main
|
||||||
|
token: ${{ secrets.PULUMI_CONFIG_REPO_TOKEN }}
|
||||||
|
path: .pulumi-config
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: npm install
|
run: npm install
|
||||||
|
|||||||
@@ -29,8 +29,14 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
node-version: "24"
|
node-version: "24"
|
||||||
|
|
||||||
- name: Restore Stack Config
|
- name: Checkout Stack Config
|
||||||
run: echo "${{ secrets.K8S_INFRA_PULUMI_DEV_YAML }}" | base64 -d > 03-k8s-infra/Pulumi.dev.yaml
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
repository: kasun/homelab-pulumi-config
|
||||||
|
ref: main
|
||||||
|
token: ${{ secrets.PULUMI_CONFIG_REPO_TOKEN }}
|
||||||
|
path: .pulumi-config
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
- name: Install Helm
|
- name: Install Helm
|
||||||
uses: azure/setup-helm@v4
|
uses: azure/setup-helm@v4
|
||||||
@@ -62,8 +68,14 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
node-version: "24"
|
node-version: "24"
|
||||||
|
|
||||||
- name: Restore Stack Config
|
- name: Checkout Stack Config
|
||||||
run: echo "${{ secrets.K8S_INFRA_PULUMI_DEV_YAML }}" | base64 -d > 03-k8s-infra/Pulumi.dev.yaml
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
repository: kasun/homelab-pulumi-config
|
||||||
|
ref: main
|
||||||
|
token: ${{ secrets.PULUMI_CONFIG_REPO_TOKEN }}
|
||||||
|
path: .pulumi-config
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
- name: Install Helm
|
- name: Install Helm
|
||||||
uses: azure/setup-helm@v4
|
uses: azure/setup-helm@v4
|
||||||
|
|||||||
@@ -29,8 +29,14 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
node-version: "24"
|
node-version: "24"
|
||||||
|
|
||||||
- name: Restore Stack Config
|
- name: Checkout Stack Config
|
||||||
run: echo "${{ secrets.K8S_APPS_PULUMI_DEV_YAML }}" | base64 -d > 04-k8s-apps/Pulumi.dev.yaml
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
repository: kasun/homelab-pulumi-config
|
||||||
|
ref: main
|
||||||
|
token: ${{ secrets.PULUMI_CONFIG_REPO_TOKEN }}
|
||||||
|
path: .pulumi-config
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: npm install
|
run: npm install
|
||||||
@@ -59,8 +65,14 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
node-version: "24"
|
node-version: "24"
|
||||||
|
|
||||||
- name: Restore Stack Config
|
- name: Checkout Stack Config
|
||||||
run: echo "${{ secrets.K8S_APPS_PULUMI_DEV_YAML }}" | base64 -d > 04-k8s-apps/Pulumi.dev.yaml
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
repository: kasun/homelab-pulumi-config
|
||||||
|
ref: main
|
||||||
|
token: ${{ secrets.PULUMI_CONFIG_REPO_TOKEN }}
|
||||||
|
path: .pulumi-config
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: npm install
|
run: npm install
|
||||||
|
|||||||
@@ -29,8 +29,14 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
node-version: "24"
|
node-version: "24"
|
||||||
|
|
||||||
- name: Restore Stack Config
|
- name: Checkout Stack Config
|
||||||
run: echo "${{ secrets.MONITORING_PULUMI_DEV_YAML }}" | base64 -d > 05-monitoring/Pulumi.dev.yaml
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
repository: kasun/homelab-pulumi-config
|
||||||
|
ref: main
|
||||||
|
token: ${{ secrets.PULUMI_CONFIG_REPO_TOKEN }}
|
||||||
|
path: .pulumi-config
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: npm install
|
run: npm install
|
||||||
@@ -59,8 +65,14 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
node-version: "24"
|
node-version: "24"
|
||||||
|
|
||||||
- name: Restore Stack Config
|
- name: Checkout Stack Config
|
||||||
run: echo "${{ secrets.MONITORING_PULUMI_DEV_YAML }}" | base64 -d > 05-monitoring/Pulumi.dev.yaml
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
repository: kasun/homelab-pulumi-config
|
||||||
|
ref: main
|
||||||
|
token: ${{ secrets.PULUMI_CONFIG_REPO_TOKEN }}
|
||||||
|
path: .pulumi-config
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: npm install
|
run: npm install
|
||||||
|
|||||||
@@ -0,0 +1,99 @@
|
|||||||
|
name: Deploy Openbao
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths:
|
||||||
|
- "06-openbao/**"
|
||||||
|
- ".gitea/workflows/06-deploy-openbao.yaml"
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths:
|
||||||
|
- "06-openbao/**"
|
||||||
|
- ".gitea/workflows/**"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
preview:
|
||||||
|
name: Pulumi Preview
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: github.event_name == 'pull_request'
|
||||||
|
steps:
|
||||||
|
- name: Checkout Code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: "24"
|
||||||
|
|
||||||
|
- name: Checkout Stack Config
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
repository: kasun/homelab-pulumi-config
|
||||||
|
ref: main
|
||||||
|
token: ${{ secrets.PULUMI_CONFIG_REPO_TOKEN }}
|
||||||
|
path: .pulumi-config
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
|
- name: Install Dependencies
|
||||||
|
run: npm ci
|
||||||
|
working-directory: 06-openbao
|
||||||
|
|
||||||
|
- name: Preview
|
||||||
|
uses: pulumi/actions@v5
|
||||||
|
with:
|
||||||
|
command: preview
|
||||||
|
stack-name: dev
|
||||||
|
work-dir: 06-openbao
|
||||||
|
cloud-url: ${{ secrets.PULUMI_BACKEND_URL }}
|
||||||
|
env:
|
||||||
|
PULUMI_CONFIG_PASSPHRASE: ${{ secrets.PULUMI_CONFIG_PASSPHRASE }}
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
name: Pulumi Deploy
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
|
||||||
|
steps:
|
||||||
|
- name: Checkout Code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: "24"
|
||||||
|
|
||||||
|
- name: Checkout Stack Config
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
repository: kasun/homelab-pulumi-config
|
||||||
|
ref: main
|
||||||
|
token: ${{ secrets.PULUMI_CONFIG_REPO_TOKEN }}
|
||||||
|
path: .pulumi-config
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
|
- name: Install Dependencies
|
||||||
|
run: npm ci
|
||||||
|
working-directory: 06-openbao
|
||||||
|
|
||||||
|
- name: Refresh State
|
||||||
|
uses: pulumi/actions@v5
|
||||||
|
with:
|
||||||
|
command: refresh
|
||||||
|
stack-name: dev
|
||||||
|
work-dir: 06-openbao
|
||||||
|
cloud-url: ${{ secrets.PULUMI_BACKEND_URL }}
|
||||||
|
env:
|
||||||
|
PULUMI_CONFIG_PASSPHRASE: ${{ secrets.PULUMI_CONFIG_PASSPHRASE }}
|
||||||
|
|
||||||
|
- name: Deploy
|
||||||
|
uses: pulumi/actions@v5
|
||||||
|
with:
|
||||||
|
command: up
|
||||||
|
stack-name: dev
|
||||||
|
work-dir: 06-openbao
|
||||||
|
cloud-url: ${{ secrets.PULUMI_BACKEND_URL }}
|
||||||
|
env:
|
||||||
|
PULUMI_CONFIG_PASSPHRASE: ${{ secrets.PULUMI_CONFIG_PASSPHRASE }}
|
||||||
@@ -8,3 +8,4 @@ sdks/
|
|||||||
.env
|
.env
|
||||||
.env.*
|
.env.*
|
||||||
!.env.example
|
!.env.example
|
||||||
|
.pulumi-config
|
||||||
@@ -15,3 +15,4 @@ packages:
|
|||||||
parameters:
|
parameters:
|
||||||
- marshallford/pfsense
|
- marshallford/pfsense
|
||||||
- 0.22.0
|
- 0.22.0
|
||||||
|
stackConfigDir: ../.pulumi-config/01-proxmox-infra
|
||||||
@@ -391,6 +391,7 @@ new proxmox.ContainerLegacy( // NOSONAR typescript:S1848
|
|||||||
},
|
},
|
||||||
started: true,
|
started: true,
|
||||||
startOnBoot: true,
|
startOnBoot: true,
|
||||||
|
protection: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
provider: ansibleHost.provider,
|
provider: ansibleHost.provider,
|
||||||
|
|||||||
Generated
+16
-16
@@ -608,9 +608,9 @@
|
|||||||
"link": true
|
"link": true
|
||||||
},
|
},
|
||||||
"node_modules/@pulumi/pulumi": {
|
"node_modules/@pulumi/pulumi": {
|
||||||
"version": "3.277.0",
|
"version": "3.278.0",
|
||||||
"resolved": "https://registry.npmjs.org/@pulumi/pulumi/-/pulumi-3.277.0.tgz",
|
"resolved": "https://registry.npmjs.org/@pulumi/pulumi/-/pulumi-3.278.0.tgz",
|
||||||
"integrity": "sha512-EvvBo55xmGByLRWjIqp24k4vzmPoKmZ6nTmK8EHzRb9veLCNISN3/Fq4RlJxrEt5+HmNkZveEasI+z0UCgkMxw==",
|
"integrity": "sha512-PedUCQG6IciTBYA5MUYeiFbeoqaI/0hlA7rtrjkETk949BZ4bpLejoHmENifAAdBk0+h0oUv+BdVNtlMQ+AhRA==",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@grpc/grpc-js": "^1.10.1",
|
"@grpc/grpc-js": "^1.10.1",
|
||||||
@@ -655,9 +655,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@pulumi/tls": {
|
"node_modules/@pulumi/tls": {
|
||||||
"version": "5.5.0",
|
"version": "5.6.3",
|
||||||
"resolved": "https://registry.npmjs.org/@pulumi/tls/-/tls-5.5.0.tgz",
|
"resolved": "https://registry.npmjs.org/@pulumi/tls/-/tls-5.6.3.tgz",
|
||||||
"integrity": "sha512-OTGxp4sgDEuXlXrd7NtxrhhciPgcn9rqDIZlGOTmTaeGo+tlVMwv73FFqiVrzAmBiILdU8tLXHfxhjc+bTLdrQ==",
|
"integrity": "sha512-glAX4KYmsEGOXPz7yFKcErSogfknYB/4h2/EdeVXifZGW8ic47HCjNI5zPHF4+0DcwmNdLGA7fm2qQz69wS9EA==",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pulumi/pulumi": "^3.142.0"
|
"@pulumi/pulumi": "^3.142.0"
|
||||||
@@ -670,12 +670,12 @@
|
|||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@types/node": {
|
"node_modules/@types/node": {
|
||||||
"version": "24.13.1",
|
"version": "24.19.4",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.13.1.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.19.4.tgz",
|
||||||
"integrity": "sha512-RSpUJGmvsJ1ZeBehQZFhIdpsz+bIpES0nIQXko4Ybq+N+kX6XvOq3Jo+iJ82FWLdblFq85AsMikd3m35jgezYg==",
|
"integrity": "sha512-s04odlR3ksJrLu7QLi+pddkWLD0RmSbcP9KuWn2/ozQKAp/YgwBC/6x9kJj8yAzZnGPfxePm7zm7nysVPCRagw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"undici-types": "~7.18.0"
|
"undici-types": ">=7.24.0 <7.24.7"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@types/semver": {
|
"node_modules/@types/semver": {
|
||||||
@@ -1266,9 +1266,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/undici-types": {
|
"node_modules/undici-types": {
|
||||||
"version": "7.18.2",
|
"version": "7.24.6",
|
||||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.18.2.tgz",
|
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.24.6.tgz",
|
||||||
"integrity": "sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w==",
|
"integrity": "sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/upath": {
|
"node_modules/upath": {
|
||||||
@@ -1365,9 +1365,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"sdks/pfsense/node_modules/@types/node": {
|
"sdks/pfsense/node_modules/@types/node": {
|
||||||
"version": "20.19.41",
|
"version": "20.19.43",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.41.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.43.tgz",
|
||||||
"integrity": "sha512-ECymXOukMnOoVkC2bb1Vc/w/836DXncOg5m8Xj1RH7xSHZJWNYY6Zh7EH477vcnD5egKNNfy2RpNOmuChhFPgQ==",
|
"integrity": "sha512-6oYBAi5ikg4Pl+kGsoYtawUMBT2zZMCvPNF7pVLnHZfd1zf38DRiWn/gT01RYCdUqkv7Fhr+C9ot4/tb+2sVvA==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"undici-types": "~6.21.0"
|
"undici-types": "~6.21.0"
|
||||||
|
|||||||
@@ -8,6 +8,6 @@
|
|||||||
|
|
||||||
## Running against live VMs
|
## Running against live VMs
|
||||||
|
|
||||||
Re-running this stack restarts the bootstrap sequence against already-provisioned VMs. That's why it only deploys via manual dispatch. For changes to the running cluster, write the code for a fresh bootstrap and give separate manual steps.
|
Re-running this stack restarts the bootstrap sequence against already-provisioned VMs. That's why it only deploys via manual dispatch. For changes to the running cluster, write the code for a fresh bootstrap and give separate manual steps. To rebuild the whole cluster, follow [the rebuild runbook](../docs/runbooks/full-cluster-rebuild.md).
|
||||||
|
|
||||||
The SSH key comes from `proxmox-infra`'s first `pulumi up`. VMs created before that need the public key added to `~/.ssh/authorized_keys` by hand.
|
The SSH key comes from `proxmox-infra`'s first `pulumi up`. VMs created before that need the public key added to `~/.ssh/authorized_keys` by hand.
|
||||||
@@ -8,3 +8,4 @@ config:
|
|||||||
pulumi:tags:
|
pulumi:tags:
|
||||||
value:
|
value:
|
||||||
pulumi:template: typescript
|
pulumi:template: typescript
|
||||||
|
stackConfigDir: ../.pulumi-config/02-k8s-bootstrap
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIIF3TCCA8WgAwIBAgIUDXajbsIFjkrtUM/HEOAMI06xHjEwDQYJKoZIhvcNAQEL
|
||||||
|
BQAwdjEkMCIGA1UEAwwbUHJveG1veCBWaXJ0dWFsIEVudmlyb25tZW50MS0wKwYD
|
||||||
|
VQQLDCRiYTk0ZDJhZC0wOTc2LTRmZjAtODQ1Mi1kMjM1OGMxZGM3OGIxHzAdBgNV
|
||||||
|
BAoMFlBWRSBDbHVzdGVyIE1hbmFnZXIgQ0EwHhcNMjYxMTAzMDAwODM5WhcNMzYx
|
||||||
|
MDMxMDAwODM5WjB2MSQwIgYDVQQDDBtQcm94bW94IFZpcnR1YWwgRW52aXJvbm1l
|
||||||
|
bnQxLTArBgNVBAsMJGJhOTRkMmFkLTA5NzYtNGZmMC04NDUyLWQyMzU4YzFkYzc4
|
||||||
|
YjEfMB0GA1UECgwWUFZFIENsdXN0ZXIgTWFuYWdlciBDQTCCAiIwDQYJKoZIhvcN
|
||||||
|
AQEBBQADggIPADCCAgoCggIBAM1OPRmaMGdkrgVQikVCOFAF7eXL0H7lUfognG4A
|
||||||
|
Xi/D85bLKGJYF106PQFlmkvw+CvNIHCeeqvgDJc2AoV22PnKjPlP34b3j4AAoEm3
|
||||||
|
sMvKHke+N3kSfhG7hxZ8JfnV+EIZO1ZAI0X2z0ixmmn3gzIVjdtO9VycL7Nj2JJV
|
||||||
|
O+Ws+yc3j3swhVA87bIikc+sD0YT8F8dK41DQfgM01wWhieGLCk4g8DSbOt1Ypgv
|
||||||
|
hAwlKziUtUdw/teC8vmE0GwUMas/uwFVXzBEd/4ancI1SkPH/Mtu568HCVzcCBjE
|
||||||
|
wFAhdMZ90g7UXC58m5cFqs2PafDsAYv2rmSCic8yO2aZCO5nbQOtU9rN2b1e9KGs
|
||||||
|
xfDksugSJ2ZsIZ4YsG9Eao6WXkZIohANEhUkGK3yI4REiJO96/pmqf1QtNRvUZWW
|
||||||
|
YIxa56i2KrjB2RdGe9eirNlshTPA3DpJbLHmcsw1agPEI5mN4uQJ3DrSGrFwXHkB
|
||||||
|
QYW9NmgwLHUlOYdvUUq7AIY3RqCBWWkBW0vlg78W2fiaq1Gp6Mx/9HeVdriB2FGa
|
||||||
|
UlAE6CAzDI+JqQPQkmzo6QmFB3hFa9m1aPctLZo0bOKCeoyREBaPmmZfn6VaI1Xk
|
||||||
|
+mUIw6NLstdG0lS/qThNYbG5LWdRIyHdLcjsg19pFfmj9YUMphoMD7k2IG4Cu9nP
|
||||||
|
mwqlAgMBAAGjYzBhMB0GA1UdDgQWBBTKcVA3Li/Qe4f/vEsHFHc/VNVFHzAfBgNV
|
||||||
|
HSMEGDAWgBTKcVA3Li/Qe4f/vEsHFHc/VNVFHzAPBgNVHRMBAf8EBTADAQH/MA4G
|
||||||
|
A1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAMLrQvbGlgpqxSaxQKb4N
|
||||||
|
wmmRQqgWvJ7/s9UhHE5BNfkUzJ+3ktAwfbswuNc4yfREjPqRBWzd/mz/WhlsDOzR
|
||||||
|
KT+ECQpNbnlR3JBJMYOiLDwKydnYWgiTiINxtc7p74NoGe/fu8dGKiGYtsk+bmps
|
||||||
|
yP1FOp3YQ2UM1NjQoalk2sZYOCRUL1HbgfaSHEwFXskJMKprUEEjJjXLxyJey14U
|
||||||
|
u6gSvUb2T8bbycW8Ilibo5Dn/DxLFBNT154M7GHQyVSdWLoEAVVzkrlJJ9b0RYnb
|
||||||
|
PQXOySSuIvrQx8QqG6X/4AfPrm2L1O8CAAwpNi3xa6jvVX6DWT1+HOhN8MfjtYJE
|
||||||
|
9KxbG6MNxnE8A39m46O2iYfwW+zTej842N1Fq6eA7i2nMuzHB3jqNVdvxaLCNK2a
|
||||||
|
FCAilpl2iuqO5eOWZG2Gd9qcPQSslRrhJid6GV/pTeh/ZpZyf/OG4XXata+IB2aq
|
||||||
|
0ggaQgGn5dFiCklLeFsnX0k0pydz/ZVA1v5C/sVk3q07JrPJo0IKs0SuS0lsHH9n
|
||||||
|
hPIdbUH3AsG850vDTIsKYgmZdssnG13bsGwZtC8x3MS1c868PRgG/ZycdT6BGk6Q
|
||||||
|
qX9ogoFrdUy3XYSRVDb2L+Z8NEI8grFOTDRXAlp5B4BHAbvXoIeeYjGtjtOunYCo
|
||||||
|
f3Em5SShmS4B2U/jTPyDeZ0=
|
||||||
|
-----END CERTIFICATE-----
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIIF3TCCA8WgAwIBAgIUUfheavZDUF4EvmQ6q8upF7dd74UwDQYJKoZIhvcNAQEL
|
||||||
|
BQAwdjEkMCIGA1UEAwwbUHJveG1veCBWaXJ0dWFsIEVudmlyb25tZW50MS0wKwYD
|
||||||
|
VQQLDCQxZWQ0Nzc1Yi1hMjc1LTQ3ZDktYTA1Mi1kM2M1MThhYjE2MzIxHzAdBgNV
|
||||||
|
BAoMFlBWRSBDbHVzdGVyIE1hbmFnZXIgQ0EwHhcNMjYxMTAyMDMzMDIxWhcNMzYx
|
||||||
|
MDMwMDMzMDIxWjB2MSQwIgYDVQQDDBtQcm94bW94IFZpcnR1YWwgRW52aXJvbm1l
|
||||||
|
bnQxLTArBgNVBAsMJDFlZDQ3NzViLWEyNzUtNDdkOS1hMDUyLWQzYzUxOGFiMTYz
|
||||||
|
MjEfMB0GA1UECgwWUFZFIENsdXN0ZXIgTWFuYWdlciBDQTCCAiIwDQYJKoZIhvcN
|
||||||
|
AQEBBQADggIPADCCAgoCggIBAK3vi3/3+0trXhEkDXoSrOFWTuXc7x7vPmORzQ6R
|
||||||
|
V/sg1X6KTbguzSPg71B/8Qu1vRYTkS6Pf5YclpE0P+z45hCV+G8B40cAL3D1Xpbo
|
||||||
|
JTznI2gaO00XDTei1MdDTC/mwUzoNBa7osXEmMwgz7Oid7WHJbIQegwq2LEMRbqQ
|
||||||
|
UtAXsAone1eq+N2vQys57MlnXnSbMFFlY1VNfUJIinjyLZgE9klFkvVFSqy9CkUs
|
||||||
|
4Yq9M6YSgvNA77tPSH/yc0605N1462x/VRHUkY4nufrWqI8oUlcGrK8mNieCtPK7
|
||||||
|
FOr3PZXq5K0I3LsSlbp7M43Bbumnuscg0ustyf/eCM7tdMQm9E5yfQsMH+Ao390x
|
||||||
|
nBrlpVqA6RSWGAeDhspuB6Sj+InVfzoLKvhqwzlGV5S+WT+uDN4VhRdGlet/kVC8
|
||||||
|
Xn5GIRgeGR/x5zs93Xxz9OEyVhSxPB6+NP/NJ4z7OD21Oiar7GUFzPbaMpWnSChW
|
||||||
|
5Vsp2i8HUikjUyiGb8nYZfVEHwj/w3JEs+m4eTwUroT4YgLRMwahye5gJTcq19oA
|
||||||
|
xFUzStAXEGglv5AVf0ngU3KTkwFP2ROLry/FIk6ZQSedJtnBpq0+CcMZe+vKSVD7
|
||||||
|
acFZ6k/bFh4jMeD9i1/Zx+mRf8XvZEeaImxYc0P9vnxfl2XP7QiroEP7PkuFZ6As
|
||||||
|
69rpAgMBAAGjYzBhMB0GA1UdDgQWBBSex+vVqEdCLAk0eKJiSfYltlTaKTAfBgNV
|
||||||
|
HSMEGDAWgBSex+vVqEdCLAk0eKJiSfYltlTaKTAPBgNVHRMBAf8EBTADAQH/MA4G
|
||||||
|
A1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAkeVBiV4Zs+yoXKTcdy0A
|
||||||
|
Y7cEAGUY+zWQeg/eZnbNMWqG5x4UKWpA+9LZDOhAu7lBwkWoTlYLw6foDuy47uzQ
|
||||||
|
LBxqxI5gXkUi/CvIlOZ8AjuNdVU02wdDoib8O5mJDpvEMIOQawbRno84mlYdzhRs
|
||||||
|
BHeBugNdiORBk1JbqZjsvAmtlbjDaDNV0oxm9C5Np4F9sbA9lChkz+bv/KJxYexB
|
||||||
|
P91nonJfmyajDkWqrCaFIyjliNjfmff1CM2EpNDlngwXo6XjSgWjFuEVtHE2xl3t
|
||||||
|
J21a0WSxuIkQUNWJMcyr9j9LLAnZG06XCNEy6g2R8vMFmm3xGM76NkABkCsFT5PZ
|
||||||
|
lEmrAVmVDWKx2heAlVmVQ1wFrlGVYnlVxTWWcIHrHRCJJfc12tCwczbumBDxO45u
|
||||||
|
iJ5d4GI5HBSYz3kdMzzpBhLIH5l5h/AzmGebkhbSAK7I/V0kPOQvOVVrtCYr/Ec4
|
||||||
|
gU1AV6bjiu3USOeiAqkxW791Xp0IFkP+8e4FYohyG6QyS5jHtf0Vtl8/xJSKU9mj
|
||||||
|
idc4dwZSWu0V9LaNcMbk8kyRTvX/LwKuLOYp++a0/vxUMvgsv0yqeElvWAJB33xe
|
||||||
|
Ih/rsFCIC247ccQZ1g4JGHRJqRTAIQT4VsDqSRh+0KwarPvgJPEsluDB9bholfZ9
|
||||||
|
LoZqoymHgYm95H7LaDTdytA=
|
||||||
|
-----END CERTIFICATE-----
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIIFzTCCA7WgAwIBAgIUHFXkUXk2cmTrkKJxLSTvxhg5lfowDQYJKoZIhvcNAQEL
|
||||||
|
BQAwdjEkMCIGA1UEAwwbUHJveG1veCBWaXJ0dWFsIEVudmlyb25tZW50MS0wKwYD
|
||||||
|
VQQLDCQ4NzNhNGYzMS05YWQ2LTQ3MDYtYTg5MS0xZmU2NDIzNzgyYzQxHzAdBgNV
|
||||||
|
BAoMFlBWRSBDbHVzdGVyIE1hbmFnZXIgQ0EwHhcNMjUwODI5MjIzNjU5WhcNMzUw
|
||||||
|
ODI3MjIzNjU5WjB2MSQwIgYDVQQDDBtQcm94bW94IFZpcnR1YWwgRW52aXJvbm1l
|
||||||
|
bnQxLTArBgNVBAsMJDg3M2E0ZjMxLTlhZDYtNDcwNi1hODkxLTFmZTY0MjM3ODJj
|
||||||
|
NDEfMB0GA1UECgwWUFZFIENsdXN0ZXIgTWFuYWdlciBDQTCCAiIwDQYJKoZIhvcN
|
||||||
|
AQEBBQADggIPADCCAgoCggIBAL3iGXWp8BkVcXIpfVybY0slRl36bQp3OkswgTc9
|
||||||
|
awdsN62wWkN6NIa4yZsItzjHnCyte6Nac9qCmu25Pwhw4QEc7XRWuh4sVPvw4ica
|
||||||
|
0JgDw7yJbn8IM3C7qm9+g5iXoGcOdY41xsKJz7+cWgySh4EBPWYEuKOxtWuvTRzV
|
||||||
|
Q3b/o+LT8X/Q5qR7EehgLVy5KtWZCDjV/6862hh9zEiA87zosULHtVYAa1lWtL48
|
||||||
|
9q0flbQsIIFmaeio/iEJR66YHXTF7AlKaIrXLVCMRdRV6oef/b4SqECwnZVQnE28
|
||||||
|
I1uwnOV88MIfr9sINhdW7ogxSvlGFptkDkRVXnqfIOwLJjjPRuIifFg98KYR1gLp
|
||||||
|
vGMeRY96mJvJ98NUSeVZOQMVs8vnEXHlpPewsklQty23KQJTr42R5zIKXSguZZUU
|
||||||
|
NjNgDTPdUu45jNDu8nzU8guK3AcTkLbtmbL5uUCGZo860ScUFQUtuibou6plYVjx
|
||||||
|
Yca+mH3QoZI/lfnB/f2aNL9JP+DlTUfwTMgSAKiilOOqWvsHLjXvZjZupoAW0Xh4
|
||||||
|
CREKf0n5T9ldy6goRzbmWE475uc0UPtmLdlVrqt0F89YH8wZAlPu91a6pvomWUYX
|
||||||
|
pokkimWvPf3C+YgRDJIkolAQ1l+egnS/KR2tgLVEKktfXm4nRk2VotWOcsBDme40
|
||||||
|
Hwz3AgMBAAGjUzBRMB0GA1UdDgQWBBTK4krmBcFK3+fphDn5+DuknRdz4TAfBgNV
|
||||||
|
HSMEGDAWgBTK4krmBcFK3+fphDn5+DuknRdz4TAPBgNVHRMBAf8EBTADAQH/MA0G
|
||||||
|
CSqGSIb3DQEBCwUAA4ICAQCFW1DCfMOMTy/MvbYT8KKhwLujjjQvdKsgnRaktRzq
|
||||||
|
j66dohxWHiN0jDDgIeT1DkB/guh5pqcDnwVaiVZAagEJ/NvigTPRodTcijhomCzz
|
||||||
|
p9GCaMnl21YX2D5Ckg69iJ+AVekwNTHWqAVwbXZj1dpxs3SBceps9NQvzfNUI823
|
||||||
|
jDNpgYo9E4kymBIe8ibXNXiGbrZb171aqWzdJEdXIGmvbruXiIOwkkynJHViMo1Y
|
||||||
|
8RiUQx+NwGJw5NTTuHuCI0zYTxrqObPvtfwvyYEpaOf1fs246fRHDo8okffxLuMR
|
||||||
|
AbEVJuU4GCh3JhO5M1BUWEKllx4wZW8/ygtHc8TkKwxMQS86/bEptSoMn0TJ0XeC
|
||||||
|
YnnhML0XD0aRtcoqRhmfBjMntNeiHaAkXusLyc8LNyynhqWv3ldTw05JSfVSlhjC
|
||||||
|
paJNzLYYFa2VC/EG++1Kv6nvZjNZHzV34fkBw9dS6cJbhp5WK7WQgoZgIUF6kJN3
|
||||||
|
nEm0DzRUR6R4KjNgYJxmhXxHvKOeYyp52muiNkehFZ0d1/RdftgUvjh8pR7KEfSH
|
||||||
|
JaO5K0BWMy7infAcAOHb6krEMwfkr3NXUfF4pbuqNGQx5MHYfXkPiIdPy6q6ZqmO
|
||||||
|
ittFd5xKjL7J0QaDkAcxmJFJ2FdtQhoV14eKESBUdQV0NCSKXQgebkV5a8ik0mJU
|
||||||
|
GA==
|
||||||
|
-----END CERTIFICATE-----
|
||||||
+95
-22
@@ -4,14 +4,21 @@ import * as command from "@pulumi/command";
|
|||||||
const config = new pulumi.Config();
|
const config = new pulumi.Config();
|
||||||
|
|
||||||
// Bootstrap commands run once, on a fresh install. Without this, a changed VM
|
// Bootstrap commands run once, on a fresh install. Without this, a changed VM
|
||||||
// ID or command would re-run the k3s installer on the live cluster. After
|
// ID, node IP, SSH key or command would re-run the k3s installer on the live
|
||||||
// recreating a VM, re-run its commands explicitly with --target-replace.
|
// cluster. After recreating a VM, re-run its commands explicitly with
|
||||||
|
// --target-replace.
|
||||||
pulumi.runtime.registerResourceTransform((args) =>
|
pulumi.runtime.registerResourceTransform((args) =>
|
||||||
args.type.startsWith("command:")
|
args.type.startsWith("command:")
|
||||||
? {
|
? {
|
||||||
props: args.props,
|
props: args.props,
|
||||||
opts: pulumi.mergeOptions(args.opts, {
|
opts: pulumi.mergeOptions(args.opts, {
|
||||||
ignoreChanges: ["create", "triggers"],
|
ignoreChanges: [
|
||||||
|
"create",
|
||||||
|
"triggers",
|
||||||
|
"connection",
|
||||||
|
"environment",
|
||||||
|
"stdin",
|
||||||
|
],
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
: undefined,
|
: undefined,
|
||||||
@@ -51,6 +58,19 @@ const worker3Ip = infraRef.requireOutput("worker3Ip");
|
|||||||
// Pre-shared k3s cluster token
|
// Pre-shared k3s cluster token
|
||||||
const k3sToken = config.requireSecret("k3sToken");
|
const k3sToken = config.requireSecret("k3sToken");
|
||||||
|
|
||||||
|
// Version for fresh installs. Changing it does not upgrade the live cluster.
|
||||||
|
const k3sVersion = "v1.36.2+k3s1";
|
||||||
|
const k3sInstallerUrl = `https://raw.githubusercontent.com/k3s-io/k3s/${encodeURIComponent(k3sVersion)}/install.sh`;
|
||||||
|
|
||||||
|
// Runs the pinned installer. The token arrives on stdin and travels in the
|
||||||
|
// environment, so it never appears in process arguments.
|
||||||
|
function k3sInstallScript(
|
||||||
|
installEnv: pulumi.Input<string>,
|
||||||
|
installArgs: pulumi.Input<string>,
|
||||||
|
): pulumi.Output<string> {
|
||||||
|
return pulumi.interpolate`set -euo pipefail; IFS= read -r K3S_TOKEN || true; export K3S_TOKEN; curl -sfL ${k3sInstallerUrl} | sudo --preserve-env=K3S_TOKEN INSTALL_K3S_VERSION='${k3sVersion}' ${installEnv} sh -s - ${installArgs}`;
|
||||||
|
}
|
||||||
|
|
||||||
// Control-plane VIP — floating IP for API server access, ARP-announced by
|
// 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
|
// 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
|
// cert below, then used (instead of master1Ip) for every other node's join
|
||||||
@@ -81,37 +101,56 @@ function conn(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// Step 1: Start all VMs (fire-and-forget — VMs are owned by proxmox-infra)
|
// Step 1: Start all VMs (VMs are owned by proxmox-infra)
|
||||||
// triggers: vmId — forces re-run when VMs are deleted and recreated
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Succeeds if the VM is already running, or reaches running after a start.
|
||||||
|
// TLS is verified against the host's Proxmox CA in certs/. The API token comes
|
||||||
|
// from PVE_API_TOKEN and reaches curl on stdin, keeping it out of process
|
||||||
|
// arguments.
|
||||||
|
function startVmScript(
|
||||||
|
endpoint: pulumi.Input<string>,
|
||||||
|
caName: string,
|
||||||
|
nodeName: string,
|
||||||
|
vmId: pulumi.Input<string>,
|
||||||
|
): pulumi.Output<string> {
|
||||||
|
return pulumi.interpolate`base="${endpoint}/api2/json/nodes/${nodeName}/qemu/${vmId}/status"; ca="certs/${caName}-ca.pem"; auth() { printf 'header = "Authorization: PVEAPIToken=%s"
|
||||||
|
' "$PVE_API_TOKEN"; }; is_running() { auth | curl -sf -K - --cacert "$ca" "$base/current" | grep -Eq '"status" *: *"running"'; }; is_running && exit 0; auth | curl -sf -K - --cacert "$ca" -X POST "$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", {
|
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, "pve1", "pve", master1VmId),
|
||||||
|
environment: { PVE_API_TOKEN: pve1ApiToken },
|
||||||
triggers: [master1VmId],
|
triggers: [master1VmId],
|
||||||
interpreter: ["/bin/bash", "-c"],
|
interpreter: ["/bin/bash", "-c"],
|
||||||
});
|
});
|
||||||
const startMaster2 = new command.local.Command("start-master-2", {
|
const startMaster2 = new command.local.Command("start-master-2", {
|
||||||
create: pulumi.interpolate`curl -sf -k -X POST -H "Authorization: PVEAPIToken=${pve3ApiToken}" "${pve3Endpoint}/api2/json/nodes/pve/qemu/${master2VmId}/status/start" 2>/dev/null || true`,
|
create: startVmScript(pve3Endpoint, "pve3", "pve", master2VmId),
|
||||||
|
environment: { PVE_API_TOKEN: pve3ApiToken },
|
||||||
triggers: [master2VmId],
|
triggers: [master2VmId],
|
||||||
interpreter: ["/bin/bash", "-c"],
|
interpreter: ["/bin/bash", "-c"],
|
||||||
});
|
});
|
||||||
const startWorker1 = new command.local.Command("start-worker-1", {
|
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, "pve1", "pve", worker1VmId),
|
||||||
|
environment: { PVE_API_TOKEN: pve1ApiToken },
|
||||||
triggers: [worker1VmId],
|
triggers: [worker1VmId],
|
||||||
interpreter: ["/bin/bash", "-c"],
|
interpreter: ["/bin/bash", "-c"],
|
||||||
});
|
});
|
||||||
const startMaster3 = new command.local.Command("start-master-3", {
|
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, "pve2", "pve-bckp", master3VmId),
|
||||||
|
environment: { PVE_API_TOKEN: pve2ApiToken },
|
||||||
triggers: [master3VmId],
|
triggers: [master3VmId],
|
||||||
interpreter: ["/bin/bash", "-c"],
|
interpreter: ["/bin/bash", "-c"],
|
||||||
});
|
});
|
||||||
const startWorker2 = new command.local.Command("start-worker-2", {
|
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, "pve2", "pve-bckp", worker2VmId),
|
||||||
|
environment: { PVE_API_TOKEN: pve2ApiToken },
|
||||||
triggers: [worker2VmId],
|
triggers: [worker2VmId],
|
||||||
interpreter: ["/bin/bash", "-c"],
|
interpreter: ["/bin/bash", "-c"],
|
||||||
});
|
});
|
||||||
const startWorker3 = new command.local.Command("start-worker-3", {
|
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, "pve3", "pve", worker3VmId),
|
||||||
|
environment: { PVE_API_TOKEN: pve3ApiToken },
|
||||||
triggers: [worker3VmId],
|
triggers: [worker3VmId],
|
||||||
interpreter: ["/bin/bash", "-c"],
|
interpreter: ["/bin/bash", "-c"],
|
||||||
});
|
});
|
||||||
@@ -143,7 +182,11 @@ const installMaster1 = new command.remote.Command(
|
|||||||
"install-k3s-master-1",
|
"install-k3s-master-1",
|
||||||
{
|
{
|
||||||
connection: conn(master1Ip),
|
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: k3sInstallScript(
|
||||||
|
"",
|
||||||
|
pulumi.interpolate`server --cluster-init --tls-san ${master1Ip} --tls-san ${controlPlaneVipAddress} --disable servicelb --node-name k3s-master-1`,
|
||||||
|
),
|
||||||
|
stdin: k3sToken,
|
||||||
triggers: [master1VmId],
|
triggers: [master1VmId],
|
||||||
},
|
},
|
||||||
{ dependsOn: [waitMaster1Ssh] },
|
{ dependsOn: [waitMaster1Ssh] },
|
||||||
@@ -176,7 +219,9 @@ const waitControlPlaneVipReady = new command.remote.Command(
|
|||||||
"wait-control-plane-vip-ready",
|
"wait-control-plane-vip-ready",
|
||||||
{
|
{
|
||||||
connection: conn(master1Ip),
|
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],
|
triggers: [master1VmId],
|
||||||
},
|
},
|
||||||
{ dependsOn: [waitK3sMaster1Ready] },
|
{ dependsOn: [waitK3sMaster1Ready] },
|
||||||
@@ -210,7 +255,11 @@ const joinMaster2 = new command.remote.Command(
|
|||||||
"join-k3s-master-2",
|
"join-k3s-master-2",
|
||||||
{
|
{
|
||||||
connection: conn(master2Ip),
|
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: k3sInstallScript(
|
||||||
|
"",
|
||||||
|
pulumi.interpolate`server --server https://${controlPlaneVipAddress}:6443 --disable servicelb --node-name k3s-master-2`,
|
||||||
|
),
|
||||||
|
stdin: k3sToken,
|
||||||
triggers: [master2VmId],
|
triggers: [master2VmId],
|
||||||
},
|
},
|
||||||
{ dependsOn: [waitMaster2Ssh, waitControlPlaneVipReady] },
|
{ dependsOn: [waitMaster2Ssh, waitControlPlaneVipReady] },
|
||||||
@@ -220,7 +269,11 @@ const joinMaster3 = new command.remote.Command(
|
|||||||
"join-k3s-master-3",
|
"join-k3s-master-3",
|
||||||
{
|
{
|
||||||
connection: conn(master3Ip),
|
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: k3sInstallScript(
|
||||||
|
"",
|
||||||
|
pulumi.interpolate`server --server https://${controlPlaneVipAddress}:6443 --disable servicelb --node-name k3s-master-3`,
|
||||||
|
),
|
||||||
|
stdin: k3sToken,
|
||||||
triggers: [master3VmId],
|
triggers: [master3VmId],
|
||||||
},
|
},
|
||||||
{ dependsOn: [waitMaster3Ssh, waitControlPlaneVipReady, joinMaster2] },
|
{ dependsOn: [waitMaster3Ssh, waitControlPlaneVipReady, joinMaster2] },
|
||||||
@@ -264,7 +317,11 @@ const joinWorker1 = new command.remote.Command(
|
|||||||
"join-k3s-worker-1",
|
"join-k3s-worker-1",
|
||||||
{
|
{
|
||||||
connection: conn(worker1Ip),
|
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: k3sInstallScript(
|
||||||
|
pulumi.interpolate`K3S_URL=https://${controlPlaneVipAddress}:6443`,
|
||||||
|
"--node-name k3s-worker-1",
|
||||||
|
),
|
||||||
|
stdin: k3sToken,
|
||||||
triggers: [worker1VmId],
|
triggers: [worker1VmId],
|
||||||
},
|
},
|
||||||
{ dependsOn: [waitWorker1Ssh] },
|
{ dependsOn: [waitWorker1Ssh] },
|
||||||
@@ -274,7 +331,11 @@ const joinWorker2 = new command.remote.Command(
|
|||||||
"join-k3s-worker-2",
|
"join-k3s-worker-2",
|
||||||
{
|
{
|
||||||
connection: conn(worker2Ip),
|
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: k3sInstallScript(
|
||||||
|
pulumi.interpolate`K3S_URL=https://${controlPlaneVipAddress}:6443`,
|
||||||
|
"--node-name k3s-worker-2",
|
||||||
|
),
|
||||||
|
stdin: k3sToken,
|
||||||
triggers: [worker2VmId],
|
triggers: [worker2VmId],
|
||||||
},
|
},
|
||||||
{ dependsOn: [waitWorker2Ssh] },
|
{ dependsOn: [waitWorker2Ssh] },
|
||||||
@@ -284,7 +345,11 @@ const joinWorker3 = new command.remote.Command(
|
|||||||
"join-k3s-worker-3",
|
"join-k3s-worker-3",
|
||||||
{
|
{
|
||||||
connection: conn(worker3Ip),
|
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: k3sInstallScript(
|
||||||
|
pulumi.interpolate`K3S_URL=https://${controlPlaneVipAddress}:6443`,
|
||||||
|
"--node-name k3s-worker-3",
|
||||||
|
),
|
||||||
|
stdin: k3sToken,
|
||||||
triggers: [worker3VmId],
|
triggers: [worker3VmId],
|
||||||
},
|
},
|
||||||
{ dependsOn: [waitWorker3Ssh] },
|
{ dependsOn: [waitWorker3Ssh] },
|
||||||
@@ -304,11 +369,15 @@ workers.forEach((worker, i) => {
|
|||||||
connection: conn(worker),
|
connection: conn(worker),
|
||||||
create: `set -euo pipefail;
|
create: `set -euo pipefail;
|
||||||
DISK_ID=$(ls /dev/disk/by-id/ | grep 'scsi1');
|
DISK_ID=$(ls /dev/disk/by-id/ | grep 'scsi1');
|
||||||
|
[ "$(echo "$DISK_ID" | wc -l)" -eq 1 ];
|
||||||
DISK_PATH="/dev/disk/by-id/$DISK_ID";
|
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;
|
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;
|
sudo mount -a;
|
||||||
|
mountpoint -q /mnt/longhorn-extra;
|
||||||
df -h /mnt/longhorn-extra`,
|
df -h /mnt/longhorn-extra`,
|
||||||
},
|
},
|
||||||
{ dependsOn: workerSshReader[i] },
|
{ dependsOn: workerSshReader[i] },
|
||||||
@@ -326,7 +395,10 @@ const getKubeconfig = new command.remote.Command(
|
|||||||
create: `sudo cat /etc/rancher/k3s/k3s.yaml`,
|
create: `sudo cat /etc/rancher/k3s/k3s.yaml`,
|
||||||
triggers: [master1VmId],
|
triggers: [master1VmId],
|
||||||
},
|
},
|
||||||
{ dependsOn: [joinWorker1, joinWorker2, joinWorker3] },
|
{
|
||||||
|
dependsOn: [joinWorker1, joinWorker2, joinWorker3],
|
||||||
|
additionalSecretOutputs: ["stdout"],
|
||||||
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
@@ -377,7 +449,8 @@ allVms.forEach(({ id, ip, name, readiness }) => {
|
|||||||
`install-packages-${name}`,
|
`install-packages-${name}`,
|
||||||
{
|
{
|
||||||
connection: conn(ip),
|
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],
|
triggers: [id],
|
||||||
},
|
},
|
||||||
{ dependsOn: readiness },
|
{ dependsOn: readiness },
|
||||||
|
|||||||
Generated
+375
-1807
File diff suppressed because it is too large.
Load diff
@@ -10,7 +10,6 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pulumi/command": "^1.2.1",
|
"@pulumi/command": "^1.2.1",
|
||||||
"@pulumi/kubernetes": "^4.31.1",
|
|
||||||
"@pulumi/pulumi": "^3.244.0"
|
"@pulumi/pulumi": "^3.244.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,3 +4,4 @@ runtime:
|
|||||||
name: nodejs
|
name: nodejs
|
||||||
options:
|
options:
|
||||||
packagemanager: npm
|
packagemanager: npm
|
||||||
|
stackConfigDir: ../.pulumi-config/03-k8s-infra
|
||||||
@@ -23,7 +23,13 @@ const domain = config.requireSecret("domain");
|
|||||||
const longhornUiUser = config.requireSecret("longhornUiUser");
|
const longhornUiUser = config.requireSecret("longhornUiUser");
|
||||||
const longhornUiPassword = config.requireSecret("longhornUiPassword");
|
const longhornUiPassword = config.requireSecret("longhornUiPassword");
|
||||||
|
|
||||||
const k8sProvider = new k8s.Provider("k3s", { kubeconfig });
|
// A fixed identifier makes kubeconfig changes (e.g. a new API address) provider
|
||||||
|
// updates. Without it, they replace the provider and every resource in this
|
||||||
|
// stack. Changing this value triggers that replacement, so never change it.
|
||||||
|
const k8sProvider = new k8s.Provider("k3s", {
|
||||||
|
kubeconfig,
|
||||||
|
clusterIdentifier: "homelab-k3s",
|
||||||
|
});
|
||||||
const opts = (extras?: pulumi.ResourceOptions): pulumi.ResourceOptions => ({
|
const opts = (extras?: pulumi.ResourceOptions): pulumi.ResourceOptions => ({
|
||||||
provider: k8sProvider,
|
provider: k8sProvider,
|
||||||
...extras,
|
...extras,
|
||||||
|
|||||||
Generated
+392
-1682
File diff suppressed because it is too large.
Load diff
@@ -5,11 +5,11 @@
|
|||||||
"typecheck": "tsc --noEmit"
|
"typecheck": "tsc --noEmit"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^18",
|
"@types/node": "^24.19.4",
|
||||||
"typescript": "^5.0.0"
|
"typescript": "^6.0.3"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pulumi/kubernetes": "^4.0.0",
|
"@pulumi/kubernetes": "^4.31.1",
|
||||||
"@pulumi/pulumi": "^3.113.0"
|
"@pulumi/pulumi": "^3.278.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,3 +4,4 @@ runtime:
|
|||||||
name: nodejs
|
name: nodejs
|
||||||
options:
|
options:
|
||||||
packagemanager: npm
|
packagemanager: npm
|
||||||
|
stackConfigDir: ../.pulumi-config/04-k8s-apps
|
||||||
@@ -10,7 +10,13 @@ const bootstrapRef = new pulumi.StackReference(
|
|||||||
const kubeconfig = bootstrapRef.requireOutput("kubeconfig");
|
const kubeconfig = bootstrapRef.requireOutput("kubeconfig");
|
||||||
export const domain = config.requireSecret("domain");
|
export const domain = config.requireSecret("domain");
|
||||||
|
|
||||||
const k8sProvider = new k8s.Provider("k3s", { kubeconfig });
|
// A fixed identifier makes kubeconfig changes (e.g. a new API address) provider
|
||||||
|
// updates. Without it, they replace the provider and every resource in this
|
||||||
|
// stack. Changing this value triggers that replacement, so never change it.
|
||||||
|
const k8sProvider = new k8s.Provider("k3s", {
|
||||||
|
kubeconfig,
|
||||||
|
clusterIdentifier: "homelab-k3s",
|
||||||
|
});
|
||||||
const opts = (extras?: pulumi.ResourceOptions): pulumi.ResourceOptions => ({
|
const opts = (extras?: pulumi.ResourceOptions): pulumi.ResourceOptions => ({
|
||||||
provider: k8sProvider,
|
provider: k8sProvider,
|
||||||
...extras,
|
...extras,
|
||||||
|
|||||||
Generated
+385
-1675
File diff suppressed because it is too large.
Load diff
@@ -1,3 +1,3 @@
|
|||||||
# monitoring
|
# monitoring
|
||||||
|
|
||||||
- The `monitoring` namespace and the `kube-prometheus-stack` Helm release were adopted from existing cluster resources via the Pulumi `import` option. Be careful with renames or changes that would force a replace.
|
- The `monitoring` namespace and the `kube-prometheus-stack` Helm release were originally adopted from existing cluster resources and are now `protected`. Be careful with renames or changes that would force a replace.
|
||||||
@@ -4,3 +4,4 @@ runtime:
|
|||||||
name: nodejs
|
name: nodejs
|
||||||
options:
|
options:
|
||||||
packagemanager: npm
|
packagemanager: npm
|
||||||
|
stackConfigDir: ../.pulumi-config/05-monitoring
|
||||||
@@ -18,12 +18,18 @@ const grafanaDbPassword = config.requireSecret("grafanaDbPassword");
|
|||||||
const grafanaDbHost = config.requireSecret("grafanaDbHost");
|
const grafanaDbHost = config.requireSecret("grafanaDbHost");
|
||||||
const grafanaDbName = config.require("grafanaDbName");
|
const grafanaDbName = config.require("grafanaDbName");
|
||||||
|
|
||||||
const k8sProvider = new k8s.Provider("k3s", { kubeconfig });
|
// A fixed identifier makes kubeconfig changes (e.g. a new API address) provider
|
||||||
|
// updates. Without it, they replace the provider and every resource in this
|
||||||
|
// stack. Changing this value triggers that replacement, so never change it.
|
||||||
|
const k8sProvider = new k8s.Provider("k3s", {
|
||||||
|
kubeconfig,
|
||||||
|
clusterIdentifier: "homelab-k3s",
|
||||||
|
});
|
||||||
|
|
||||||
const monitoringNs = new k8s.core.v1.Namespace(
|
const monitoringNs = new k8s.core.v1.Namespace(
|
||||||
"monitoring",
|
"monitoring",
|
||||||
{ metadata: { name: "monitoring" } },
|
{ metadata: { name: "monitoring" } },
|
||||||
{ provider: k8sProvider, import: "monitoring" },
|
{ provider: k8sProvider, protect: true },
|
||||||
);
|
);
|
||||||
|
|
||||||
const grafanaHost = pulumi.interpolate`grafana.${domain}`;
|
const grafanaHost = pulumi.interpolate`grafana.${domain}`;
|
||||||
@@ -95,5 +101,5 @@ new k8s.helm.v3.Release(
|
|||||||
alertmanager: { enabled: false },
|
alertmanager: { enabled: false },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ provider: k8sProvider, import: "monitoring/kube-prometheus-stack" },
|
{ provider: k8sProvider, protect: true },
|
||||||
);
|
);
|
||||||
Generated
+385
-1675
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,7 @@
|
|||||||
|
name: openbao
|
||||||
|
description: Openbao stack for centralized ha secret management
|
||||||
|
runtime:
|
||||||
|
name: nodejs
|
||||||
|
options:
|
||||||
|
packagemanager: npm
|
||||||
|
stackConfigDir: ../.pulumi-config/06-openbao
|
||||||
@@ -0,0 +1,260 @@
|
|||||||
|
import * as pulumi from "@pulumi/pulumi";
|
||||||
|
import * as k8s from "@pulumi/kubernetes";
|
||||||
|
|
||||||
|
const bootstrapRef = new pulumi.StackReference(
|
||||||
|
`${pulumi.getOrganization()}/k8s-bootstrap/dev`,
|
||||||
|
);
|
||||||
|
const appsRef = new pulumi.StackReference(
|
||||||
|
`${pulumi.getOrganization()}/k8s-apps/dev`,
|
||||||
|
);
|
||||||
|
|
||||||
|
const kubeconfig = bootstrapRef.requireOutput("kubeconfig");
|
||||||
|
const domain = appsRef.requireOutput("domain");
|
||||||
|
const openbaoHost = pulumi.interpolate`bao.${domain}`;
|
||||||
|
|
||||||
|
const k8sProvider = new k8s.Provider("k3s", {
|
||||||
|
kubeconfig,
|
||||||
|
clusterIdentifier: "homelab-k3s",
|
||||||
|
});
|
||||||
|
|
||||||
|
const opts = (extras?: pulumi.ResourceOptions): pulumi.ResourceOptions => ({
|
||||||
|
provider: k8sProvider,
|
||||||
|
...extras,
|
||||||
|
});
|
||||||
|
|
||||||
|
const openbaoNs = new k8s.core.v1.Namespace(
|
||||||
|
"openbao",
|
||||||
|
{ metadata: { name: "openbao" } },
|
||||||
|
{ provider: k8sProvider, protect: true },
|
||||||
|
);
|
||||||
|
|
||||||
|
const selfsigned = new k8s.apiextensions.CustomResource(
|
||||||
|
"openbao-selfsigned",
|
||||||
|
{
|
||||||
|
apiVersion: "cert-manager.io/v1",
|
||||||
|
kind: "Issuer",
|
||||||
|
metadata: {
|
||||||
|
name: "openbao-selfsigned",
|
||||||
|
namespace: openbaoNs.metadata.name,
|
||||||
|
},
|
||||||
|
spec: {
|
||||||
|
selfSigned: {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
opts(),
|
||||||
|
);
|
||||||
|
|
||||||
|
const caCert = new k8s.apiextensions.CustomResource(
|
||||||
|
"openbao-ca",
|
||||||
|
{
|
||||||
|
apiVersion: "cert-manager.io/v1",
|
||||||
|
kind: "Certificate",
|
||||||
|
metadata: { name: "openbao-ca", namespace: openbaoNs.metadata.name },
|
||||||
|
spec: {
|
||||||
|
secretName: "openbao-ca",
|
||||||
|
commonName: "openbao-ca",
|
||||||
|
isCA: true,
|
||||||
|
issuerRef: { name: "openbao-selfsigned", kind: "Issuer" },
|
||||||
|
duration: "87600h",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
opts({ dependsOn: [selfsigned] }),
|
||||||
|
);
|
||||||
|
|
||||||
|
const caIssuer = new k8s.apiextensions.CustomResource(
|
||||||
|
"openbao-ca-issuer",
|
||||||
|
{
|
||||||
|
apiVersion: "cert-manager.io/v1",
|
||||||
|
kind: "Issuer",
|
||||||
|
metadata: { name: "openbao-ca", namespace: openbaoNs.metadata.name },
|
||||||
|
spec: {
|
||||||
|
ca: { secretName: "openbao-ca" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
opts({ dependsOn: [caCert] }),
|
||||||
|
);
|
||||||
|
|
||||||
|
const serverCert = new k8s.apiextensions.CustomResource(
|
||||||
|
"openbao-server-tls",
|
||||||
|
{
|
||||||
|
apiVersion: "cert-manager.io/v1",
|
||||||
|
kind: "Certificate",
|
||||||
|
metadata: {
|
||||||
|
name: "openbao-server-tls",
|
||||||
|
namespace: openbaoNs.metadata.name,
|
||||||
|
},
|
||||||
|
spec: {
|
||||||
|
secretName: "openbao-server-tls",
|
||||||
|
dnsNames: [
|
||||||
|
"openbao-0.openbao-internal",
|
||||||
|
"openbao-1.openbao-internal",
|
||||||
|
"openbao-2.openbao-internal",
|
||||||
|
"openbao-active.openbao.svc",
|
||||||
|
"localhost",
|
||||||
|
],
|
||||||
|
ipAddresses: ["127.0.0.1"],
|
||||||
|
issuerRef: { name: "openbao-ca", kind: "Issuer" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
opts({ dependsOn: [caIssuer] }),
|
||||||
|
);
|
||||||
|
|
||||||
|
const serversTransport = new k8s.apiextensions.CustomResource(
|
||||||
|
"openbao-servers-transport",
|
||||||
|
{
|
||||||
|
apiVersion: "traefik.io/v1alpha1",
|
||||||
|
kind: "ServersTransport",
|
||||||
|
metadata: {
|
||||||
|
name: "openbao-servers-transport",
|
||||||
|
namespace: openbaoNs.metadata.name,
|
||||||
|
},
|
||||||
|
spec: {
|
||||||
|
serverName: "openbao-active.openbao.svc",
|
||||||
|
rootCAs: [{ secret: "openbao-server-tls" }],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
opts({ dependsOn: [serverCert] }),
|
||||||
|
);
|
||||||
|
|
||||||
|
new k8s.helm.v3.Release(
|
||||||
|
"openbao",
|
||||||
|
{
|
||||||
|
name: "openbao",
|
||||||
|
chart: "openbao",
|
||||||
|
repositoryOpts: { repo: "https://openbao.github.io/openbao-helm" },
|
||||||
|
namespace: "openbao",
|
||||||
|
version: "0.30.8",
|
||||||
|
// Pods stay unready until they are initialised and unsealed by hand.
|
||||||
|
skipAwait: true,
|
||||||
|
values: {
|
||||||
|
global: {
|
||||||
|
tlsDisable: false,
|
||||||
|
},
|
||||||
|
injector: {
|
||||||
|
enabled: false,
|
||||||
|
},
|
||||||
|
server: {
|
||||||
|
podManagementPolicy: "Parallel",
|
||||||
|
resources: {
|
||||||
|
requests: { cpu: "100m", memory: "256Mi" },
|
||||||
|
limits: { memory: "512Mi" },
|
||||||
|
},
|
||||||
|
volumes: [
|
||||||
|
{ name: "server-tls", secret: { secretName: "openbao-server-tls" } },
|
||||||
|
],
|
||||||
|
volumeMounts: [
|
||||||
|
{
|
||||||
|
name: "server-tls",
|
||||||
|
mountPath: "/openbao/userconfig/openbao-server-tls",
|
||||||
|
readOnly: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
extraEnvironmentVars: {
|
||||||
|
BAO_CACERT: "/openbao/userconfig/openbao-server-tls/ca.crt",
|
||||||
|
},
|
||||||
|
service: {
|
||||||
|
active: {
|
||||||
|
annotations: {
|
||||||
|
"traefik.ingress.kubernetes.io/service.serverstransport":
|
||||||
|
"openbao-openbao-servers-transport@kubernetescrd",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
ingress: {
|
||||||
|
enabled: true,
|
||||||
|
ingressClassName: "traefik",
|
||||||
|
annotations: { "cert-manager.io/cluster-issuer": "letsencrypt-prod" },
|
||||||
|
hosts: [{ host: openbaoHost, paths: ["/"] }],
|
||||||
|
tls: [{ secretName: "openbao-ingress-tls", hosts: [openbaoHost] }],
|
||||||
|
},
|
||||||
|
networkPolicy: {
|
||||||
|
enabled: true,
|
||||||
|
ingress: [
|
||||||
|
{
|
||||||
|
from: [
|
||||||
|
{
|
||||||
|
namespaceSelector: {
|
||||||
|
matchLabels: {
|
||||||
|
"kubernetes.io/metadata.name": "kube-system",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
podSelector: {
|
||||||
|
matchLabels: { "app.kubernetes.io/name": "traefik" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
ports: [{ port: 8200, protocol: "TCP" }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
from: [
|
||||||
|
{
|
||||||
|
podSelector: {
|
||||||
|
matchLabels: {
|
||||||
|
"app.kubernetes.io/name": "openbao",
|
||||||
|
"app.kubernetes.io/instance": "openbao",
|
||||||
|
component: "server",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
ports: [
|
||||||
|
{ port: 8200, protocol: "TCP" },
|
||||||
|
{ port: 8201, protocol: "TCP" },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
ha: {
|
||||||
|
enabled: true,
|
||||||
|
replicas: 3,
|
||||||
|
apiAddr: "https://$(BAO_K8S_POD_NAME).openbao-internal:8200",
|
||||||
|
raft: {
|
||||||
|
enabled: true,
|
||||||
|
setNodeId: true,
|
||||||
|
config: `ui = true
|
||||||
|
|
||||||
|
listener "tcp" {
|
||||||
|
address = "[::]:8200"
|
||||||
|
cluster_address = "[::]:8201"
|
||||||
|
tls_cert_file = "/openbao/userconfig/openbao-server-tls/tls.crt"
|
||||||
|
tls_key_file = "/openbao/userconfig/openbao-server-tls/tls.key"
|
||||||
|
tls_auto_reload = true
|
||||||
|
}
|
||||||
|
|
||||||
|
storage "raft" {
|
||||||
|
path = "/openbao/data"
|
||||||
|
|
||||||
|
retry_join {
|
||||||
|
leader_api_addr = "https://openbao-0.openbao-internal:8200"
|
||||||
|
leader_ca_cert_file = "/openbao/userconfig/openbao-server-tls/ca.crt"
|
||||||
|
}
|
||||||
|
retry_join {
|
||||||
|
leader_api_addr = "https://openbao-1.openbao-internal:8200"
|
||||||
|
leader_ca_cert_file = "/openbao/userconfig/openbao-server-tls/ca.crt"
|
||||||
|
}
|
||||||
|
retry_join {
|
||||||
|
leader_api_addr = "https://openbao-2.openbao-internal:8200"
|
||||||
|
leader_ca_cert_file = "/openbao/userconfig/openbao-server-tls/ca.crt"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
service_registration "kubernetes" {}
|
||||||
|
|
||||||
|
audit "file" "stdout" {
|
||||||
|
options {
|
||||||
|
file_path = "stdout"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
dataStorage: {
|
||||||
|
enabled: true,
|
||||||
|
storageClass: "local-path",
|
||||||
|
size: "2Gi",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
opts({ dependsOn: [serversTransport], protect: true }),
|
||||||
|
);
|
||||||
Generated
+1499
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"name": "openbao",
|
||||||
|
"main": "index.ts",
|
||||||
|
"scripts": {
|
||||||
|
"typecheck": "tsc --noEmit"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/node": "^24.19.4",
|
||||||
|
"typescript": "^6.0.3"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@pulumi/kubernetes": "^4.31.1",
|
||||||
|
"@pulumi/pulumi": "^3.278.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"strict": true,
|
||||||
|
"outDir": "bin",
|
||||||
|
"target": "es2024",
|
||||||
|
"module": "nodenext",
|
||||||
|
"moduleResolution": "nodenext",
|
||||||
|
"sourceMap": true,
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"pretty": true,
|
||||||
|
"noFallthroughCasesInSwitch": true,
|
||||||
|
"noImplicitReturns": true,
|
||||||
|
"forceConsistentCasingInFileNames": true
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"index.ts"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -24,7 +24,9 @@ proxmox-infra → k8s-bootstrap → k8s-infra
|
|||||||
## Shared conventions
|
## Shared conventions
|
||||||
|
|
||||||
- **Secrets**: read via `config.requireSecret()`, never via environment variables or hardcoded values.
|
- **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.
|
- **`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.
|
- **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.
|
- **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.
|
||||||
|
|
||||||
|
|||||||
@@ -95,6 +95,8 @@ export PULUMI_BACKEND_URL=postgresql://<user>:<pass>@<host>/<db>
|
|||||||
export PULUMI_CONFIG_PASSPHRASE=<your-passphrase>
|
export PULUMI_CONFIG_PASSPHRASE=<your-passphrase>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Clone your private config repo into `.pulumi-config/` (see [Stack config](#stack-config)). For an existing setup, use the config from that repo and skip the `stack init` and `config set` commands below.
|
||||||
|
|
||||||
Then for each stack, in order:
|
Then for each stack, in order:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -126,31 +128,35 @@ One workflow per stack, `.gitea/workflows/0N-deploy-<stack>.yaml`, scoped to cha
|
|||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
|
To rebuild the whole cluster from new VMs, follow [the rebuild runbook](docs/runbooks/full-cluster-rebuild.md). A normal `pulumi up` won't do it.
|
||||||
|
|
||||||
### Required secrets
|
### Required secrets
|
||||||
|
|
||||||
| Secret | Used by |
|
| Secret | Used by |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| `PULUMI_BACKEND_URL`, `PULUMI_CONFIG_PASSPHRASE` | all workflows |
|
| `PULUMI_BACKEND_URL`, `PULUMI_CONFIG_PASSPHRASE` | all workflows |
|
||||||
| `PROXMOX_INFRA_PULUMI_DEV_YAML` | 01-deploy-proxmox-infra |
|
| `PULUMI_CONFIG_REPO_TOKEN` (`ci-bot` token with read-only access to the config repo) | all workflows |
|
||||||
| `K8S_BOOTSTRAP_PULUMI_DEV_YAML` | 02-deploy-k8s-bootstrap |
|
|
||||||
| `K8S_INFRA_PULUMI_DEV_YAML` | 03-deploy-k8s-infra |
|
|
||||||
| `K8S_APPS_PULUMI_DEV_YAML` | 04-deploy-k8s-apps |
|
|
||||||
| `MONITORING_PULUMI_DEV_YAML` | 05-deploy-monitoring |
|
|
||||||
|
|
||||||
Each `<STACK>_PULUMI_DEV_YAML` secret is a base64-encoded copy of that stack's gitignored `Pulumi.dev.yaml`. After changing local config, re-encode and update the secret:
|
### Stack config
|
||||||
|
|
||||||
```bash
|
Each stack's encrypted `Pulumi.dev.yaml` is in a private repo, cloned into the gitignored `.pulumi-config/` folder. CI checks out its `main` branch. After changing config, commit and push it there. That push doesn't start a deploy. See that repo's README for setup and usage.
|
||||||
base64 -w 0 0N-<stack>/Pulumi.dev.yaml
|
|
||||||
```
|
CI reads the config repo as a separate user, so its token can't access your other private repos:
|
||||||
|
|
||||||
|
1. As a Gitea admin, create a regular (non-admin) user named `ci-bot`.
|
||||||
|
2. In the config repo's settings, add `ci-bot` as a collaborator with **Read** access. Don't add it to any other private repo.
|
||||||
|
3. Sign in as `ci-bot` and create an access token with only the `read:repository` permission.
|
||||||
|
4. In this repo's Actions secrets, add the token as `PULUMI_CONFIG_REPO_TOKEN`.
|
||||||
|
|
||||||
## Using this as a template
|
## Using this as a template
|
||||||
|
|
||||||
1. Fork or copy the repo
|
1. Fork or copy the repo
|
||||||
2. Update Proxmox node names/datastores and the `nodeConfigs` array in `01-proxmox-infra/index.ts` for your VM topology
|
2. Update Proxmox node names/datastores and the `nodeConfigs` array in `01-proxmox-infra/index.ts` for your VM topology
|
||||||
3. Set your own config/secrets per stack with `pulumi config set [--secret]` — see each stack's `CLAUDE.md` for the full list of required keys
|
3. Set your own config/secrets per stack with `pulumi config set [--secret]` — see each stack's `CLAUDE.md` for the full list of required keys
|
||||||
4. Point the CI/CD workflows at your own Gitea/GitOps instance and update the secrets above
|
4. Create your own private config repo and a `ci-bot` user that can read it (see [Stack config](#stack-config)), then set the repo as `repository` in each workflow's `Checkout Stack Config` steps
|
||||||
|
5. Point the CI/CD workflows at your own Gitea/GitOps instance and update the secrets above
|
||||||
|
|
||||||
## Roadmap
|
## Roadmap
|
||||||
|
|
||||||
- Migrate secrets management to [OpenBao](https://openbao.org/) — replace `PULUMI_CONFIG_PASSPHRASE` and manual `Pulumi.dev.yaml` encoding with a self-hosted vault
|
- Migrate secrets management to [OpenBao](https://openbao.org/) — replace `PULUMI_CONFIG_PASSPHRASE` and the encrypted config repo with a self-hosted vault
|
||||||
- Add a third bare-metal Proxmox node for true 3-node HA parity
|
- Add a third bare-metal Proxmox node for true 3-node HA parity
|
||||||
@@ -0,0 +1,110 @@
|
|||||||
|
# Full cluster rebuild
|
||||||
|
|
||||||
|
Use this to rebuild the k3s cluster from new VMs. **It destroys everything stored in the cluster.** To change a running cluster, don't use this runbook.
|
||||||
|
|
||||||
|
> This procedure has not been run end to end. Stop at any checkpoint that doesn't match, and don't work around it with `--force` or by clicking through a preview.
|
||||||
|
|
||||||
|
## Why a normal `pulumi up` isn't enough
|
||||||
|
|
||||||
|
- **`02-k8s-bootstrap` commands run once.** They are recorded as done in state, so after new VMs appear, `pulumi up` would report them unchanged and install nothing.
|
||||||
|
- **`03`–`05` state describes the old cluster.** The fixed `clusterIdentifier` tells Pulumi it is still the same cluster, so it would try to update resources that no longer exist.
|
||||||
|
|
||||||
|
## Before you start
|
||||||
|
|
||||||
|
1. **Save your data.** Longhorn has no backup target configured, so its volumes are lost with the VMs. That includes `heimdall-config` and the Prometheus metrics. Grafana's database is external and is not affected.
|
||||||
|
2. **Stop automatic deploys.** In Gitea's **Actions** tab, disable the `01`, `03`, `04` and `05` workflows, and don't merge anything until the last step.
|
||||||
|
3. **Back up all state.** Run this from the repo root:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mkdir -p ~/state-backups/rebuild
|
||||||
|
for S in 01-proxmox-infra 02-k8s-bootstrap 03-k8s-infra 04-k8s-apps 05-monitoring; do
|
||||||
|
pulumi stack export --stack dev --cwd "$S" --file ~/state-backups/rebuild/$S.json
|
||||||
|
done
|
||||||
|
```
|
||||||
|
|
||||||
|
These backups describe the old cluster. Once its VMs are deleted, don't restore them.
|
||||||
|
|
||||||
|
4. **Check what the rebuild depends on:**
|
||||||
|
- pfSense is running, with the [control-plane VIP and HAProxy](pfsense-control-plane-vip.md) configured. They are not managed by Pulumi. pfSense is VM 200 on the Optiplex, so if you reinstall that host, restore pfSense from a config backup first.
|
||||||
|
- The [TrueNAS NFS share](truenas-nfs.md) exists.
|
||||||
|
|
||||||
|
5. **If you reinstalled any Proxmox host:**
|
||||||
|
- Replace its CA in `02-k8s-bootstrap/certs/` (`pve1` is B550, `pve2` is Optiplex, `pve3` is Esprimo). Get it with `cat /etc/pve/pve-root-ca.pem`, and never copy anything from `/etc/pve/priv/`.
|
||||||
|
- Check that the host's certificate lists its current IP. `/etc/hosts` must have that IP before the certificate is generated.
|
||||||
|
- Recreate the API token, then update the token and endpoint in `01-proxmox-infra` config. Commit and push the change in `.pulumi-config` (see [Stack config](../../README.md#stack-config)), because CI uses the pushed version.
|
||||||
|
- The VM template on that host is gone too, so expect step 1 to recreate it.
|
||||||
|
|
||||||
|
## 1. Recreate the VMs (`01-proxmox-infra`)
|
||||||
|
|
||||||
|
1. In Proxmox, delete the six `k3s-*` VMs. Keep the `k3s-ubuntu-noble-template` VMs.
|
||||||
|
2. In pfSense, delete the six `k3s-*` DHCP static mappings. New VMs get new MAC addresses.
|
||||||
|
3. Sync state and preview:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pulumi refresh --stack dev --cwd 01-proxmox-infra
|
||||||
|
pulumi preview --stack dev --cwd 01-proxmox-infra
|
||||||
|
```
|
||||||
|
|
||||||
|
**Checkpoint:** the preview creates six VMs and six DHCP mappings, plus a template for any reinstalled host. It must show no replace or delete. These resources are protected, so if one is still in state after the refresh, find its URN with `pulumi stack --show-urns` and remove only that entry:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pulumi state delete --force --stack dev --cwd 01-proxmox-infra '<urn>'
|
||||||
|
```
|
||||||
|
|
||||||
|
4. Deploy. The VMs stay stopped until step 3.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pulumi up --stack dev --cwd 01-proxmox-infra
|
||||||
|
```
|
||||||
|
|
||||||
|
## 2. Clear the state of `02`–`05`
|
||||||
|
|
||||||
|
Only do this after the old VMs are gone. It removes Pulumi's records and doesn't touch real resources or `Pulumi.dev.yaml`. `--force` is needed because `05-monitoring` protects its namespace and Helm release, so check that the old cluster is really gone before running it.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
for S in 05-monitoring 04-k8s-apps 03-k8s-infra 02-k8s-bootstrap; do
|
||||||
|
pulumi state delete --all --force --yes --stack dev --cwd "$S"
|
||||||
|
done
|
||||||
|
```
|
||||||
|
|
||||||
|
Previews of `03`–`05` fail until step 3 is done, because `02` has no `kubeconfig` output yet.
|
||||||
|
|
||||||
|
## 3. Bootstrap k3s (`02-k8s-bootstrap`)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pulumi preview --stack dev --cwd 02-k8s-bootstrap
|
||||||
|
pulumi up --stack dev --cwd 02-k8s-bootstrap
|
||||||
|
```
|
||||||
|
|
||||||
|
**Checkpoint:** the preview only creates resources. The deploy starts the VMs, installs k3s on master-1, waits for the VIP, then joins the other nodes through it. If a step fails, fix the cause and run `pulumi up` again.
|
||||||
|
|
||||||
|
Check the new cluster with its own kubeconfig:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
(umask 077; pulumi stack output kubeconfig --show-secrets --stack dev --cwd 02-k8s-bootstrap > ~/k3s-rebuilt.yaml)
|
||||||
|
KUBECONFIG=~/k3s-rebuilt.yaml kubectl get nodes
|
||||||
|
```
|
||||||
|
|
||||||
|
**Checkpoint:** all six nodes are `Ready`. Then replace your normal kubeconfig with this file, because the old one no longer works.
|
||||||
|
|
||||||
|
## 4. Deploy `03`, `04` and `05`
|
||||||
|
|
||||||
|
Deploy these through Gitea, because the runners have the `helm` CLI that `03` needs. Re-enable each workflow as you reach it, and wait for each run to finish.
|
||||||
|
|
||||||
|
1. Run the **Deploy k8s Infra** workflow manually.
|
||||||
|
2. Run the **Deploy k8s Apps** workflow manually.
|
||||||
|
3. Run the **Deploy Monitoring** workflow manually.
|
||||||
|
|
||||||
|
## 5. Verify
|
||||||
|
|
||||||
|
```bash
|
||||||
|
kubectl get nodes
|
||||||
|
kubectl get pods -A --field-selector=status.phase!=Running,status.phase!=Succeeded
|
||||||
|
kubectl get pvc -A
|
||||||
|
kubectl get nodes.longhorn.io -n longhorn-system
|
||||||
|
kubectl get certificates -A
|
||||||
|
```
|
||||||
|
|
||||||
|
**Checkpoint:** nodes are `Ready`, no pods are unhealthy, PVCs are `Bound`, and certificates become `Ready`. New certificates come from Let's Encrypt, which rate-limits repeated requests for the same hostnames, so avoid repeated rebuilds in a short period.
|
||||||
|
|
||||||
|
Run `pulumi preview --stack dev --cwd <stack>` for all five stacks. None should show changes. Re-enable the `01` workflow, restore any data you saved, and delete `~/k3s-rebuilt.yaml` and `~/state-backups/rebuild`.
|
||||||
Reference in new issue
Block a user