Add support for grpc_set_header
This commit is contained in:
parent
7ef8a0a775
commit
ff3e182350
13 changed files with 248 additions and 46 deletions
|
|
@ -426,7 +426,6 @@ func (n *NGINXController) getBackendServers(ingresses []*extensions.Ingress) ([]
|
|||
glog.V(3).Infof("replacing ingress rule %v/%v location %v upstream %v (%v)", ing.Namespace, ing.Name, loc.Path, ups.Name, loc.Backend)
|
||||
loc.Backend = ups.Name
|
||||
loc.IsDefBackend = false
|
||||
loc.Backend = ups.Name
|
||||
loc.Port = ups.Port
|
||||
loc.Service = ups.Service
|
||||
loc.Ingress = ing
|
||||
|
|
@ -521,7 +520,6 @@ func (n *NGINXController) getBackendServers(ingresses []*extensions.Ingress) ([]
|
|||
if upstream.Name == location.Backend {
|
||||
if len(upstream.Endpoints) == 0 {
|
||||
glog.V(3).Infof("upstream %v does not have any active endpoints.", upstream.Name)
|
||||
location.Backend = ""
|
||||
|
||||
// check if the location contains endpoints and a custom default backend
|
||||
if location.DefaultBackend != nil {
|
||||
|
|
|
|||
|
|
@ -152,6 +152,7 @@ var (
|
|||
"buildAuthSignURL": buildAuthSignURL,
|
||||
"buildOpentracingLoad": buildOpentracingLoad,
|
||||
"buildOpentracing": buildOpentracing,
|
||||
"proxySetHeader": proxySetHeader,
|
||||
}
|
||||
)
|
||||
|
||||
|
|
@ -895,3 +896,17 @@ func buildOpentracing(input interface{}) string {
|
|||
buf.WriteString("\r\n")
|
||||
return buf.String()
|
||||
}
|
||||
|
||||
func proxySetHeader(loc interface{}) string {
|
||||
location, ok := loc.(*ingress.Location)
|
||||
if !ok {
|
||||
glog.Errorf("expected a '*ingress.Location' type but %T was returned", loc)
|
||||
return "proxy_set_header"
|
||||
}
|
||||
|
||||
if location.GRPC {
|
||||
return "grpc_set_header"
|
||||
}
|
||||
|
||||
return "proxy_set_header"
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue