Merge addcc4639f
into bf5831615b
This commit is contained in:
commit
bfe170ef5e
4 changed files with 19 additions and 0 deletions
|
@ -35,6 +35,7 @@ import (
|
|||
|
||||
proxyproto "github.com/armon/go-proxyproto"
|
||||
api_v1 "k8s.io/client-go/pkg/api/v1"
|
||||
extensions "k8s.io/client-go/pkg/apis/extensions/v1beta1"
|
||||
|
||||
"k8s.io/ingress/controllers/nginx/pkg/config"
|
||||
ngx_template "k8s.io/ingress/controllers/nginx/pkg/template"
|
||||
|
@ -296,6 +297,11 @@ func (n NGINXController) Info() *ingress.BackendInfo {
|
|||
func (n *NGINXController) ConfigureFlags(flags *pflag.FlagSet) {
|
||||
}
|
||||
|
||||
// UpdateIngressStatus custom Ingress status update
|
||||
func (n *NGINXController) UpdateIngressStatus(*extensions.Ingress) []api_v1.LoadBalancerIngress {
|
||||
return nil
|
||||
}
|
||||
|
||||
// OverrideFlags customize NGINX controller flags
|
||||
func (n *NGINXController) OverrideFlags(flags *pflag.FlagSet) {
|
||||
ic, _ := flags.GetString("ingress-class")
|
||||
|
|
|
@ -315,6 +315,7 @@ func newIngressController(config *Configuration) *GenericController {
|
|||
IngressClass: config.IngressClass,
|
||||
DefaultIngressClass: config.DefaultIngressClass,
|
||||
UpdateStatusOnShutdown: config.UpdateStatusOnShutdown,
|
||||
CustomIngressStatus: ic.cfg.Backend.UpdateIngressStatus,
|
||||
})
|
||||
} else {
|
||||
glog.Warning("Update of ingress status is disabled (flag --update-status=false was specified)")
|
||||
|
|
|
@ -62,6 +62,8 @@ type Config struct {
|
|||
|
||||
DefaultIngressClass string
|
||||
IngressClass string
|
||||
|
||||
CustomIngressStatus func(*extensions.Ingress) []api_v1.LoadBalancerIngress
|
||||
}
|
||||
|
||||
// statusSync keeps the status IP in each Ingress rule updated executing a periodic check
|
||||
|
@ -300,6 +302,11 @@ func (s *statusSync) updateStatus(newIPs []api_v1.LoadBalancerIngress) {
|
|||
return
|
||||
}
|
||||
|
||||
addrs := s.CustomIngressStatus(currIng)
|
||||
if addrs != nil {
|
||||
newIPs = addrs
|
||||
}
|
||||
|
||||
curIPs := currIng.Status.LoadBalancer.Ingress
|
||||
sort.Sort(loadBalancerIngressByIP(curIPs))
|
||||
if ingressSliceEqual(newIPs, curIPs) {
|
||||
|
|
|
@ -24,6 +24,7 @@ import (
|
|||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
"k8s.io/apiserver/pkg/server/healthz"
|
||||
api "k8s.io/client-go/pkg/api/v1"
|
||||
extensions "k8s.io/client-go/pkg/apis/extensions/v1beta1"
|
||||
|
||||
"k8s.io/ingress/core/pkg/ingress/annotations/auth"
|
||||
"k8s.io/ingress/core/pkg/ingress/annotations/authreq"
|
||||
|
@ -92,6 +93,10 @@ type Controller interface {
|
|||
OverrideFlags(*pflag.FlagSet)
|
||||
// DefaultIngressClass just return the default ingress class
|
||||
DefaultIngressClass() string
|
||||
// UpdateIngressStatus custom callback used to update the status in an Ingress rule
|
||||
// This allows custom implementations
|
||||
// If the function returns nil the standard functions will be executed.
|
||||
UpdateIngressStatus(*extensions.Ingress) []api.LoadBalancerIngress
|
||||
}
|
||||
|
||||
// StoreLister returns the configured stores for ingresses, services,
|
||||
|
|
Loading…
Reference in a new issue