apiVersion: v1
kind: ServiceAccount
metadata:
  name: chat
  namespace: products
  annotations:
    azure.workload.identity/client-id: ${CHAT_CLIENT_ID}
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: products-chat
  namespace: products
spec:
  replicas: 1
  selector:
    matchLabels: {app: products-chat}
  template:
    metadata:
      labels:
        app: products-chat
        azure.workload.identity/use: "true"
    spec:
      serviceAccountName: chat
      terminationGracePeriodSeconds: 300
      securityContext: {runAsNonRoot: true, runAsUser: 10001, runAsGroup: 10001}
      containers:
        - name: worker
          image: ${ACR_HOST}/products-chat:${IMAGE_TAG}
          envFrom: [{configMapRef: {name: bootstrap}}]
          resources:
            requests: {cpu: 250m, memory: 384Mi}
            limits: {cpu: "1", memory: 768Mi}
          ports: [{name: health, containerPort: 8080}]
          startupProbe:
            httpGet: {path: /health, port: health}
            failureThreshold: 60
            periodSeconds: 5
          readinessProbe:
            httpGet: {path: /health, port: health}
          livenessProbe:
            httpGet: {path: /health, port: health}
          securityContext: {allowPrivilegeEscalation: false, capabilities: {drop: [ALL]}}
