Fix a bug with Canary becoming main server

This commit is contained in:
Maxime Ginters 2018-12-05 09:39:19 -05:00
parent cc2b54472a
commit af460f7e15
4 changed files with 449 additions and 28 deletions

View file

@ -940,8 +940,13 @@ func (n *NGINXController) createServers(data []*ingress.Ingress,
// default upstream name
un := du.Name
if anns.Canary.Enabled {
klog.V(2).Infof("Ingress %v is marked as Canary, ignoring", ingKey)
continue
}
if ing.Spec.Backend != nil {
defUpstream := fmt.Sprintf("%v-%v-%v", ing.Namespace, ing.Spec.Backend.ServiceName, ing.Spec.Backend.ServicePort.String())
defUpstream := upstreamName(ing.Namespace, ing.Spec.Backend.ServiceName, ing.Spec.Backend.ServicePort)
if backendUpstream, ok := upstreams[defUpstream]; ok {
// use backend specified in Ingress as the default backend for all its rules
@ -1016,6 +1021,11 @@ func (n *NGINXController) createServers(data []*ingress.Ingress,
ingKey := k8s.MetaNamespaceKey(ing)
anns := ing.ParsedAnnotations
if anns.Canary.Enabled {
klog.V(2).Infof("Ingress %v is marked as Canary, ignoring", ingKey)
continue
}
for _, rule := range ing.Spec.Rules {
host := rule.Host
if host == "" {