jupiter and Fiesta are separate applications (separate repos, separate binaries) that happen to share one Postgres instance. The previous fix (661a08d) repointed queue.workolik.com's createorder from jupiter's v1 to jupiter's v3 handler to stop items being silently dropped - that worked because they share a database, but it was never the right target: jupiter has no item-required guard, no atomic order-number allocation, no stock-insufficient check, because none of that was ever written for jupiter. Fiesta's own CreateOrderv3 already has all of it. Added explicit tenant-based routing in worker.py: FIESTA_TENANT_IDS (seeded with 1147/R mart and 1135/Suriya Store, the two confirmed so far) forces createorder for those tenants to FIESTA_BASE_URL instead of jupiter's mapping. Explicit allowlist rather than a DB heuristic, since jupiter and Fiesta share one `tenants` table with no single column that cleanly separates the two populations (checked: tenanttype/moduleid/categoryid/ configid are all inconsistent across the tenants that are known to belong to each app). Non-Fiesta tenants keep going to jupiter's v3 endpoint (661a08d), unaffected. Verified live through the real queue.workolik.com path: - Zero-item order (tenant 1147): worker log shows "Routing tenant 1147 createorder to Fiesta backend", Fiesta correctly returns 400 "Order must contain at least one item", no phantom order created. - Order with items (tenant 1147): itemcount=1, detail_count=1, product 7076 stock ledger moved 25->24, then restored to 25 on cancel. Expand FIESTA_TENANT_IDS as more Fiesta tenants are identified - there's no programmatic way to auto-detect them from the shared tenants table.
581 lines
16 KiB
YAML
581 lines
16 KiB
YAML
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: worker-orders
|
|
namespace: core
|
|
labels:
|
|
app.kubernetes.io/name: worker-orders
|
|
app.kubernetes.io/component: worker
|
|
spec:
|
|
serviceName: "worker-orders"
|
|
replicas: 3
|
|
selector:
|
|
matchLabels:
|
|
app.kubernetes.io/name: worker-orders
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app.kubernetes.io/name: worker-orders
|
|
app.kubernetes.io/component: worker
|
|
annotations:
|
|
prometheus.io/scrape: "true"
|
|
prometheus.io/port: "9090"
|
|
prometheus.io/path: "/metrics"
|
|
spec:
|
|
terminationGracePeriodSeconds: 45
|
|
tolerations:
|
|
- key: dedicated
|
|
operator: Equal
|
|
value: workers
|
|
effect: NoSchedule
|
|
affinity:
|
|
nodeAffinity:
|
|
requiredDuringSchedulingIgnoredDuringExecution:
|
|
nodeSelectorTerms:
|
|
- matchExpressions:
|
|
- key: node-role.workolik/worker
|
|
operator: In
|
|
values:
|
|
- "true"
|
|
podAntiAffinity:
|
|
preferredDuringSchedulingIgnoredDuringExecution:
|
|
- weight: 100
|
|
podAffinityTerm:
|
|
labelSelector:
|
|
matchExpressions:
|
|
- key: app.kubernetes.io/name
|
|
operator: In
|
|
values:
|
|
- worker-orders
|
|
topologyKey: kubernetes.io/hostname
|
|
topologySpreadConstraints:
|
|
- maxSkew: 1
|
|
topologyKey: kubernetes.io/hostname
|
|
whenUnsatisfiable: ScheduleAnyway
|
|
labelSelector:
|
|
matchLabels:
|
|
app.kubernetes.io/name: worker-orders
|
|
containers:
|
|
- name: worker
|
|
image: workolik360/nats-worker:v1.1.0
|
|
imagePullPolicy: IfNotPresent
|
|
securityContext:
|
|
allowPrivilegeEscalation: false
|
|
capabilities:
|
|
drop:
|
|
- ALL
|
|
command: ["python3", "-u", "/scripts/worker.py"]
|
|
volumeMounts:
|
|
- name: worker-script-vol
|
|
mountPath: /scripts
|
|
envFrom:
|
|
- configMapRef:
|
|
name: core-config
|
|
env:
|
|
- name: NATS_STREAM
|
|
value: "ORDERS"
|
|
- name: NATS_CONSUMER
|
|
value: "orders-worker"
|
|
- name: FILTER_SUBJECT
|
|
value: "api.v1.mob.orders.createorder"
|
|
- name: WORKER_CONCURRENCY
|
|
value: "20"
|
|
- name: NATS_USER
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: nats-credentials
|
|
key: username
|
|
- name: NATS_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: nats-credentials
|
|
key: password
|
|
- name: EXTERNAL_ENDPOINT_API_KEY
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: external-endpoint-secrets
|
|
key: api_key
|
|
optional: true
|
|
- name: EXTERNAL_BASE_URL
|
|
value: "http://jupiter.nearle"
|
|
- name: FIESTA_BASE_URL
|
|
value: "http://fiesta.nearle"
|
|
# Known Fiesta tenants (R mart=1147, Suriya Store=1135, confirmed
|
|
# 2026-07-29). Expand as more are identified - see worker.py's
|
|
# FIESTA_TENANT_IDS comment for why this is an explicit list rather
|
|
# than a DB heuristic.
|
|
- name: FIESTA_TENANT_IDS
|
|
value: "1147,1135"
|
|
resources:
|
|
requests:
|
|
memory: "128Mi"
|
|
cpu: "100m"
|
|
limits:
|
|
memory: "256Mi"
|
|
cpu: "500m"
|
|
ports:
|
|
- containerPort: 9090
|
|
name: metrics
|
|
volumes:
|
|
- name: worker-script-vol
|
|
configMap:
|
|
name: worker-script
|
|
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: worker-deliveries
|
|
namespace: core
|
|
labels:
|
|
app.kubernetes.io/name: worker-deliveries
|
|
app.kubernetes.io/component: worker
|
|
spec:
|
|
serviceName: "worker-deliveries"
|
|
replicas: 2
|
|
selector:
|
|
matchLabels:
|
|
app.kubernetes.io/name: worker-deliveries
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app.kubernetes.io/name: worker-deliveries
|
|
app.kubernetes.io/component: worker
|
|
annotations:
|
|
prometheus.io/scrape: "true"
|
|
prometheus.io/port: "9090"
|
|
prometheus.io/path: "/metrics"
|
|
spec:
|
|
terminationGracePeriodSeconds: 45
|
|
tolerations:
|
|
- key: dedicated
|
|
operator: Equal
|
|
value: workers
|
|
effect: NoSchedule
|
|
affinity:
|
|
nodeAffinity:
|
|
requiredDuringSchedulingIgnoredDuringExecution:
|
|
nodeSelectorTerms:
|
|
- matchExpressions:
|
|
- key: node-role.workolik/worker
|
|
operator: In
|
|
values:
|
|
- "true"
|
|
podAntiAffinity:
|
|
preferredDuringSchedulingIgnoredDuringExecution:
|
|
- weight: 100
|
|
podAffinityTerm:
|
|
labelSelector:
|
|
matchExpressions:
|
|
- key: app.kubernetes.io/name
|
|
operator: In
|
|
values:
|
|
- worker-deliveries
|
|
topologyKey: kubernetes.io/hostname
|
|
topologySpreadConstraints:
|
|
- maxSkew: 1
|
|
topologyKey: kubernetes.io/hostname
|
|
whenUnsatisfiable: ScheduleAnyway
|
|
labelSelector:
|
|
matchLabels:
|
|
app.kubernetes.io/name: worker-deliveries
|
|
containers:
|
|
- name: worker
|
|
image: workolik360/nats-worker:v1.1.0
|
|
imagePullPolicy: IfNotPresent
|
|
securityContext:
|
|
allowPrivilegeEscalation: false
|
|
capabilities:
|
|
drop:
|
|
- ALL
|
|
command: ["python3", "-u", "/scripts/worker.py"]
|
|
volumeMounts:
|
|
- name: worker-script-vol
|
|
mountPath: /scripts
|
|
envFrom:
|
|
- configMapRef:
|
|
name: core-config
|
|
env:
|
|
- name: NATS_STREAM
|
|
value: "DELIVERIES"
|
|
- name: NATS_CONSUMER
|
|
value: "deliveries-worker"
|
|
- name: FILTER_SUBJECT
|
|
value: "api.v1.deliveries.createdeliveries,api.v1.deliveries.updatedelivery,api.v2.deliveries.createdeliverylog"
|
|
- name: WORKER_CONCURRENCY
|
|
value: "10"
|
|
- name: NATS_USER
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: nats-credentials
|
|
key: username
|
|
- name: NATS_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: nats-credentials
|
|
key: password
|
|
- name: EXTERNAL_BASE_URL
|
|
value: "http://jupiter.nearle"
|
|
resources:
|
|
requests:
|
|
memory: "128Mi"
|
|
cpu: "80m"
|
|
limits:
|
|
memory: "256Mi"
|
|
cpu: "400m"
|
|
ports:
|
|
- containerPort: 9090
|
|
name: metrics
|
|
volumes:
|
|
- name: worker-script-vol
|
|
configMap:
|
|
name: worker-script
|
|
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: worker-customers
|
|
namespace: core
|
|
labels:
|
|
app.kubernetes.io/name: worker-customers
|
|
app.kubernetes.io/component: worker
|
|
spec:
|
|
serviceName: "worker-customers"
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app.kubernetes.io/name: worker-customers
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app.kubernetes.io/name: worker-customers
|
|
app.kubernetes.io/component: worker
|
|
annotations:
|
|
prometheus.io/scrape: "true"
|
|
prometheus.io/port: "9090"
|
|
prometheus.io/path: "/metrics"
|
|
spec:
|
|
terminationGracePeriodSeconds: 45
|
|
tolerations:
|
|
- key: dedicated
|
|
operator: Equal
|
|
value: workers
|
|
effect: NoSchedule
|
|
affinity:
|
|
nodeAffinity:
|
|
requiredDuringSchedulingIgnoredDuringExecution:
|
|
nodeSelectorTerms:
|
|
- matchExpressions:
|
|
- key: node-role.workolik/worker
|
|
operator: In
|
|
values:
|
|
- "true"
|
|
podAntiAffinity:
|
|
preferredDuringSchedulingIgnoredDuringExecution:
|
|
- weight: 100
|
|
podAffinityTerm:
|
|
labelSelector:
|
|
matchExpressions:
|
|
- key: app.kubernetes.io/name
|
|
operator: In
|
|
values:
|
|
- worker-customers
|
|
topologyKey: kubernetes.io/hostname
|
|
topologySpreadConstraints:
|
|
- maxSkew: 1
|
|
topologyKey: kubernetes.io/hostname
|
|
whenUnsatisfiable: ScheduleAnyway
|
|
labelSelector:
|
|
matchLabels:
|
|
app.kubernetes.io/name: worker-customers
|
|
containers:
|
|
- name: worker
|
|
image: workolik360/nats-worker:v1.1.0
|
|
imagePullPolicy: IfNotPresent
|
|
securityContext:
|
|
allowPrivilegeEscalation: false
|
|
capabilities:
|
|
drop:
|
|
- ALL
|
|
command: ["python3", "-u", "/scripts/worker.py"]
|
|
volumeMounts:
|
|
- name: worker-script-vol
|
|
mountPath: /scripts
|
|
envFrom:
|
|
- configMapRef:
|
|
name: core-config
|
|
env:
|
|
- name: NATS_STREAM
|
|
value: "CUSTOMERS"
|
|
- name: NATS_CONSUMER
|
|
value: "customers-worker"
|
|
- name: FILTER_SUBJECT
|
|
value: "api.v1.mob.customers.login,api.v1.mob.customers.create"
|
|
- name: WORKER_CONCURRENCY
|
|
value: "30"
|
|
- name: NATS_USER
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: nats-credentials
|
|
key: username
|
|
- name: NATS_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: nats-credentials
|
|
key: password
|
|
- name: EXTERNAL_ENDPOINT_API_KEY
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: external-endpoint-secrets
|
|
key: api_key
|
|
optional: true
|
|
- name: EXTERNAL_BASE_URL
|
|
value: "http://jupiter.nearle"
|
|
resources:
|
|
requests:
|
|
memory: "128Mi"
|
|
cpu: "60m"
|
|
limits:
|
|
memory: "256Mi"
|
|
cpu: "300m"
|
|
ports:
|
|
- containerPort: 9090
|
|
name: metrics
|
|
volumes:
|
|
- name: worker-script-vol
|
|
configMap:
|
|
name: worker-script
|
|
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: worker-rider-logs
|
|
namespace: core
|
|
labels:
|
|
app.kubernetes.io/name: worker-rider-logs
|
|
app.kubernetes.io/component: worker
|
|
spec:
|
|
serviceName: "worker-rider-logs"
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app.kubernetes.io/name: worker-rider-logs
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app.kubernetes.io/name: worker-rider-logs
|
|
app.kubernetes.io/component: worker
|
|
annotations:
|
|
prometheus.io/scrape: "true"
|
|
prometheus.io/port: "9090"
|
|
prometheus.io/path: "/metrics"
|
|
spec:
|
|
terminationGracePeriodSeconds: 45
|
|
tolerations:
|
|
- key: dedicated
|
|
operator: Equal
|
|
value: workers
|
|
effect: NoSchedule
|
|
affinity:
|
|
nodeAffinity:
|
|
requiredDuringSchedulingIgnoredDuringExecution:
|
|
nodeSelectorTerms:
|
|
- matchExpressions:
|
|
- key: node-role.workolik/worker
|
|
operator: In
|
|
values:
|
|
- "true"
|
|
podAntiAffinity:
|
|
preferredDuringSchedulingIgnoredDuringExecution:
|
|
- weight: 100
|
|
podAffinityTerm:
|
|
labelSelector:
|
|
matchExpressions:
|
|
- key: app.kubernetes.io/name
|
|
operator: In
|
|
values:
|
|
- worker-rider-logs
|
|
topologyKey: kubernetes.io/hostname
|
|
topologySpreadConstraints:
|
|
- maxSkew: 1
|
|
topologyKey: kubernetes.io/hostname
|
|
whenUnsatisfiable: ScheduleAnyway
|
|
labelSelector:
|
|
matchLabels:
|
|
app.kubernetes.io/name: worker-rider-logs
|
|
containers:
|
|
- name: worker
|
|
image: workolik360/nats-worker:v1.1.0
|
|
imagePullPolicy: IfNotPresent
|
|
securityContext:
|
|
allowPrivilegeEscalation: false
|
|
capabilities:
|
|
drop:
|
|
- ALL
|
|
command: ["python3", "-u", "/scripts/worker.py"]
|
|
volumeMounts:
|
|
- name: worker-script-vol
|
|
mountPath: /scripts
|
|
envFrom:
|
|
- configMapRef:
|
|
name: core-config
|
|
env:
|
|
- name: NATS_STREAM
|
|
value: "RIDER"
|
|
- name: NATS_CONSUMER
|
|
value: "rider-logs-worker"
|
|
- name: FILTER_SUBJECT
|
|
value: "api.v2.partners.createriderlog,api.v2.partners.createbreaklog,api.v2.partners.updatebreaklog"
|
|
- name: WORKER_CONCURRENCY
|
|
value: "10"
|
|
- name: NATS_USER
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: nats-credentials
|
|
key: username
|
|
- name: NATS_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: nats-credentials
|
|
key: password
|
|
- name: EXTERNAL_ENDPOINT_API_KEY
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: external-endpoint-secrets
|
|
key: api_key
|
|
optional: true
|
|
- name: EXTERNAL_BASE_URL
|
|
value: "http://jupiter.nearle"
|
|
resources:
|
|
requests:
|
|
memory: "128Mi"
|
|
cpu: "40m"
|
|
limits:
|
|
memory: "128Mi"
|
|
cpu: "200m"
|
|
ports:
|
|
- containerPort: 9090
|
|
name: metrics
|
|
volumes:
|
|
- name: worker-script-vol
|
|
configMap:
|
|
name: worker-script
|
|
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: worker-products
|
|
namespace: core
|
|
labels:
|
|
app.kubernetes.io/name: worker-products
|
|
app.kubernetes.io/component: worker
|
|
spec:
|
|
serviceName: "worker-products"
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app.kubernetes.io/name: worker-products
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app.kubernetes.io/name: worker-products
|
|
app.kubernetes.io/component: worker
|
|
annotations:
|
|
prometheus.io/scrape: "true"
|
|
prometheus.io/port: "9090"
|
|
prometheus.io/path: "/metrics"
|
|
spec:
|
|
terminationGracePeriodSeconds: 45
|
|
tolerations:
|
|
- key: dedicated
|
|
operator: Equal
|
|
value: workers
|
|
effect: NoSchedule
|
|
affinity:
|
|
nodeAffinity:
|
|
requiredDuringSchedulingIgnoredDuringExecution:
|
|
nodeSelectorTerms:
|
|
- matchExpressions:
|
|
- key: node-role.workolik/worker
|
|
operator: In
|
|
values:
|
|
- "true"
|
|
podAntiAffinity:
|
|
preferredDuringSchedulingIgnoredDuringExecution:
|
|
- weight: 100
|
|
podAffinityTerm:
|
|
labelSelector:
|
|
matchExpressions:
|
|
- key: app.kubernetes.io/name
|
|
operator: In
|
|
values:
|
|
- worker-products
|
|
topologyKey: kubernetes.io/hostname
|
|
topologySpreadConstraints:
|
|
- maxSkew: 1
|
|
topologyKey: kubernetes.io/hostname
|
|
whenUnsatisfiable: ScheduleAnyway
|
|
labelSelector:
|
|
matchLabels:
|
|
app.kubernetes.io/name: worker-products
|
|
containers:
|
|
- name: worker
|
|
image: workolik360/nats-worker:v1.1.0
|
|
imagePullPolicy: IfNotPresent
|
|
securityContext:
|
|
allowPrivilegeEscalation: false
|
|
capabilities:
|
|
drop:
|
|
- ALL
|
|
command: ["python3", "-u", "/scripts/worker.py"]
|
|
volumeMounts:
|
|
- name: worker-script-vol
|
|
mountPath: /scripts
|
|
envFrom:
|
|
- configMapRef:
|
|
name: core-config
|
|
env:
|
|
- name: NATS_STREAM
|
|
value: "PRODUCTS"
|
|
- name: NATS_CONSUMER
|
|
value: "products-worker"
|
|
- name: FILTER_SUBJECT
|
|
value: "api.v1.web.products.create"
|
|
- name: WORKER_CONCURRENCY
|
|
value: "5"
|
|
- name: NATS_USER
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: nats-credentials
|
|
key: username
|
|
- name: NATS_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: nats-credentials
|
|
key: password
|
|
- name: EXTERNAL_ENDPOINT_API_KEY
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: external-endpoint-secrets
|
|
key: api_key
|
|
optional: true
|
|
- name: EXTERNAL_BASE_URL
|
|
value: "http://jupiter.nearle"
|
|
resources:
|
|
requests:
|
|
memory: "128Mi"
|
|
cpu: "40m"
|
|
limits:
|
|
memory: "256Mi"
|
|
cpu: "200m"
|
|
ports:
|
|
- containerPort: 9090
|
|
name: metrics
|
|
volumes:
|
|
- name: worker-script-vol
|
|
configMap:
|
|
name: worker-script
|