prole/deploy/opentofu/k3s/manifests/opentofu/deployment.yaml
chrisfu b03efa8f69 Kong API gateway, docker-import preload, OpenTofu graceful fallback, milestone fix
Kong API Gateway (replacing prole nginx):
- Add etc/init_kong.sh provisioning script (DB-less mode, prole-db namespace)
- Add kong-deployment.yaml and kong-service.yaml manifests
- Rewire ingress rules (svc/git/api.prole.org) to prole-db-kong:8000
- Update kustomization.yaml to reference kong manifests

PostgREST & DB Manager in prole-db namespace:
- Add etc/init_postgrest.sh and etc/init_db_manager.sh scripts
- Add postgrest/db-manager deployment and service manifests
- Add src/db-manager/ Node.js REST endpoint for backup triggers
- Default NAMESPACE changed to prole-db in both scripts

Docker image pre-load from PROLE_DATA/docker-import:
- Add _preload_docker_images() to init_common_services.sh
- Scan for .tar files exported by final_deployment.sh
- Import via k3d image import (k3d) or ctr (k3s) before deployments
- Increase rollout timeouts to 300s (configurable via ROLLOUT_TIMEOUT) in init_openbao.sh, init_opentofu.sh, init_garage_store.sh, init_registry.sh

OpenTofu password resolution fix:
- Add Kubernetes secret fallback in resolve_admin_password()
- Change hard exit 1 to graceful return 1 with warning
- Wrap call in if-guard so set -e doesn't abort the script chain

Milestone fix (init scripts not running):
- Add init_kong.sh, init_postgrest.sh, init_db_manager.sh to InitializationScriptsMilestone.execute() script list and arg branches
- Previously only actions.py had these; milestones.py was missing them

Installer integration:
- Add Kong/PostgREST/DB Manager to silent installer _step_init_scripts
- Add corresponding tabs and execution blocks in UI services.py
2026-02-22 00:57:49 -08:00

114 lines
2.9 KiB
YAML

apiVersion: v1
kind: ConfigMap
metadata:
name: opentofu-nginx
data:
default.conf: |
server {
listen 8080;
server_name _;
auth_basic "OpenTofu";
auth_basic_user_file /etc/nginx/auth/auth;
location / {
root /usr/share/nginx/html;
index index.html;
}
}
index.html: |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>OpenTofu</title>
<style>
body { font-family: "SF Pro Text", "Segoe UI", sans-serif; background: #f5f5f0; color: #1d1d1f; }
.wrap { max-width: 720px; margin: 60px auto; padding: 32px; background: #fff; border-radius: 16px; box-shadow: 0 8px 24px rgba(0,0,0,0.08); }
h1 { margin-top: 0; font-size: 28px; }
code { background: #f2f2f2; padding: 2px 6px; border-radius: 6px; }
</style>
</head>
<body>
<div class="wrap">
<h1>OpenTofu Pipeline Ready</h1>
<p>This service hosts the OpenTofu control plane for Prole deployments.</p>
<p>Pipeline root (on disk): <code>deploy/opentofu/k3s</code></p>
</div>
</body>
</html>
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: opentofu
labels:
app: opentofu
spec:
replicas: 1
selector:
matchLabels:
app: opentofu
template:
metadata:
labels:
app: opentofu
spec:
nodeSelector:
kubernetes.io/hostname: myrddin.prole.org
containers:
- name: opentofu-ui
image: nginx:1.27-alpine
ports:
- name: http
containerPort: 8080
volumeMounts:
- name: nginx-config
mountPath: /etc/nginx/conf.d
- name: ui-content
mountPath: /usr/share/nginx/html
- name: opentofu-auth
mountPath: /etc/nginx/auth
readOnly: true
- name: opentofu-runner
image: ghcr.io/opentofu/opentofu:1.8.2
command: ["sh", "-c", "tofu version && tail -f /dev/null"]
env:
- name: OPENTOFU_ADMIN_PASSWORD
valueFrom:
secretKeyRef:
name: opentofu-admin
key: admin_password
volumes:
- name: nginx-config
configMap:
name: opentofu-nginx
items:
- key: default.conf
path: default.conf
- name: ui-content
configMap:
name: opentofu-nginx
items:
- key: index.html
path: index.html
- name: opentofu-auth
secret:
secretName: opentofu-admin
items:
- key: auth
path: auth
---
apiVersion: v1
kind: Service
metadata:
name: opentofu
spec:
selector:
app: opentofu
ports:
- name: http
port: 8080
targetPort: http