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 %}
spec:
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
protocol: TCP
targetPort: 8052
@@ -39,18 +46,14 @@ spec:
protocol: TCP
targetPort: 8052
name: http
{% elif service_type | lower == "nodeport" %}
- port: {{ nodeport_port }}
protocol: TCP
targetPort: 8052
name: http
type: NodePort
{% endif %}
selector:
app.kubernetes.io/name: '{{ ansible_operator_meta.name }}'
app.kubernetes.io/managed-by: '{{ deployment_type }}-operator'
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
{% else %}
type: ClusterIP