Collect nginx metrics keyed by Ingress too

Store the ingress resource that created a particular location so that we
can then aggregate nginx metrics based on the ingress name too.
This commit is contained in:
Tom Booth 2017-08-23 18:11:35 +01:00
parent 5159e0c0f7
commit 20b64eb069
2 changed files with 7 additions and 1 deletions

View file

@ -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 }}

View file

@ -979,6 +979,7 @@ func (ic *GenericController) createServers(data []*extensions.Ingress,
Backend: un,
Proxy: ngxProxy,
Service: &apiv1.Service{},
Ingress: ing,
},
},
SSLPassthrough: sslpt,