diff --git a/inventory/sample/group_vars/k8s_cluster/addons.yml b/inventory/sample/group_vars/k8s_cluster/addons.yml index f3afed3243d..b436ca08034 100644 --- a/inventory/sample/group_vars/k8s_cluster/addons.yml +++ b/inventory/sample/group_vars/k8s_cluster/addons.yml @@ -104,6 +104,8 @@ gateway_api_enabled: false ingress_nginx_enabled: false # ingress_nginx_host_network: false # ingress_nginx_service_type: LoadBalancer +# ingress_nginx_service_annotations: +# example.io/loadbalancerIPs: 1.2.3.4 # ingress_nginx_service_nodeport_http: 30080 # ingress_nginx_service_nodeport_https: 30081 ingress_publish_status_address: "" diff --git a/roles/kubernetes-apps/ingress_controller/ingress_nginx/defaults/main.yml b/roles/kubernetes-apps/ingress_controller/ingress_nginx/defaults/main.yml index 82943024b44..9d7a4c402d3 100644 --- a/roles/kubernetes-apps/ingress_controller/ingress_nginx/defaults/main.yml +++ b/roles/kubernetes-apps/ingress_controller/ingress_nginx/defaults/main.yml @@ -4,6 +4,7 @@ ingress_nginx_host_network: false ingress_nginx_service_type: LoadBalancer ingress_nginx_service_nodeport_http: "" ingress_nginx_service_nodeport_https: "" +ingress_nginx_service_annotations: {} ingress_publish_status_address: "" ingress_nginx_nodeselector: kubernetes.io/os: "linux" diff --git a/roles/kubernetes-apps/ingress_controller/ingress_nginx/templates/svc-ingress-nginx.yml.j2 b/roles/kubernetes-apps/ingress_controller/ingress_nginx/templates/svc-ingress-nginx.yml.j2 index 072b9892b4b..ba51ffe94e7 100644 --- a/roles/kubernetes-apps/ingress_controller/ingress_nginx/templates/svc-ingress-nginx.yml.j2 +++ b/roles/kubernetes-apps/ingress_controller/ingress_nginx/templates/svc-ingress-nginx.yml.j2 @@ -7,6 +7,10 @@ metadata: labels: app.kubernetes.io/name: ingress-nginx app.kubernetes.io/part-of: ingress-nginx +{% if ingress_nginx_service_annotations %} + annotations: + {{ ingress_nginx_service_annotations | to_nice_yaml(indent=2, width=1337) | indent(width=4) }} +{% endif %} spec: type: {{ ingress_nginx_service_type }} ports: