Improve demo seed

This commit is contained in:
Urtzi Alfaro
2025-10-17 07:31:14 +02:00
parent b6cb800758
commit d4060962e4
56 changed files with 8235 additions and 339 deletions

View File

@@ -0,0 +1,58 @@
apiVersion: batch/v1
kind: Job
metadata:
name: demo-seed-customers
namespace: bakery-ia
labels:
app: demo-seed
component: initialization
annotations:
"helm.sh/hook": post-install,post-upgrade
"helm.sh/hook-weight": "25" # After orders migration (20)
spec:
ttlSecondsAfterFinished: 3600
template:
metadata:
labels:
app: demo-seed-customers
spec:
initContainers:
- name: wait-for-orders-migration
image: busybox:1.36
command:
- sh
- -c
- |
echo "Waiting 30 seconds for orders-migration to complete..."
sleep 30
- name: wait-for-tenant-seed
image: busybox:1.36
command:
- sh
- -c
- |
echo "Waiting 15 seconds for demo-seed-tenants to complete..."
sleep 15
containers:
- name: seed-customers
image: bakery/orders-service:latest
command: ["python", "/app/scripts/demo/seed_demo_customers.py"]
env:
- name: ORDERS_DATABASE_URL
valueFrom:
secretKeyRef:
name: database-secrets
key: ORDERS_DATABASE_URL
- name: DEMO_MODE
value: "production"
- name: LOG_LEVEL
value: "INFO"
resources:
requests:
memory: "256Mi"
cpu: "100m"
limits:
memory: "512Mi"
cpu: "500m"
restartPolicy: OnFailure
serviceAccountName: demo-seed-sa

View File

@@ -0,0 +1,58 @@
apiVersion: batch/v1
kind: Job
metadata:
name: demo-seed-equipment
namespace: bakery-ia
labels:
app: demo-seed
component: initialization
annotations:
"helm.sh/hook": post-install,post-upgrade
"helm.sh/hook-weight": "25" # After production migration (20)
spec:
ttlSecondsAfterFinished: 3600
template:
metadata:
labels:
app: demo-seed-equipment
spec:
initContainers:
- name: wait-for-production-migration
image: busybox:1.36
command:
- sh
- -c
- |
echo "Waiting 30 seconds for production-migration to complete..."
sleep 30
- name: wait-for-tenant-seed
image: busybox:1.36
command:
- sh
- -c
- |
echo "Waiting 15 seconds for demo-seed-tenants to complete..."
sleep 15
containers:
- name: seed-equipment
image: bakery/production-service:latest
command: ["python", "/app/scripts/demo/seed_demo_equipment.py"]
env:
- name: PRODUCTION_DATABASE_URL
valueFrom:
secretKeyRef:
name: database-secrets
key: PRODUCTION_DATABASE_URL
- name: DEMO_MODE
value: "production"
- name: LOG_LEVEL
value: "INFO"
resources:
requests:
memory: "256Mi"
cpu: "100m"
limits:
memory: "512Mi"
cpu: "500m"
restartPolicy: OnFailure
serviceAccountName: demo-seed-sa

View File

@@ -0,0 +1,58 @@
apiVersion: batch/v1
kind: Job
metadata:
name: demo-seed-forecasts
namespace: bakery-ia
labels:
app: demo-seed
component: initialization
annotations:
"helm.sh/hook": post-install,post-upgrade
"helm.sh/hook-weight": "40" # Last seed job
spec:
ttlSecondsAfterFinished: 3600
template:
metadata:
labels:
app: demo-seed-forecasts
spec:
initContainers:
- name: wait-for-forecasting-migration
image: busybox:1.36
command:
- sh
- -c
- |
echo "Waiting 30 seconds for forecasting-migration to complete..."
sleep 30
- name: wait-for-tenant-seed
image: busybox:1.36
command:
- sh
- -c
- |
echo "Waiting 15 seconds for demo-seed-tenants to complete..."
sleep 15
containers:
- name: seed-forecasts
image: bakery/forecasting-service:latest
command: ["python", "/app/scripts/demo/seed_demo_forecasts.py"]
env:
- name: FORECASTING_DATABASE_URL
valueFrom:
secretKeyRef:
name: database-secrets
key: FORECASTING_DATABASE_URL
- name: DEMO_MODE
value: "production"
- name: LOG_LEVEL
value: "INFO"
resources:
requests:
memory: "512Mi"
cpu: "200m"
limits:
memory: "1Gi"
cpu: "1000m"
restartPolicy: OnFailure
serviceAccountName: demo-seed-sa

View File

