fix: fix corrupted spec for the service with nodeport type (#814)

This commit is contained in:
kurokobo
2022-03-09 21:00:24 +09:00
parent 5375fec77d
commit dbaf64efa0

View File

@@ -17,7 +17,14 @@ metadata:
{% endif %} {% endif %}
spec: spec:
ports: ports:
{% if service_type | lower != 'loadbalancer' and loadbalancer_protocol | lower != 'https' %}
{% if service_type | lower == "nodeport" %}
- port: 80
protocol: TCP
targetPort: 8052
name: http
nodePort: {{ nodeport_port }}
{% elif service_type | lower != 'loadbalancer' and loadbalancer_protocol | lower != 'https' %}
- port: 80 - port: 80
protocol: TCP protocol: TCP
targetPort: 8052 targetPort: 8052
@@ -39,18 +46,14 @@ spec:
protocol: TCP protocol: TCP
targetPort: 8052 targetPort: 8052
name: http name: http
{% elif service_type | lower == "nodeport" %}
- port: {{ nodeport_port }}
protocol: TCP
targetPort: 8052
name: http
type: NodePort
{% endif %} {% endif %}
selector: selector:
app.kubernetes.io/name: '{{ ansible_operator_meta.name }}' app.kubernetes.io/name: '{{ ansible_operator_meta.name }}'
app.kubernetes.io/managed-by: '{{ deployment_type }}-operator' app.kubernetes.io/managed-by: '{{ deployment_type }}-operator'
app.kubernetes.io/component: '{{ deployment_type }}' app.kubernetes.io/component: '{{ deployment_type }}'
{% if service_type | lower == "loadbalancer" %} {% if service_type | lower == "nodeport" %}
type: NodePort
{% elif service_type | lower == "loadbalancer" %}
type: LoadBalancer type: LoadBalancer
{% else %} {% else %}
type: ClusterIP type: ClusterIP