| {% from "kubernetes/map.jinja" import control with context %} |
| apiVersion: v1 |
| kind: Service |
| metadata: |
| labels: |
| name: {{ service.service }}-{{ service.role }} |
| app: {{ service.service }}-{{ service.role }} |
| name: {{ service.service }}-{{ service.role }} |
| namespace: {{ service.namespace }} |
| spec: |
| ports: |
| {%- for port in service.ports %} |
| - port: {{ port.port }} |
| name: {{ port.name }} |
| {%- endfor %} |
| type: {{ service.type }} |
| selector: |
| app: {{ service.service }}-{{ service.role }} |
| {%- if service.cluster_ip is defined %} |
| clusterIP: {{ service.cluster_ip }} |
| {%- endif %} |
| {%- if service.external_ip is defined %} |
| externalIPs: |
| - "{{ service.external_ip }}" |
| {%- endif -%} |