Skip to content

Commit

Permalink
feat: ability to specify network interface (#1204)
Browse files Browse the repository at this point in the history
* feat: ability to specify network interface
  • Loading branch information
sgalsaleh authored Sep 19, 2024
1 parent 1ab75c3 commit 41cda7e
Show file tree
Hide file tree
Showing 15 changed files with 186 additions and 129 deletions.
14 changes: 12 additions & 2 deletions cmd/embedded-cluster/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"github.com/replicatedhq/embedded-cluster/pkg/goods"
"github.com/replicatedhq/embedded-cluster/pkg/helpers"
"github.com/replicatedhq/embedded-cluster/pkg/metrics"
"github.com/replicatedhq/embedded-cluster/pkg/netutils"
"github.com/replicatedhq/embedded-cluster/pkg/preflights"
"github.com/replicatedhq/embedded-cluster/pkg/prompts"
"github.com/replicatedhq/embedded-cluster/pkg/release"
Expand Down Expand Up @@ -331,12 +332,16 @@ func ensureK0sConfig(c *cli.Context, applier *addons.Applier) (*k0sconfig.Cluste
return nil, fmt.Errorf("unable to create directory: %w", err)
}
cfg := config.RenderK0sConfig()
address, err := netutils.FirstValidAddress(c.String("network-interface"))
if err != nil {
return nil, fmt.Errorf("unable to find first valid address: %w", err)
}
cfg.Spec.API.Address = address
cfg.Spec.Network.PodCIDR = c.String("pod-cidr")
cfg.Spec.Network.ServiceCIDR = c.String("service-cidr")
if err := config.UpdateHelmConfigs(applier, cfg); err != nil {
return nil, fmt.Errorf("unable to update helm configs: %w", err)
}
var err error
cfg, err = applyUnsupportedOverrides(c, cfg)
if err != nil {
return nil, fmt.Errorf("unable to apply unsupported overrides: %w", err)
Expand Down Expand Up @@ -490,7 +495,7 @@ func runOutro(c *cli.Context, applier *addons.Applier, cfg *k0sconfig.ClusterCon
return fmt.Errorf("unable to process overrides file: %w", err)
}

return applier.Outro(c.Context, cfg, eucfg, metadata)
return applier.Outro(c.Context, cfg, eucfg, metadata, c.String("network-interface"))
}

func maybeAskAdminConsolePassword(c *cli.Context) (string, error) {
Expand Down Expand Up @@ -557,6 +562,11 @@ var installCommand = &cli.Command{
Usage: "Path to the license file",
Hidden: false,
},
&cli.StringFlag{
Name: "network-interface",
Usage: "The network interface to use for the cluster",
Value: "",
},
&cli.BoolFlag{
Name: "no-prompt",
Usage: "Disable interactive prompts. The Admin Console password will be set to password.",
Expand Down
6 changes: 3 additions & 3 deletions cmd/embedded-cluster/join.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ var joinCommand = &cli.Command{
}

setProxyEnv(jcmd.Proxy)
proxyOK, localIP, err := checkProxyConfigForLocalIP(jcmd.Proxy)
proxyOK, localIP, err := checkProxyConfigForLocalIP(jcmd.Proxy, "") // TODO (@salah): detect network interface from join command
if err != nil {
return fmt.Errorf("failed to check proxy config for local IP: %w", err)
}
Expand Down Expand Up @@ -265,7 +265,7 @@ var joinCommand = &cli.Command{
}

logrus.Debugf("overriding network configuration")
if err := applyNetworkConfiguration(jcmd); err != nil {
if err := applyNetworkConfiguration(c, jcmd); err != nil {
err := fmt.Errorf("unable to apply network configuration: %w", err)
metrics.ReportJoinFailed(c.Context, jcmd.MetricsBaseURL, jcmd.ClusterID, err)
}
Expand Down Expand Up @@ -326,7 +326,7 @@ var joinCommand = &cli.Command{
},
}

func applyNetworkConfiguration(jcmd *JoinCommandResponse) error {
func applyNetworkConfiguration(c *cli.Context, jcmd *JoinCommandResponse) error {
if jcmd.Network != nil {
clusterSpec := config.RenderK0sConfig()
// NOTE: we should be copying everything from the in cluster config spec and overriding
Expand Down
2 changes: 1 addition & 1 deletion cmd/embedded-cluster/preflights.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ var joinRunPreflightsCommand = &cli.Command{
}

setProxyEnv(jcmd.Proxy)
proxyOK, localIP, err := checkProxyConfigForLocalIP(jcmd.Proxy)
proxyOK, localIP, err := checkProxyConfigForLocalIP(jcmd.Proxy, "") // TODO (@salah): detect network interface from join command
if err != nil {
return fmt.Errorf("failed to check proxy config for local IP: %w", err)
}
Expand Down
30 changes: 15 additions & 15 deletions cmd/embedded-cluster/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,26 +99,26 @@ func includeLocalIPInNoProxy(c *cli.Context, proxy *ecv1beta1.ProxySpec) (*ecv1b
// if there is a proxy set, then there needs to be a no proxy set
// if it is not set, prompt with a default (the local IP or subnet)
// if it is set, we need to check that it covers the local IP
defaultIPNet, err := netutils.GetDefaultIPNet()
ipnet, err := netutils.FirstValidIPNet(c.String("network-interface"))
if err != nil {
return nil, fmt.Errorf("failed to get default IPNet: %w", err)
return nil, fmt.Errorf("failed to get first valid ip net: %w", err)
}
cleanDefaultIPNet, err := cleanCIDR(defaultIPNet)
cleanIPNet, err := cleanCIDR(ipnet)
if err != nil {
return nil, fmt.Errorf("failed to clean subnet: %w", err)
}
if proxy.ProvidedNoProxy == "" {
logrus.Infof("--no-proxy was not set. Adding the default interface's subnet (%q) to the no-proxy list.", cleanDefaultIPNet)
proxy.ProvidedNoProxy = cleanDefaultIPNet
logrus.Infof("--no-proxy was not set. Adding the default interface's subnet (%q) to the no-proxy list.", cleanIPNet)
proxy.ProvidedNoProxy = cleanIPNet
combineNoProxySuppliedValuesAndDefaults(c, proxy)
return proxy, nil
} else {
isValid, err := validateNoProxy(proxy.NoProxy, defaultIPNet.IP.String())
isValid, err := validateNoProxy(proxy.NoProxy, ipnet.IP.String())
if err != nil {
return nil, fmt.Errorf("failed to validate no-proxy: %w", err)
} else if !isValid {
logrus.Infof("The node IP (%q) is not included in the provided no-proxy list (%q). Adding the default interface's subnet (%q) to the no-proxy list.", defaultIPNet.IP.String(), proxy.ProvidedNoProxy, cleanDefaultIPNet)
proxy.ProvidedNoProxy = cleanDefaultIPNet
logrus.Infof("The node IP (%q) is not included in the provided no-proxy list (%q). Adding the default interface's subnet (%q) to the no-proxy list.", ipnet.IP.String(), proxy.ProvidedNoProxy, cleanIPNet)
proxy.ProvidedNoProxy = cleanIPNet
combineNoProxySuppliedValuesAndDefaults(c, proxy)
return proxy, nil
}
Expand All @@ -128,10 +128,10 @@ func includeLocalIPInNoProxy(c *cli.Context, proxy *ecv1beta1.ProxySpec) (*ecv1b
}

// cleanCIDR returns a `.0/x` subnet instead of a `.2/x` etc subnet
func cleanCIDR(defaultIPNet *net.IPNet) (string, error) {
_, newNet, err := net.ParseCIDR(defaultIPNet.String())
func cleanCIDR(ipnet *net.IPNet) (string, error) {
_, newNet, err := net.ParseCIDR(ipnet.String())
if err != nil {
return "", fmt.Errorf("failed to parse local inet CIDR %q: %w", defaultIPNet.String(), err)
return "", fmt.Errorf("failed to parse local inet CIDR %q: %w", ipnet.String(), err)
}
return newNet.String(), nil
}
Expand All @@ -155,19 +155,19 @@ func validateNoProxy(newNoProxy string, localIP string) (bool, error) {
return foundLocal, nil
}

func checkProxyConfigForLocalIP(proxy *ecv1beta1.ProxySpec) (bool, string, error) {
func checkProxyConfigForLocalIP(proxy *ecv1beta1.ProxySpec, networkInterface string) (bool, string, error) {
if proxy == nil {
return true, "", nil // no proxy is fine
}
if proxy.HTTPProxy == "" && proxy.HTTPSProxy == "" {
return true, "", nil // no proxy is fine
}

defaultIPNet, err := netutils.GetDefaultIPNet()
ipnet, err := netutils.FirstValidIPNet(networkInterface)
if err != nil {
return false, "", fmt.Errorf("failed to get default IPNet: %w", err)
}

ok, err := validateNoProxy(proxy.NoProxy, defaultIPNet.IP.String())
return ok, defaultIPNet.IP.String(), err
ok, err := validateNoProxy(proxy.NoProxy, ipnet.IP.String())
return ok, ipnet.IP.String(), err
}
18 changes: 14 additions & 4 deletions cmd/embedded-cluster/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"github.com/replicatedhq/embedded-cluster/pkg/defaults"
"github.com/replicatedhq/embedded-cluster/pkg/kotscli"
"github.com/replicatedhq/embedded-cluster/pkg/kubeutils"
"github.com/replicatedhq/embedded-cluster/pkg/netutils"
"github.com/replicatedhq/embedded-cluster/pkg/prompts"
"github.com/replicatedhq/embedded-cluster/pkg/release"
"github.com/replicatedhq/embedded-cluster/pkg/spinner"
Expand Down Expand Up @@ -323,12 +324,16 @@ func ensureK0sConfigForRestore(c *cli.Context, applier *addons.Applier) (*k0sv1b
return nil, fmt.Errorf("unable to create directory: %w", err)
}
cfg := config.RenderK0sConfig()
address, err := netutils.FirstValidAddress(c.String("network-interface"))
if err != nil {
return nil, fmt.Errorf("unable to find first valid address: %w", err)
}
cfg.Spec.API.Address = address
cfg.Spec.Network.PodCIDR = c.String("pod-cidr")
cfg.Spec.Network.ServiceCIDR = c.String("service-cidr")
if err := config.UpdateHelmConfigsForRestore(applier, cfg); err != nil {
return nil, fmt.Errorf("unable to update helm configs: %w", err)
}
var err error
cfg, err = applyUnsupportedOverrides(c, cfg)
if err != nil {
return nil, fmt.Errorf("unable to apply unsupported overrides: %w", err)
Expand Down Expand Up @@ -799,7 +804,7 @@ func restoreFromBackup(ctx context.Context, backup *velerov1.Backup, drComponent
}

// waitForAdditionalNodes waits for for user to add additional nodes to the cluster.
func waitForAdditionalNodes(ctx context.Context, highAvailability bool) error {
func waitForAdditionalNodes(ctx context.Context, highAvailability bool, networkInterface string) error {
kcli, err := kubeutils.KubeClient()
if err != nil {
return fmt.Errorf("unable to create kube client: %w", err)
Expand All @@ -808,7 +813,7 @@ func waitForAdditionalNodes(ctx context.Context, highAvailability bool) error {
successColor := "\033[32m"
colorReset := "\033[0m"
joinNodesMsg := fmt.Sprintf("\nVisit the Admin Console if you need to add nodes to the cluster: %s%s%s\n",
successColor, adminconsole.GetURL(), colorReset,
successColor, adminconsole.GetURL(networkInterface), colorReset,
)
logrus.Info(joinNodesMsg)

Expand Down Expand Up @@ -880,6 +885,11 @@ var restoreCommand = &cli.Command{
Usage: "Path to the air gap bundle. If set, the restore will complete without internet access.",
Hidden: true,
},
&cli.StringFlag{
Name: "network-interface",
Usage: "The network interface to use for the cluster",
Value: "",
},
&cli.BoolFlag{
Name: "no-prompt",
Usage: "Disable interactive prompts.",
Expand Down Expand Up @@ -1078,7 +1088,7 @@ var restoreCommand = &cli.Command{
return err
}
logrus.Debugf("waiting for additional nodes to be added")
if err := waitForAdditionalNodes(c.Context, highAvailability); err != nil {
if err := waitForAdditionalNodes(c.Context, highAvailability, c.String("network-interface")); err != nil {
return err
}
fallthrough
Expand Down
2 changes: 1 addition & 1 deletion dagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"name": "embedded-cluster",
"sdk": "go",
"source": "dagger",
"engineVersion": "v0.13.0"
"engineVersion": "v0.13.1"
}
20 changes: 10 additions & 10 deletions dagger/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,26 @@ require (
go.opentelemetry.io/otel/trace v1.27.0
go.opentelemetry.io/proto/otlp v1.3.1
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa
golang.org/x/sync v0.7.0
google.golang.org/grpc v1.64.0
golang.org/x/sync v0.8.0
google.golang.org/grpc v1.66.1
)

require (
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 // indirect
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect
github.com/sosodev/duration v1.3.1 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.27.0 // indirect
go.opentelemetry.io/otel/metric v1.27.0 // indirect
golang.org/x/net v0.26.0 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/text v0.16.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240520151616-dc85e6b867a5 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240515191416-fc5f0ca64291 // indirect
google.golang.org/protobuf v1.34.1 // indirect
golang.org/x/net v0.29.0 // indirect
golang.org/x/sys v0.25.0 // indirect
golang.org/x/text v0.18.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect
google.golang.org/protobuf v1.34.2 // indirect
)

replace go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc => go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.0.0-20240518090000-14441aefdf88
Expand Down
40 changes: 20 additions & 20 deletions dagger/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ=
github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 h1:bkypFPDjIYGfCYD5mRBvpqxfYX1YCS1PXdKYWi8FsN0=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0/go.mod h1:P+Lt/0by1T8bfcF3z737NnSbmxQAppXMRziHUxPOC8k=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 h1:asbCHRVmodnJTuQ3qamDwqVOIjwqUPTYmYuemVOx+Ys=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0/go.mod h1:ggCgvZ2r7uOoQjOyu2Y1NhHmEPPzzuhWgcza5M1Ji1I=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
Expand Down Expand Up @@ -63,22 +63,22 @@ go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa h1:FRnLl4eNAQl8hwxVVC17teOw8kdjVDVAiFMtgUdTSRQ=
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa/go.mod h1:zk2irFbV9DP96SEBUUAy67IdHUaZuSnrz1n472HUCLE=
golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ=
golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE=
golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws=
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
google.golang.org/genproto/googleapis/api v0.0.0-20240520151616-dc85e6b867a5 h1:P8OJ/WCl/Xo4E4zoe4/bifHpSmmKwARqyqE4nW6J2GQ=
google.golang.org/genproto/googleapis/api v0.0.0-20240520151616-dc85e6b867a5/go.mod h1:RGnPtTG7r4i8sPlNyDeikXF99hMM+hN6QMm4ooG9g2g=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240515191416-fc5f0ca64291 h1:AgADTJarZTBqgjiUzRgfaBchgYB3/WFTC80GPwsMcRI=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240515191416-fc5f0ca64291/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0=
google.golang.org/grpc v1.64.0 h1:KH3VH9y/MgNQg1dE7b3XfVK0GsPSIzJwdF617gUSbvY=
google.golang.org/grpc v1.64.0/go.mod h1:oxjF8E3FBnjp+/gVFYdWacaLDx9na1aqy9oovLpxQYg=
google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg=
google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo=
golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0=
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34=
golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224=
golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 h1:hjSy6tcFQZ171igDaN5QHOw2n6vx40juYbC/x67CEhc=
google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:qpvKtACPCQhAdu3PyQgV4l3LMXZEtft7y8QcarRsp9I=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 h1:pPJltXNxVzT4pK9yD8vR9X75DaWYYmLGMsEvBfFQZzQ=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU=
google.golang.org/grpc v1.66.1 h1:hO5qAXR19+/Z44hmvIM4dQFMSYX9XcWsByfoxutBpAM=
google.golang.org/grpc v1.66.1/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y=
google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=
google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
Expand Down
5 changes: 3 additions & 2 deletions pkg/addons/adminconsole/adminconsole.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"github.com/replicatedhq/embedded-cluster/pkg/kotscli"
"github.com/replicatedhq/embedded-cluster/pkg/kubeutils"
"github.com/replicatedhq/embedded-cluster/pkg/metrics"
"github.com/replicatedhq/embedded-cluster/pkg/netutils"
"github.com/replicatedhq/embedded-cluster/pkg/release"
"github.com/replicatedhq/embedded-cluster/pkg/spinner"
"github.com/replicatedhq/embedded-cluster/pkg/versions"
Expand Down Expand Up @@ -258,11 +259,11 @@ func WaitForReady(ctx context.Context, cli client.Client, ns string, writer *spi
}

// GetURL returns the URL to the admin console.
func GetURL() string {
func GetURL(networkInterface string) string {
ipaddr := defaults.TryDiscoverPublicIP()
if ipaddr == "" {
var err error
ipaddr, err = defaults.PreferredNodeIPAddress()
ipaddr, err = netutils.FirstValidAddress(networkInterface)
if err != nil {
logrus.Errorf("unable to determine node IP address: %v", err)
ipaddr = "NODE-IP-ADDRESS"
Expand Down
Loading

0 comments on commit 41cda7e

Please sign in to comment.