From 4fbc4f66c45a9cb670e6af7bf488d231123f706f Mon Sep 17 00:00:00 2001 From: Deyan Stanev Date: Wed, 9 Jun 2021 21:36:04 +0300 Subject: [PATCH 1/4] Add InternalIP fallback if no external is found --- pkg/bootconfig/boot.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/bootconfig/boot.go b/pkg/bootconfig/boot.go index b35c5554..0216ffcc 100644 --- a/pkg/bootconfig/boot.go +++ b/pkg/bootconfig/boot.go @@ -111,8 +111,13 @@ func (c *Controller) Run(ctx context.Context) error { ok = true break } - } + // Fallback to use the InternalIP if no external is defined + if addr.Type == "InternalIP" { + externalAddress = addr.Address + ok = true + } + } // Fallback to use a label to find the external address. if !ok { externalAddress, ok = node.Labels[c.opts.TargetTag] From f132da30bb025de9a5c43c9b78826a525d4227cc Mon Sep 17 00:00:00 2001 From: Deyan Stanev Date: Thu, 10 Jun 2021 10:22:04 +0300 Subject: [PATCH 2/4] whitespace fix --- pkg/bootconfig/boot.go | 1 - 1 file changed, 1 deletion(-) diff --git a/pkg/bootconfig/boot.go b/pkg/bootconfig/boot.go index 0216ffcc..14951f51 100644 --- a/pkg/bootconfig/boot.go +++ b/pkg/bootconfig/boot.go @@ -116,7 +116,6 @@ func (c *Controller) Run(ctx context.Context) error { externalAddress = addr.Address ok = true } - } // Fallback to use a label to find the external address. if !ok { From 5a702bafb8e88d675d9928349f724ba0a044f552 Mon Sep 17 00:00:00 2001 From: ZleFox Date: Thu, 10 Jun 2021 19:26:29 +0300 Subject: [PATCH 3/4] whitespace replace space with tabs --- pkg/bootconfig/boot.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/bootconfig/boot.go b/pkg/bootconfig/boot.go index 14951f51..ebcf1793 100644 --- a/pkg/bootconfig/boot.go +++ b/pkg/bootconfig/boot.go @@ -112,10 +112,10 @@ func (c *Controller) Run(ctx context.Context) error { break } // Fallback to use the InternalIP if no external is defined - if addr.Type == "InternalIP" { - externalAddress = addr.Address - ok = true - } + if addr.Type == "InternalIP" { + externalAddress = addr.Address + ok = true + } } // Fallback to use a label to find the external address. if !ok { From bf234e11133bd3932d16c78316ae733de3b35df9 Mon Sep 17 00:00:00 2001 From: Deyan Stanev Date: Thu, 5 Aug 2021 12:54:03 +0300 Subject: [PATCH 4/4] move labels to take precedence over internal ip --- pkg/bootconfig/boot.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/pkg/bootconfig/boot.go b/pkg/bootconfig/boot.go index ebcf1793..bf7477e2 100644 --- a/pkg/bootconfig/boot.go +++ b/pkg/bootconfig/boot.go @@ -111,15 +111,19 @@ func (c *Controller) Run(ctx context.Context) error { ok = true break } - // Fallback to use the InternalIP if no external is defined - if addr.Type == "InternalIP" { - externalAddress = addr.Address - ok = true - } } // Fallback to use a label to find the external address. if !ok { externalAddress, ok = node.Labels[c.opts.TargetTag] + if !ok || len(externalAddress) == 0 { + for _, addr := range node.Status.Addresses { + // Fallback to use the InternalIP if no label is defined + if addr.Type == "InternalIP" { + externalAddress = addr.Address + ok = true + } + } + } if !ok || len(externalAddress) == 0 { return errors.New("Could not find external IP address.") }