Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add InternalIP fallback if no external is found #322

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
10 changes: 9 additions & 1 deletion pkg/bootconfig/boot.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,18 @@ func (c *Controller) Run(ctx context.Context) error {
break
}
}
ZleFox marked this conversation as resolved.
Show resolved Hide resolved

// 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.")
}
Expand Down