Add falg to report node internal IP address in ingress status

This commit is contained in:
Manuel de Brito Fontes 2017-10-08 14:29:19 -03:00
parent 4479b54953
commit 284448f8d9
5 changed files with 34 additions and 20 deletions

View file

@ -135,9 +135,11 @@ type Configuration struct {
Backend ingress.Controller
UpdateStatus bool
UseNodeInternalIP bool
ElectionID string
UpdateStatusOnShutdown bool
SortBackends bool
SortBackends bool
}
// newIngressController creates an Ingress controller
@ -174,6 +176,7 @@ func newIngressController(config *Configuration) *GenericController {
DefaultIngressClass: config.DefaultIngressClass,
UpdateStatusOnShutdown: config.UpdateStatusOnShutdown,
CustomIngressStatus: ic.cfg.Backend.UpdateIngressStatus,
UseNodeInternalIP: ic.cfg.UseNodeInternalIP,
})
} else {
glog.Warning("Update of ingress status is disabled (flag --update-status=false was specified)")

View file

@ -101,6 +101,9 @@ func NewIngressController(backend ingress.Controller) *GenericController {
sortBackends = flags.Bool("sort-backends", false,
`Defines if backends and it's endpoints should be sorted`)
useNodeInternalIP = flags.Bool("report-node-internal-ip-address", false,
`Defines if the nodes IP address to be returned in the ingress status should be the internal instead of the external IP address`)
)
flags.AddGoFlagSet(flag.CommandLine)
@ -198,6 +201,7 @@ func NewIngressController(backend ingress.Controller) *GenericController {
DisableNodeList: *disableNodeList,
UpdateStatusOnShutdown: *updateStatusOnShutdown,
SortBackends: *sortBackends,
UseNodeInternalIP: *useNodeInternalIP,
}
ic := newIngressController(config)