@@ -0,0 +1,58 @@
apiVersion: batch/v1
kind: Job
metadata:
name: demo-seed-orders
namespace: bakery-ia
labels:
app: demo-seed
component: initialization
annotations:
"helm.sh/hook": post-install,post-upgrade
"helm.sh/hook-weight": "30" # After customers (25)
spec:
ttlSecondsAfterFinished: 3600
template:
metadata:
labels:
app: demo-seed-orders
spec:
initContainers:
- name: wait-for-orders-migration
image: busybox:1.36
command:
- sh
- -c
- |
echo "Waiting 30 seconds for orders-migration to complete..."
sleep 30
- name: wait-for-customers-seed
image: busybox:1.36
command:
- sh
- -c
- |
echo "Waiting 20 seconds for demo-seed-customers to complete..."
sleep 20
containers:
- name: seed-orders
image: bakery/orders-service:latest
command: ["python", "/app/scripts/demo/seed_demo_orders.py"]
env:
- name: ORDERS_DATABASE_URL
valueFrom:
secretKeyRef:
name: database-secrets
key: ORDERS_DATABASE_URL
- name: DEMO_MODE
value: "production"
- name: LOG_LEVEL
value: "INFO"
resources:
requests:
memory: "512Mi"
cpu: "200m"
limits:
memory: "1Gi"
cpu: "1000m"
restartPolicy: OnFailure
serviceAccountName: demo-seed-sa

View File

@@ -0,0 +1,58 @@
apiVersion: batch/v1
kind: Job
metadata:
name: demo-seed-procurement
namespace: bakery-ia
labels:
app: demo-seed
component: initialization
annotations:
"helm.sh/hook": post-install,post-upgrade
"helm.sh/hook-weight": "35" # After orders (30)
spec:
ttlSecondsAfterFinished: 3600
template:
metadata:
labels:
app: demo-seed-procurement
spec:
initContainers:
- name: wait-for-orders-migration
image: busybox:1.36
command:
- sh
- -c
- |
echo "Waiting 30 seconds for orders-migration to complete..."
sleep 30
- name: wait-for-tenant-seed
image: busybox:1.36
command:
- sh
- -c
- |
echo "Waiting 15 seconds for demo-seed-tenants to complete..."
sleep 15
containers:
- name: seed-procurement
image: bakery/orders-service:latest
command: ["python", "/app/scripts/demo/seed_demo_procurement.py"]
env:
- name: ORDERS_DATABASE_URL
valueFrom:
secretKeyRef:
name: database-secrets
key: ORDERS_DATABASE_URL
- name: DEMO_MODE
value: "production"
- name: LOG_LEVEL
value: "INFO"
resources:
requests:
memory: "512Mi"
cpu: "200m"
limits:
memory: "1Gi"
cpu: "1000m"
restartPolicy: OnFailure
serviceAccountName: demo-seed-sa

View File

@@ -0,0 +1,66 @@
apiVersion: batch/v1
kind: Job
metadata:
name: demo-seed-production-batches
namespace: bakery-ia
labels:
app: demo-seed
component: initialization
annotations:
"helm.sh/hook": post-install,post-upgrade
"helm.sh/hook-weight": "30" # After equipment (25) and other dependencies
spec:
ttlSecondsAfterFinished: 3600
template:
metadata:
labels:
app: demo-seed-production-batches
spec:
initContainers:
- name: wait-for-production-migration
image: busybox:1.36
command:
- sh
- -c
- |
echo "Waiting 30 seconds for production-migration to complete..."
sleep 30
- name: wait-for-tenant-seed
image: busybox:1.36
command:
- sh
- -c
- |
echo "Waiting 15 seconds for demo-seed-tenants to complete..."
sleep 15
- name: wait-for-recipes-seed
image: busybox:1.36
command:
- sh
- -c
- |
echo "Waiting 10 seconds for recipes seed to complete..."
sleep 10
containers:
- name: seed-production-batches
image: bakery/production-service:latest
command: ["python", "/app/scripts/demo/seed_demo_batches.py"]
env:
- name: PRODUCTION_DATABASE_URL
valueFrom:
secretKeyRef:
name: database-secrets
key: PRODUCTION_DATABASE_URL
- name: DEMO_MODE
value: "production"
- name: LOG_LEVEL
value: "INFO"
resources:
requests:
memory: "256Mi"
cpu: "100m"
limits:
memory: "512Mi"
cpu: "500m"
restartPolicy: OnFailure
serviceAccountName: demo-seed-sa

View File

