Remove interface
This commit is contained in:
parent
ed9a416b01
commit
f2b627486d
13 changed files with 72 additions and 872 deletions
|
|
@ -43,7 +43,7 @@ func main() {
|
|||
}
|
||||
}
|
||||
|
||||
func handleSigterm(ic controller.Interface) {
|
||||
func handleSigterm(ic *controller.GenericController) {
|
||||
signalChan := make(chan os.Signal, 1)
|
||||
signal.Notify(signalChan, syscall.SIGTERM)
|
||||
<-signalChan
|
||||
|
|
|
|||
|
|
@ -240,8 +240,8 @@ func (n NGINXController) OnUpdate(cmap *api.ConfigMap, ingressCfg ingress.Config
|
|||
conf["upstreams"] = ingressCfg.Upstreams
|
||||
conf["passthroughUpstreams"] = ingressCfg.PassthroughUpstreams
|
||||
conf["servers"] = ingressCfg.Servers
|
||||
conf["tcpUpstreams"] = ingressCfg.TCPUpstreams
|
||||
conf["udpUpstreams"] = ingressCfg.UDPUpstreams
|
||||
conf["tcpUpstreams"] = ingressCfg.TCPEndpoints
|
||||
conf["udpUpstreams"] = ingressCfg.UPDEndpoints
|
||||
conf["healthzURL"] = ingressCfg.HealthzURL
|
||||
conf["defResolver"] = cfg.Resolver
|
||||
conf["sslDHParam"] = ""
|
||||
|
|
|
|||
|
|
@ -197,7 +197,7 @@ func buildProxyPass(input interface{}) string {
|
|||
proto = "https"
|
||||
}
|
||||
// defProxyPass returns the default proxy_pass, just the name of the upstream
|
||||
defProxyPass := fmt.Sprintf("proxy_pass %s://%s;", proto, location.Upstream.Name)
|
||||
defProxyPass := fmt.Sprintf("proxy_pass %s://%s;", proto, location.Backend.Name)
|
||||
// if the path in the ingress rule is equals to the target: no special rewrite
|
||||
if path == location.Redirect.Target {
|
||||
return defProxyPass
|
||||
|
|
@ -227,13 +227,13 @@ func buildProxyPass(input interface{}) string {
|
|||
rewrite %s(.*) /$1 break;
|
||||
rewrite %s / break;
|
||||
proxy_pass %s://%s;
|
||||
%v`, path, location.Path, proto, location.Upstream.Name, abu)
|
||||
%v`, path, location.Path, proto, location.Backend.Name, abu)
|
||||
}
|
||||
|
||||
return fmt.Sprintf(`
|
||||
rewrite %s(.*) %s/$1 break;
|
||||
proxy_pass %s://%s;
|
||||
%v`, path, location.Redirect.Target, proto, location.Upstream.Name, abu)
|
||||
%v`, path, location.Redirect.Target, proto, location.Backend.Name, abu)
|
||||
}
|
||||
|
||||
// default proxy_pass
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ func TestBuildProxyPass(t *testing.T) {
|
|||
loc := &ingress.Location{
|
||||
Path: tc.Path,
|
||||
Redirect: rewrite.Redirect{Target: tc.Target, AddBaseURL: tc.AddBaseURL},
|
||||
Upstream: ingress.Upstream{Name: "upstream-name"},
|
||||
Upstream: ingress.Backend{Name: "upstream-name"},
|
||||
}
|
||||
|
||||
pp := buildProxyPass(loc)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue