Compare commits
12
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7acf83e68d | ||
|
|
088cb5add1 | ||
|
|
b04ab52fd2 | ||
|
|
ff2b565677 | ||
|
|
4b22f4ad11 | ||
|
|
020b277a04 | ||
|
|
ba53cbc465 | ||
|
|
b4d27c6546 | ||
|
|
481ff9e7ac | ||
|
|
5865c38ea7 | ||
|
|
4f90febc89 | ||
|
|
90c3d37e74 |
No files matched your search
@@ -7,8 +7,8 @@
|
|||||||
#
|
#
|
||||||
# Scope: used for PRs only (list, open, check CI status, merge after your OK).
|
# 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.
|
# 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
|
# In .claude/settings.json, GET and POST (e.g. opening a PR) run without a
|
||||||
# DELETE (anything that changes something) always ask first.
|
# prompt. Merging a PR (POST .../merge), PATCH, PUT and DELETE always ask first.
|
||||||
#
|
#
|
||||||
# Usage: gitea.sh METHOD PATH [BODY]
|
# Usage: gitea.sh METHOD PATH [BODY]
|
||||||
# METHOD GET | POST | PATCH | PUT | DELETE
|
# METHOD GET | POST | PATCH | PUT | DELETE
|
||||||
|
|||||||
@@ -23,6 +23,9 @@
|
|||||||
"Bash(git add *)",
|
"Bash(git add *)",
|
||||||
"Bash(git switch *)",
|
"Bash(git switch *)",
|
||||||
"Bash(.claude/scripts/gitea.sh GET *)",
|
"Bash(.claude/scripts/gitea.sh GET *)",
|
||||||
|
"Bash(.claude/scripts/gitea.sh POST *)",
|
||||||
|
"Bash(git commit *)",
|
||||||
|
"Bash(git push *)",
|
||||||
"WebFetch(domain:www.pulumi.com)",
|
"WebFetch(domain:www.pulumi.com)",
|
||||||
"WebFetch(domain:github.com)",
|
"WebFetch(domain:github.com)",
|
||||||
"WebFetch(domain:raw.githubusercontent.com)",
|
"WebFetch(domain:raw.githubusercontent.com)",
|
||||||
@@ -51,9 +54,7 @@
|
|||||||
"Bash(ssh *)",
|
"Bash(ssh *)",
|
||||||
"Bash(scp *)",
|
"Bash(scp *)",
|
||||||
"Bash(curl *)",
|
"Bash(curl *)",
|
||||||
"Bash(git commit *)",
|
"Bash(.claude/scripts/gitea.sh POST */merge*)",
|
||||||
"Bash(git push *)",
|
|
||||||
"Bash(.claude/scripts/gitea.sh POST *)",
|
|
||||||
"Bash(.claude/scripts/gitea.sh PATCH *)",
|
"Bash(.claude/scripts/gitea.sh PATCH *)",
|
||||||
"Bash(.claude/scripts/gitea.sh PUT *)",
|
"Bash(.claude/scripts/gitea.sh PUT *)",
|
||||||
"Bash(.claude/scripts/gitea.sh DELETE *)"
|
"Bash(.claude/scripts/gitea.sh DELETE *)"
|
||||||
|
|||||||
+116
-1
@@ -19,6 +19,10 @@ const letsencryptEmail = config.requireSecret("letsencryptEmail");
|
|||||||
const kubeVipAddress = config.requireSecret("kubeVipAddress");
|
const kubeVipAddress = config.requireSecret("kubeVipAddress");
|
||||||
const kubeVipInterface = config.require("kubeVipInterface");
|
const kubeVipInterface = config.require("kubeVipInterface");
|
||||||
|
|
||||||
|
const domain = config.requireSecret("domain");
|
||||||
|
const longhornUiUser = config.requireSecret("longhornUiUser");
|
||||||
|
const longhornUiPassword = config.requireSecret("longhornUiPassword");
|
||||||
|
|
||||||
const k8sProvider = new k8s.Provider("k3s", { kubeconfig });
|
const k8sProvider = new k8s.Provider("k3s", { kubeconfig });
|
||||||
const opts = (extras?: pulumi.ResourceOptions): pulumi.ResourceOptions => ({
|
const opts = (extras?: pulumi.ResourceOptions): pulumi.ResourceOptions => ({
|
||||||
provider: k8sProvider,
|
provider: k8sProvider,
|
||||||
@@ -69,6 +73,7 @@ const certManager = new k8s.helm.v3.Release(
|
|||||||
{
|
{
|
||||||
name: "cert-manager",
|
name: "cert-manager",
|
||||||
chart: "cert-manager",
|
chart: "cert-manager",
|
||||||
|
version: "v1.21.1",
|
||||||
repositoryOpts: { repo: "https://charts.jetstack.io" },
|
repositoryOpts: { repo: "https://charts.jetstack.io" },
|
||||||
namespace: "cert-manager",
|
namespace: "cert-manager",
|
||||||
createNamespace: true,
|
createNamespace: true,
|
||||||
@@ -133,15 +138,61 @@ const longhorn = new k8s.helm.v3.Release(
|
|||||||
version: "1.12.0",
|
version: "1.12.0",
|
||||||
values: {
|
values: {
|
||||||
defaultSettings: {
|
defaultSettings: {
|
||||||
defaultReplicaCount: 2,
|
defaultReplicaCount: 3,
|
||||||
nodeDownPodDeletionPolicy: "delete-both-statefulset-and-deployment-pod",
|
nodeDownPodDeletionPolicy: "delete-both-statefulset-and-deployment-pod",
|
||||||
createDefaultDiskLabeledNodes: true,
|
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(),
|
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.
|
// Patches Longhorn instances to use the mountend Longhorn storage on the worker nodes.
|
||||||
["k3s-worker-1", "k3s-worker-2", "k3s-worker-3"].forEach(
|
["k3s-worker-1", "k3s-worker-2", "k3s-worker-3"].forEach(
|
||||||
(nodeName) =>
|
(nodeName) =>
|
||||||
@@ -173,6 +224,70 @@ const longhorn = new k8s.helm.v3.Release(
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// ── Longhorn UI ───────────────────────────────────────────────────────────
|
||||||
|
// Docs: https://longhorn.io/docs/1.12.0/deploy/accessing-the-ui/longhorn-ingress-traefik/
|
||||||
|
// https://doc.traefik.io/traefik/reference/routing-configuration/http/middlewares/basicauth/
|
||||||
|
|
||||||
|
const longhornUiAuthSecret = new k8s.core.v1.Secret(
|
||||||
|
"longhorn-ui-basic-auth",
|
||||||
|
{
|
||||||
|
metadata: { name: "longhorn-ui-basic-auth", namespace: "longhorn-system" },
|
||||||
|
type: "kubernetes.io/basic-auth",
|
||||||
|
stringData: { username: longhornUiUser, password: longhornUiPassword },
|
||||||
|
},
|
||||||
|
opts({ dependsOn: [longhorn] }),
|
||||||
|
);
|
||||||
|
|
||||||
|
// Fixed name: the Ingress references it as <namespace>-<name>@kubernetescrd.
|
||||||
|
const longhornUiAuth = new k8s.apiextensions.CustomResource(
|
||||||
|
"longhorn-ui-auth",
|
||||||
|
{
|
||||||
|
apiVersion: "traefik.io/v1alpha1",
|
||||||
|
kind: "Middleware",
|
||||||
|
metadata: { name: "longhorn-ui-auth", namespace: "longhorn-system" },
|
||||||
|
spec: { basicAuth: { secret: longhornUiAuthSecret.metadata.name } },
|
||||||
|
},
|
||||||
|
opts(),
|
||||||
|
);
|
||||||
|
|
||||||
|
const longhornUiHost = pulumi.interpolate`longhorn.${domain}`;
|
||||||
|
|
||||||
|
new k8s.networking.v1.Ingress(
|
||||||
|
"longhorn-ui",
|
||||||
|
{
|
||||||
|
metadata: {
|
||||||
|
name: "longhorn-ui",
|
||||||
|
namespace: "longhorn-system",
|
||||||
|
annotations: {
|
||||||
|
"cert-manager.io/cluster-issuer": "letsencrypt-prod",
|
||||||
|
"traefik.ingress.kubernetes.io/router.middlewares":
|
||||||
|
"longhorn-system-longhorn-ui-auth@kubernetescrd",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
spec: {
|
||||||
|
ingressClassName: "traefik",
|
||||||
|
tls: [{ hosts: [longhornUiHost], secretName: "longhorn-ui-tls" }],
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
host: longhornUiHost,
|
||||||
|
http: {
|
||||||
|
paths: [
|
||||||
|
{
|
||||||
|
path: "/",
|
||||||
|
pathType: "Prefix",
|
||||||
|
backend: {
|
||||||
|
service: { name: "longhorn-frontend", port: { number: 80 } },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
opts({ dependsOn: [longhorn, longhornUiAuth] }),
|
||||||
|
);
|
||||||
|
|
||||||
// ── kube-vip ────────────
|
// ── kube-vip ────────────
|
||||||
|
|
||||||
const kubeVipNamespace = "kube-system";
|
const kubeVipNamespace = "kube-system";
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ new k8s.apps.v1.Deployment(
|
|||||||
},
|
},
|
||||||
spec: {
|
spec: {
|
||||||
replicas: 1,
|
replicas: 1,
|
||||||
|
strategy: { type: "Recreate" },
|
||||||
selector: { matchLabels: labels },
|
selector: { matchLabels: labels },
|
||||||
template: {
|
template: {
|
||||||
metadata: { labels },
|
metadata: { labels },
|
||||||
@@ -70,6 +71,20 @@ new k8s.apps.v1.Deployment(
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
terminationGracePeriodSeconds: 5,
|
terminationGracePeriodSeconds: 5,
|
||||||
|
tolerations: [
|
||||||
|
{
|
||||||
|
key: "node.kubernetes.io/unreachable",
|
||||||
|
operator: "Exists",
|
||||||
|
effect: "NoExecute",
|
||||||
|
tolerationSeconds: 30,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "node.kubernetes.io/not-ready",
|
||||||
|
operator: "Exists",
|
||||||
|
effect: "NoExecute",
|
||||||
|
tolerationSeconds: 30,
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in new issue
Block a user