@@ -0,0 +1,58 @@
apiVersion: batch/v1
kind: Job
metadata:
name: demo-seed-quality-templates
namespace: bakery-ia
labels:
app: demo-seed
component: initialization
annotations:
"helm.sh/hook": post-install,post-upgrade
"helm.sh/hook-weight": "22" # After production migration (20), before equipment (25)
spec:
ttlSecondsAfterFinished: 3600
template:
metadata:
labels:
app: demo-seed-quality-templates
spec:
initContainers:
- name: wait-for-production-migration
image: busybox:1.36
command:
- sh
- -c
- |
echo "Waiting 30 seconds for production-migration to complete..."
sleep 30
- name: wait-for-tenant-seed
image: busybox:1.36
command:
- sh
- -c
- |
echo "Waiting 15 seconds for demo-seed-tenants to complete..."
sleep 15
containers:
- name: seed-quality-templates
image: bakery/production-service:latest
command: ["python", "/app/scripts/demo/seed_demo_quality_templates.py"]
env:
- name: PRODUCTION_DATABASE_URL
valueFrom:
secretKeyRef:
name: database-secrets
key: PRODUCTION_DATABASE_URL
- name: DEMO_MODE
value: "production"
- name: LOG_LEVEL
value: "INFO"
resources:
requests:
memory: "256Mi"
cpu: "100m"
limits:
memory: "512Mi"
cpu: "500m"
restartPolicy: OnFailure
serviceAccountName: demo-seed-sa

View File

@@ -0,0 +1,58 @@
apiVersion: batch/v1
kind: Job
metadata:
name: demo-seed-stock
namespace: bakery-ia
labels:
app: demo-seed
component: initialization
annotations:
"helm.sh/hook": post-install,post-upgrade
"helm.sh/hook-weight": "20"
spec:
ttlSecondsAfterFinished: 3600
template:
metadata:
labels:
app: demo-seed-stock
spec:
initContainers:
- name: wait-for-inventory-migration
image: busybox:1.36
command:
- sh
- -c
- |
echo "Waiting 30 seconds for inventory-migration to complete..."
sleep 30
- name: wait-for-inventory-seed
image: busybox:1.36
command:
- sh
- -c
- |
echo "Waiting 15 seconds for demo-seed-inventory to complete..."
sleep 15
containers:
- name: seed-stock
image: bakery/inventory-service:latest
command: ["python", "/app/scripts/demo/seed_demo_stock.py"]
env:
- name: INVENTORY_DATABASE_URL
valueFrom:
secretKeyRef:
name: database-secrets
key: INVENTORY_DATABASE_URL
- name: DEMO_MODE
value: "production"
- name: LOG_LEVEL
value: "INFO"
resources:
requests:
memory: "256Mi"
cpu: "100m"
limits:
memory: "512Mi"
cpu: "500m"
restartPolicy: OnFailure
serviceAccountName: demo-seed-sa

View File

@@ -0,0 +1,56 @@
apiVersion: batch/v1
kind: Job
metadata:
name: demo-seed-tenant-members
namespace: bakery-ia
labels:
app: demo-seed
component: initialization
annotations:
"helm.sh/hook": post-install,post-upgrade
"helm.sh/hook-weight": "15"
spec:
ttlSecondsAfterFinished: 3600
template:
metadata:
labels:
app: demo-seed-tenant-members
spec:
initContainers:
- name: wait-for-tenant-seed
image: busybox:1.36
command:
- sh
- -c
- |
echo "Waiting 45 seconds for demo-seed-tenants to complete..."
sleep 45
- name: wait-for-user-seed
image: busybox:1.36
command:
- sh
- -c
- |
echo "Waiting 15 seconds for demo-seed-users to complete..."
sleep 15
containers:
- name: seed-tenant-members
image: bakery/tenant-service:latest
command: ["python", "/app/scripts/demo/seed_demo_tenant_members.py"]
env:
- name: TENANT_DATABASE_URL
valueFrom:
secretKeyRef:
name: database-secrets
key: TENANT_DATABASE_URL
- name: LOG_LEVEL
value: "INFO"
resources:
requests:
memory: "256Mi"
cpu: "100m"
limits:
memory: "512Mi"
cpu: "500m"
restartPolicy: OnFailure
serviceAccountName: demo-seed-sa

View File

@@ -32,16 +32,25 @@ resources:
- migrations/alert-processor-migration-job.yaml
- migrations/demo-session-migration-job.yaml
# Demo initialization jobs
# Demo initialization jobs (in Helm hook weight order)
- jobs/demo-seed-rbac.yaml
- jobs/demo-seed-users-job.yaml
- jobs/demo-seed-tenants-job.yaml
- jobs/demo-seed-tenant-members-job.yaml
- jobs/demo-seed-subscriptions-job.yaml
- jobs/demo-seed-inventory-job.yaml
- jobs/demo-seed-recipes-job.yaml
- jobs/demo-seed-suppliers-job.yaml
- jobs/demo-seed-sales-job.yaml
- jobs/demo-seed-ai-models-job.yaml
- jobs/demo-seed-stock-job.yaml
- jobs/demo-seed-quality-templates-job.yaml
- jobs/demo-seed-customers-job.yaml
- jobs/demo-seed-equipment-job.yaml
- jobs/demo-seed-production-batches-job.yaml
- jobs/demo-seed-orders-job.yaml
- jobs/demo-seed-procurement-job.yaml
- jobs/demo-seed-forecasts-job.yaml
# External data initialization job (v2.0)
- jobs/external-data-init-job.yaml