---
apiVersion: v1
kind: Service
metadata:
  name: registry
  namespace: {{ registry_namespace }}
  labels:
    k8s-app: registry
    addonmanager.kubernetes.io/mode: Reconcile
    kubernetes.io/name: "KubeRegistry"
{% if registry_service_annotations %}
  annotations:
    {{ registry_service_annotations | to_nice_yaml(indent=2, width=1337) | indent(width=4) }}
{% endif %}
spec:
  selector:
    k8s-app: registry
  type: {{ registry_service_type }}
{% if registry_service_type == "ClusterIP" and registry_service_cluster_ip != "" %}
  clusterIP: {{ registry_service_cluster_ip }}
{% endif %}
{% if registry_service_type == "LoadBalancer" and registry_service_loadbalancer_ip != "" %}
  loadBalancerIP: {{ registry_service_loadbalancer_ip }}
{% endif %}
  ports:
    - name: registry
      port: {{ registry_port }}
      protocol: TCP
      targetPort: {{ registry_port }}
{% if registry_service_type == "NodePort" and registry_service_nodeport != "" %}
      nodePort: {{ registry_service_nodeport }}
{% endif %}