[ingress-nginx] expose custom tcp and udp ports in ingress-nginx-controller (#11850)

This commit is contained in:
Christian Kröger
2025-01-15 14:14:33 +01:00
committed by GitHub
parent 5ca23e3bfe
commit 403a73ac11
2 changed files with 36 additions and 0 deletions

View File

@@ -125,6 +125,26 @@ spec:
{% if not ingress_nginx_host_network %}
hostPort: {{ ingress_nginx_metrics_port }}
{% endif %}
{% if ingress_nginx_configmap_tcp_services %}
{% for port in ingress_nginx_configmap_tcp_services.keys() %}
- name: tcp-port-{{ port }}
containerPort: "{{ port | int }}"
protocol: TCP
{% if not ingress_nginx_host_network %}
hostPort: "{{ port | int }}"
{% endif %}
{% endfor %}
{% endif %}
{% if ingress_nginx_configmap_udp_services %}
{% for port in ingress_nginx_configmap_udp_services.keys() %}
- name: udp-port-{{ port }}
containerPort: "{{ port | int }}"
protocol: UDP
{% if not ingress_nginx_host_network %}
hostPort: "{{ port | int }}"
{% endif %}
{% endfor %}
{% endif %}
{% if ingress_nginx_webhook_enabled %}
- name: webhook
containerPort: 8443

View File

@@ -27,6 +27,22 @@ spec:
protocol: TCP
{% if (ingress_nginx_service_type == 'NodePort' or ingress_nginx_service_type == 'LoadBalancer') and ingress_nginx_service_nodeport_https %}
nodePort: {{ingress_nginx_service_nodeport_https | int}}
{% endif %}
{% if ingress_nginx_configmap_tcp_services %}
{% for port in ingress_nginx_configmap_tcp_services.keys() %}
- name: tcp-port-{{ port }}
port: "{{ port | int }}"
targetPort: "{{ port | int }}"
protocol: TCP
{% endfor %}
{% endif %}
{% if ingress_nginx_configmap_udp_services %}
{% for port in ingress_nginx_configmap_udp_services.keys() %}
- name: udp-port-{{ port }}
port: "{{ port | int }}"
targetPort: "{{ port | int }}"
protocol: UDP
{% endfor %}
{% endif %}
selector:
app.kubernetes.io/name: ingress-nginx