c12s-kubespray/roles/kubernetes-apps/registry/templates/registry-svc.yml.j2
zhengtianbao aa9b8453a0
registry: service add clusterIP, nodePort, loadBalancer support (#8291)
* registry: service add clusterIP, nodePort, loadBalancer support

* modify camelcase name to underscore

* Add registry service type compatibility check
2021-12-15 00:18:19 -08:00

32 lines
1,016 B
Django/Jinja

---
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 %}