Add stream-snippet as a ConfigMap and Annotation option (#8029)
* stream snippet * gofmt -s
This commit is contained in:
parent
cf6ea08739
commit
ce9deaa332
12 changed files with 386 additions and 4 deletions
|
|
@ -538,6 +538,7 @@ func (n *NGINXController) getConfiguration(ingresses []*ingress.Ingress) (sets.S
|
|||
PassthroughBackends: passUpstreams,
|
||||
BackendConfigChecksum: n.store.GetBackendConfiguration().Checksum,
|
||||
DefaultSSLCertificate: n.getDefaultSSLCertificate(),
|
||||
StreamSnippets: n.getStreamSnippets(ingresses),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -562,6 +563,11 @@ func dropSnippetDirectives(anns *annotations.Ingress, ingKey string) {
|
|||
anns.ExternalAuth.AuthSnippet = ""
|
||||
}
|
||||
|
||||
if anns.StreamSnippet != "" {
|
||||
klog.V(3).Infof("Ingress %q tried to use stream-snippet and the annotation is disabled by the admin. Removing the annotation", ingKey)
|
||||
anns.StreamSnippet = ""
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1779,3 +1785,14 @@ func ingressForHostPath(hostname, path string, servers []*ingress.Server) []*net
|
|||
|
||||
return ingresses
|
||||
}
|
||||
|
||||
func (n *NGINXController) getStreamSnippets(ingresses []*ingress.Ingress) []string {
|
||||
snippets := make([]string, 0, len(ingresses))
|
||||
for _, i := range ingresses {
|
||||
if i.ParsedAnnotations.StreamSnippet == "" {
|
||||
continue
|
||||
}
|
||||
snippets = append(snippets, i.ParsedAnnotations.StreamSnippet)
|
||||
}
|
||||
return snippets
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue