Build sales-api REST + MCP layers (Layer 3), full build in one pass

14 routes: Order (single key, full CRUD + order-details sub-resource)
and Orderdetail (composite key ordernumber+productcode, own
top-level resource, mirrors backend's own URL structure). MCP layer
built with the corrected single-route pattern from the start
(STATUS.md section 18) — 7 tools, list/get read-only for all 5
roles, create-order/create-orderdetail for admin+customer+support
(verified against OrderPermission/OrderScopedPermission.check() —
support gets an unconditional class-level pass, the status-only
restriction is object-level and doesn't apply to create).

Keycloak (local): sales-api-audience + mcp-sales-audience client
scopes, sales-api + mcp-sales resource clients, attached to the
broker and librechat respectively. Deploy key and broker secret
reused/mirrored from catalog-api and the live broker client, same
pattern as customers-api/payments-api.
This commit is contained in:
Stéphane Tailland
2026-08-23 17:02:17 +02:00
parent 88b2136903
commit de69f88e29
28 changed files with 1481 additions and 11 deletions
+25
View File
@@ -0,0 +1,25 @@
apiVersion: external-secrets.io/v1
kind: ExternalSecret
metadata:
name: sales-api-git-auth
namespace: sales
spec:
refreshInterval: 1h
secretStoreRef:
kind: ClusterSecretStore
name: vault-kong-v2
target:
name: sales-api-git-auth
data:
- secretKey: identity
remoteRef:
key: kong-v2/sales-api/git-deploy-key
property: identity
- secretKey: identity.pub
remoteRef:
key: kong-v2/sales-api/git-deploy-key
property: identity.pub
- secretKey: known_hosts
remoteRef:
key: kong-v2/sales-api/git-deploy-key
property: known_hosts
+32
View File
@@ -0,0 +1,32 @@
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: sales-dev-api
namespace: sales
spec:
interval: 10m
sourceRef:
kind: GitRepository
name: sales-api-dev
path: ./kong
prune: true
dependsOn:
- name: sales-dev-api-gateway
namespace: flux-system
postBuild:
substitute:
NAME: sales-dev
NAMESPACE: sales
CONTROL_PLANE_REF_NAME: sales-dev-pjdc7
BACKEND_HOST: classic-models-api.classic-models.svc.cluster.local
OIDC_ISSUER: https://keycloak.sttlab.local/realms/classic-models
API_AUDIENCE: '["sales-api"]'
BACKEND_AUDIENCE: '["classic-models-api"]'
BACKEND_SCOPES: '[]'
API_RATE_LIMIT_MINUTE: "60"
AUDIT_LOG_ENDPOINT: http://audit-log-collector.observability.svc.cluster.local/logs
REST_HOSTNAME: sales-dev.sttlab.local
TOKEN_EXCHANGE_CLIENT_ID: kong-token-exchange-broker
substituteFrom:
- kind: Secret
name: sales-token-exchange-broker
+12
View File
@@ -0,0 +1,12 @@
apiVersion: source.toolkit.fluxcd.io/v1
kind: GitRepository
metadata:
name: sales-api-dev
namespace: sales
spec:
interval: 5m
url: ssh://git@gitea.sttlab.eu:2222/stt/kong-sales-api.git
secretRef:
name: sales-api-git-auth
ref:
branch: main
@@ -0,0 +1,17 @@
apiVersion: external-secrets.io/v1
kind: ExternalSecret
metadata:
name: sales-token-exchange-broker
namespace: sales
spec:
refreshInterval: 1h
secretStoreRef:
kind: ClusterSecretStore
name: vault-kong-v2
target:
name: sales-token-exchange-broker
data:
- secretKey: TOKEN_EXCHANGE_CLIENT_SECRET
remoteRef:
key: kong-v2/sales-api/token-exchange-broker
property: client_secret