apiVersion: apps/v1
kind: Deployment
metadata: {name: cedp-api}
spec:
  replicas: 3
  selector: {matchLabels: {app: cedp-api}}
  template:
    metadata: {labels: {app: cedp-api}}
    spec:
      containers:
      - name: api
        image: chemitec/cedp:0.14.0
        ports: [{containerPort: 8080}]
        envFrom: [{secretRef: {name: cedp-secrets}}, {configMapRef: {name: cedp-config}}]
        readinessProbe: {httpGet: {path: /health, port: 8080}, initialDelaySeconds: 10, periodSeconds: 5}
        livenessProbe: {httpGet: {path: /health, port: 8080}, initialDelaySeconds: 30, periodSeconds: 10}
        resources: {requests: {cpu: 250m, memory: 512Mi}, limits: {cpu: "2", memory: 2Gi}}
---
apiVersion: v1
kind: Service
metadata: {name: cedp-api}
spec: {selector: {app: cedp-api}, ports: [{port: 8080, targetPort: 8080}]}
---
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata: {name: cedp-api-pdb}
spec: {minAvailable: 2, selector: {matchLabels: {app: cedp-api}}}
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata: {name: cedp-api}
spec:
  scaleTargetRef: {apiVersion: apps/v1, kind: Deployment, name: cedp-api}
  minReplicas: 3
  maxReplicas: 10
  metrics:
  - type: Resource
    resource: {name: cpu, target: {type: Utilization, averageUtilization: 70}}
