Merge pull request #1247 from aledbf/add-metadata
Make Ingress annotations available in template
This commit is contained in:
commit
80ff5e6ce8
2 changed files with 8 additions and 5 deletions
|
@ -592,9 +592,10 @@ func isValidClientBodyBufferSize(input interface{}) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
type ingressInformation struct {
|
type ingressInformation struct {
|
||||||
Namespace string
|
Namespace string
|
||||||
Rule string
|
Rule string
|
||||||
Service string
|
Service string
|
||||||
|
Annotations map[string]string
|
||||||
}
|
}
|
||||||
|
|
||||||
func getIngressInformation(i, p interface{}) *ingressInformation {
|
func getIngressInformation(i, p interface{}) *ingressInformation {
|
||||||
|
@ -616,8 +617,9 @@ func getIngressInformation(i, p interface{}) *ingressInformation {
|
||||||
}
|
}
|
||||||
|
|
||||||
info := &ingressInformation{
|
info := &ingressInformation{
|
||||||
Namespace: ing.GetNamespace(),
|
Namespace: ing.GetNamespace(),
|
||||||
Rule: ing.GetName(),
|
Rule: ing.GetName(),
|
||||||
|
Annotations: ing.Annotations,
|
||||||
}
|
}
|
||||||
|
|
||||||
if ing.Spec.Backend != nil {
|
if ing.Spec.Backend != nil {
|
||||||
|
|
|
@ -668,6 +668,7 @@ stream {
|
||||||
set $proxy_upstream_name "{{ buildUpstreamName $server.Hostname $all.Backends $location }}";
|
set $proxy_upstream_name "{{ buildUpstreamName $server.Hostname $all.Backends $location }}";
|
||||||
|
|
||||||
{{ $ing := (getIngressInformation $location.Ingress $path) }}
|
{{ $ing := (getIngressInformation $location.Ingress $path) }}
|
||||||
|
{{/* $ing.Metadata contains the Ingress metadata */}}
|
||||||
set $namespace "{{ $ing.Namespace }}";
|
set $namespace "{{ $ing.Namespace }}";
|
||||||
set $ingress_name "{{ $ing.Rule }}";
|
set $ingress_name "{{ $ing.Rule }}";
|
||||||
set $service_name "{{ $ing.Service }}";
|
set $service_name "{{ $ing.Service }}";
|
||||||
|
|
Loading…
Reference in a new issue