Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
020b277a04 | ||
|
|
ba53cbc465 |
@@ -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,
|
||||||
@@ -174,6 +178,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";
|
||||||
|
|||||||
Reference in new issue
Block a user