diff --git a/controllers/nginx/rootfs/etc/nginx/template/nginx.tmpl b/controllers/nginx/rootfs/etc/nginx/template/nginx.tmpl index e51aedd36..c06554890 100644 --- a/controllers/nginx/rootfs/etc/nginx/template/nginx.tmpl +++ b/controllers/nginx/rootfs/etc/nginx/template/nginx.tmpl @@ -781,10 +781,15 @@ stream { proxy_set_header Accept-Encoding ""; {{ end }} - {{ if (and $all.Cfg.EnableVtsStatus $location.Service) }} + {{ if $all.Cfg.EnableVtsStatus }} + {{ if $location.Service }} vhost_traffic_status_filter_by_set_key {{ $location.Service.ObjectMeta.Namespace }} kubernetes::namespace; vhost_traffic_status_filter_by_set_key {{ $location.Service.ObjectMeta.Namespace }}.{{ $location.Service.ObjectMeta.Name }} kubernetes::service; {{ end }} + {{ if $location.Ingress }} + vhost_traffic_status_filter_by_set_key {{ $location.Ingress.ObjectMeta.Namespace }}.{{ $location.Ingress.ObjectMeta.Name }} kubernetes::ingress; + {{ end }} + {{ end }} {{/* Add any additional configuration defined */}} {{ $location.ConfigurationSnippet }} diff --git a/core/pkg/ingress/controller/controller.go b/core/pkg/ingress/controller/controller.go index 37df71a03..666b62f88 100644 --- a/core/pkg/ingress/controller/controller.go +++ b/core/pkg/ingress/controller/controller.go @@ -979,6 +979,7 @@ func (ic *GenericController) createServers(data []*extensions.Ingress, Backend: un, Proxy: ngxProxy, Service: &apiv1.Service{}, + Ingress: ing, }, }, SSLPassthrough: sslpt,