Start TEN-WP-0005-T05: recover deploy manifests and add CI image build
All checks were successful
Build and Publish Container Image / build-and-push (push) Successful in 20s
All checks were successful
Build and Publish Container Image / build-and-push (push) Successful in 20s
Production still serves the TEN-WP-0004 image, which has no lifecycle routes. Recover the live railiance01 objects into deploy/ so rollback does not depend on a cluster annotation, and add the fleet CI image workflow so the lifecycle image is built from a forge revision.
This commit is contained in:
parent
baf41a7765
commit
7e68cc835e
4 changed files with 263 additions and 2 deletions
55
deploy/README.md
Normal file
55
deploy/README.md
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
# tenant-engine production deployment
|
||||
|
||||
Manifests recovered from the live objects'
|
||||
`kubectl.kubernetes.io/last-applied-configuration` on 2026-08-14 so that a
|
||||
rollback does not depend on a cluster annotation. Applied originally during
|
||||
TEN-WP-0004; TEN-WP-0005 keeps them in-repo and pins by digest.
|
||||
|
||||
| File | Deployment | Service DNS |
|
||||
| --- | --- | --- |
|
||||
| `tenant-engine.yaml` | `tenant-engine` | `tenant-engine.tenant-engine.svc.cluster.local:8090` |
|
||||
|
||||
The file is a five-document manifest: `Namespace`, `PersistentVolumeClaim`,
|
||||
`Deployment`, `Service`, and a least-privilege `NetworkPolicy`. Ingress is
|
||||
restricted to the `user-engine` workload; egress is restricted to
|
||||
`flex-auth-tenant-engine` on 8080 plus cluster DNS.
|
||||
|
||||
## Rolling out an image
|
||||
|
||||
**Do not build images on a workstation.** `.forgejo/workflows/image.yaml`
|
||||
builds from a pushed forge commit on the `container-build` runner.
|
||||
|
||||
```bash
|
||||
# 1. Push the commit you intend to ship; CI builds :latest and :main-<short-sha>
|
||||
git push origin main
|
||||
|
||||
# 2. Take the immutable digest from the workflow's "Report immutable digest"
|
||||
# step -- deploy by digest, never by tag
|
||||
|
||||
# 3. Edit the image digest in deploy/tenant-engine.yaml, then apply
|
||||
kubectl apply -f deploy/tenant-engine.yaml
|
||||
kubectl -n tenant-engine rollout status deploy/tenant-engine --timeout=120s
|
||||
```
|
||||
|
||||
The Deployment uses `Recreate` because the SQLite PVC is `ReadWriteOnce`.
|
||||
A new pod applies the forward-only lifecycle migration on startup against
|
||||
the existing database.
|
||||
|
||||
## Rollback
|
||||
|
||||
```bash
|
||||
kubectl -n tenant-engine rollout undo deploy/tenant-engine
|
||||
```
|
||||
|
||||
If the ReplicaSet history has been pruned, re-apply the manifest with the
|
||||
last-known-good digest below.
|
||||
|
||||
| Deployment | Digest | State |
|
||||
| --- | --- | --- |
|
||||
| `tenant-engine` | `sha256:2249e8c6ee44ae36081cddc52daf9c3f63acd18a95a5d620ab4fa7ac85149207` | **current** — TEN-WP-0004 create/role/plan API, live since 2026-08-09 |
|
||||
| `tenant-engine` *(earlier)* | `sha256:33c5dd84eaf1c2f5e067c04931219e13f9348a764a153d641035a6d019095d4f` | first TEN-WP-0004 revision |
|
||||
|
||||
Rolling back to `2249e8c6…` removes the lifecycle routes (`GET /tenants/{id}`,
|
||||
`PATCH`, retire, reactivate). Create, role grant/revoke, and plan assign keep
|
||||
working. The SQLite lifecycle columns added by the TEN-WP-0005 migration are
|
||||
forward-only and stay in place; the older image ignores them.
|
||||
140
deploy/tenant-engine.yaml
Normal file
140
deploy/tenant-engine.yaml
Normal file
|
|
@ -0,0 +1,140 @@
|
|||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: tenant-engine
|
||||
labels:
|
||||
net-kingdom/component: tenant-engine
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: tenant-engine-data
|
||||
namespace: tenant-engine
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: tenant-engine
|
||||
namespace: tenant-engine
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: tenant-engine
|
||||
strategy:
|
||||
type: Recreate
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/name: tenant-engine
|
||||
spec:
|
||||
automountServiceAccountToken: false
|
||||
containers:
|
||||
- name: tenant-engine
|
||||
env:
|
||||
- name: TENANT_ENGINE_DATABASE_PATH
|
||||
value: /data/tenant-engine.db
|
||||
- name: TENANT_ENGINE_FLEX_AUTH_URL
|
||||
value: http://flex-auth-tenant-engine.flex-auth.svc.cluster.local:8080
|
||||
image: forgejo.coulomb.social/coulomb/tenant-engine@sha256:2249e8c6ee44ae36081cddc52daf9c3f63acd18a95a5d620ab4fa7ac85149207
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /health
|
||||
port: http
|
||||
periodSeconds: 20
|
||||
ports:
|
||||
- containerPort: 8090
|
||||
name: http
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /health
|
||||
port: http
|
||||
periodSeconds: 5
|
||||
resources:
|
||||
limits:
|
||||
cpu: 300m
|
||||
memory: 192Mi
|
||||
requests:
|
||||
cpu: 25m
|
||||
memory: 48Mi
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
capabilities:
|
||||
drop:
|
||||
- ALL
|
||||
readOnlyRootFilesystem: true
|
||||
volumeMounts:
|
||||
- mountPath: /data
|
||||
name: data
|
||||
securityContext:
|
||||
fsGroup: 10001
|
||||
runAsNonRoot: true
|
||||
seccompProfile:
|
||||
type: RuntimeDefault
|
||||
volumes:
|
||||
- name: data
|
||||
persistentVolumeClaim:
|
||||
claimName: tenant-engine-data
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: tenant-engine
|
||||
namespace: tenant-engine
|
||||
spec:
|
||||
ports:
|
||||
- name: http
|
||||
port: 8090
|
||||
targetPort: http
|
||||
selector:
|
||||
app.kubernetes.io/name: tenant-engine
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: NetworkPolicy
|
||||
metadata:
|
||||
name: tenant-engine
|
||||
namespace: tenant-engine
|
||||
spec:
|
||||
podSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: tenant-engine
|
||||
policyTypes:
|
||||
- Ingress
|
||||
- Egress
|
||||
ingress:
|
||||
- from:
|
||||
- namespaceSelector:
|
||||
matchLabels:
|
||||
kubernetes.io/metadata.name: user-engine
|
||||
podSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: user-engine
|
||||
ports:
|
||||
- port: 8090
|
||||
protocol: TCP
|
||||
egress:
|
||||
- ports:
|
||||
- port: 8080
|
||||
protocol: TCP
|
||||
to:
|
||||
- namespaceSelector:
|
||||
matchLabels:
|
||||
kubernetes.io/metadata.name: flex-auth
|
||||
podSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: flex-auth-tenant-engine
|
||||
- ports:
|
||||
- port: 53
|
||||
protocol: UDP
|
||||
- port: 53
|
||||
protocol: TCP
|
||||
to:
|
||||
- namespaceSelector:
|
||||
matchLabels:
|
||||
kubernetes.io/metadata.name: kube-system
|
||||
Loading…
Add table
Add a link
Reference in a new issue