apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
  name: snauw-counter-pdb
  namespace: snauw-counter
  labels:
    app.kubernetes.io/name: snauw-counter
    app.kubernetes.io/component: web
    app.kubernetes.io/part-of: snauw-counter
spec:
  minAvailable: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: snauw-counter
      app.kubernetes.io/component: web

---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
  name: snauw-counter-hpa
  namespace: snauw-counter
  labels:
    app.kubernetes.io/name: snauw-counter
    app.kubernetes.io/component: web
    app.kubernetes.io/part-of: snauw-counter
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: snauw-counter
  minReplicas: 2
  maxReplicas: 10
  metrics:
  - type: Resource
    resource:
      name: cpu
      target:
        type: Utilization
        averageUtilization: 70
  - type: Resource
    resource:
      name: memory
      target:
        type: Utilization
        averageUtilization: 80
  behavior:
    scaleDown:
      stabilizationWindowSeconds: 300
      policies:
      - type: Percent
        value: 50
        periodSeconds: 60
    scaleUp:
      stabilizationWindowSeconds: 60
      policies:
      - type: Percent
        value: 100
        periodSeconds: 60
