service.j2 697 B

12345678910111213141516171819202122232425262728293031323334
  1. apiVersion: "v1"
  2. kind: "Service"
  3. metadata:
  4. name: "{{obj_name}}"
  5. {% if labels is defined%}
  6. labels:
  7. {% for key, value in labels.iteritems() %}
  8. {{key}}: {{value}}
  9. {% endfor %}
  10. {% endif %}
  11. spec:
  12. ports:
  13. {% for port in ports %}
  14. -
  15. {% for key, value in port.iteritems() %}
  16. {{key}}: {{value}}
  17. {% endfor %}
  18. {% if port.targetPort is undefined %}
  19. clusterIP: "None"
  20. {% endif %}
  21. {% endfor %}
  22. {% if service_targetPort is defined %}
  23. targetPort: {{service_targetPort}}
  24. {% endif %}
  25. selector:
  26. {% for key, value in selector.iteritems() %}
  27. {{key}}: {{value}}
  28. {% endfor %}
  29. {% if externalIPs is defined -%}
  30. externalIPs:
  31. {% for ip in externalIPs %}
  32. - {{ ip }}
  33. {% endfor %}
  34. {% endif %}