feature: add OpenBao ingress and deploy workflow
Traefik verifies OpenBao's certificate against the internal CA. Helm doesn't wait for readiness because the pods stay sealed until they are unsealed by hand.
This commit is contained in:
1 parent
8e87e33937
commit
01999ce28f
2 files changed
+133
-3
No files matched your search
@@ -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 }}
|
||||
+34
-3
@@ -4,8 +4,13 @@ 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,
|
||||
@@ -94,7 +99,24 @@ const serverCert = new k8s.apiextensions.CustomResource(
|
||||
opts({ dependsOn: [caIssuer] }),
|
||||
);
|
||||
|
||||
const openbao = new k8s.helm.v3.Release(
|
||||
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",
|
||||
@@ -102,6 +124,8 @@ const openbao = new k8s.helm.v3.Release(
|
||||
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,
|
||||
@@ -132,10 +156,17 @@ const openbao = new k8s.helm.v3.Release(
|
||||
active: {
|
||||
annotations: {
|
||||
"traefik.ingress.kubernetes.io/service.serverstransport":
|
||||
"openbao-openbao@kubernetescrd",
|
||||
"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: [
|
||||
@@ -225,5 +256,5 @@ audit "file" "stdout" {
|
||||
},
|
||||
},
|
||||
},
|
||||
opts({ dependsOn: [serverCert] }),
|
||||
opts({ dependsOn: [serversTransport], protect: true }),
|
||||
);
|
||||
Reference in new issue
Block a user