Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
020b277a04 | ||
|
|
ba53cbc465 | ||
|
|
b4d27c6546 | ||
|
|
481ff9e7ac | ||
|
|
5865c38ea7 | ||
|
|
4f90febc89 | ||
|
|
90c3d37e74 |
No files matched your search
@@ -19,6 +19,10 @@ const letsencryptEmail = config.requireSecret("letsencryptEmail");
|
||||
const kubeVipAddress = config.requireSecret("kubeVipAddress");
|
||||
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 opts = (extras?: pulumi.ResourceOptions): pulumi.ResourceOptions => ({
|
||||
provider: k8sProvider,
|
||||
@@ -69,6 +73,7 @@ const certManager = new k8s.helm.v3.Release(
|
||||
{
|
||||
name: "cert-manager",
|
||||
chart: "cert-manager",
|
||||
version: "v1.21.1",
|
||||
repositoryOpts: { repo: "https://charts.jetstack.io" },
|
||||
namespace: "cert-manager",
|
||||
createNamespace: true,
|
||||
@@ -173,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 ────────────
|
||||
|
||||
const kubeVipNamespace = "kube-system";
|
||||
|
||||
@@ -47,6 +47,7 @@ new k8s.apps.v1.Deployment(
|
||||
},
|
||||
spec: {
|
||||
replicas: 1,
|
||||
strategy: { type: "Recreate" },
|
||||
selector: { matchLabels: labels },
|
||||
template: {
|
||||
metadata: { labels },
|
||||
@@ -70,6 +71,20 @@ new k8s.apps.v1.Deployment(
|
||||
},
|
||||
],
|
||||
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