apiVersion: apps/v1
kind: Deployment
metadata:
  name: agent-gateway
  namespace: agent-platform
spec:
  replicas: 2
  selector:
    matchLabels: {app: agent-gateway}
  template:
    metadata:
      labels: {app: agent-gateway}
    spec:
      containers:
        - name: agent-gateway
          image: agent-gateway:latest
          imagePullPolicy: IfNotPresent
          ports:
            - containerPort: 8010
          envFrom:
            - configMapRef: {name: agent-platform-config}
            - secretRef: {name: agent-platform-secrets}
          volumeMounts:
            - name: backends
              mountPath: /app/config/backends.yaml
              subPath: backends.yaml
          readinessProbe:
            httpGet: {path: /health, port: 8010}
            initialDelaySeconds: 15
            periodSeconds: 10
          livenessProbe:
            httpGet: {path: /health, port: 8010}
            initialDelaySeconds: 30
            periodSeconds: 20
          resources:
            requests: {cpu: "200m", memory: "256Mi"}
            limits: {cpu: "1000m", memory: "768Mi"}
      volumes:
        - name: backends
          configMap: {name: agent-gateway-backends}
---
apiVersion: v1
kind: Service
metadata:
  name: agent-gateway
  namespace: agent-platform
  annotations:
    service.beta.kubernetes.io/oci-load-balancer-shape: "flexible"
    service.beta.kubernetes.io/oci-load-balancer-shape-flex-min: "10"
    service.beta.kubernetes.io/oci-load-balancer-shape-flex-max: "100"
spec:
  type: LoadBalancer
  selector: {app: agent-gateway}
  ports:
    - name: http
      port: 80
      targetPort: 8010
