{% set autoscaling_config = dict(iter_autoscaling_config().items(), **POD_AUTOSCALING_EXTRA_SERVICES) %}
{% for service, autoscaling in autoscaling_config.items() if autoscaling.get("enable_hpa") %}
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ service }}
spec:
  template:
    spec:
      containers:
        - name: {{ service }}
          resources:
            requests:
              memory: {{ autoscaling["memory_request"] }}
              {%- if autoscaling["cpu_request"] > 0 %}
              cpu: {{ autoscaling["cpu_request"] }}
              {%- endif %}
            limits:
              memory: {{ autoscaling["memory_limit"] }}
              {%- if autoscaling["cpu_limit"] > 0 %}
              cpu: {{ autoscaling["cpu_limit"] }}
              {%- endif %}
{% endfor %}
