server: trim the port off the dockerHost as it renders the kubeconfig unusable (fixes #487)
This commit is contained in:
parent
26fa7224ff
commit
e1384c91a2
@ -352,7 +352,7 @@ func applyCLIOverrides(cfg conf.SimpleConfig) (conf.SimpleConfig, error) {
|
|||||||
// -> API-PORT
|
// -> API-PORT
|
||||||
// parse the port mapping
|
// parse the port mapping
|
||||||
var (
|
var (
|
||||||
err error
|
err error
|
||||||
exposeAPI *k3d.ExposureOpts
|
exposeAPI *k3d.ExposureOpts
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -374,7 +374,7 @@ func patchAgentSpec(node *k3d.Node) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// patchServerSpec adds agent node specific settings to a node
|
// patchServerSpec adds server node specific settings to a node
|
||||||
func patchServerSpec(node *k3d.Node, runtime runtimes.Runtime) error {
|
func patchServerSpec(node *k3d.Node, runtime runtimes.Runtime) error {
|
||||||
// command / arguments
|
// command / arguments
|
||||||
if node.Cmd == nil {
|
if node.Cmd == nil {
|
||||||
@ -391,6 +391,8 @@ func patchServerSpec(node *k3d.Node, runtime runtimes.Runtime) error {
|
|||||||
if runtime == runtimes.Docker {
|
if runtime == runtimes.Docker {
|
||||||
dockerHost := runtime.GetHost()
|
dockerHost := runtime.GetHost()
|
||||||
if dockerHost != "" {
|
if dockerHost != "" {
|
||||||
|
dockerHost = strings.Split(dockerHost, ":")[0] // remove the port
|
||||||
|
log.Tracef("Using docker host %s", dockerHost)
|
||||||
node.Labels[k3d.LabelServerAPIHostIP] = dockerHost
|
node.Labels[k3d.LabelServerAPIHostIP] = dockerHost
|
||||||
node.Labels[k3d.LabelServerAPIHost] = dockerHost
|
node.Labels[k3d.LabelServerAPIHost] = dockerHost
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,8 @@ package docker
|
|||||||
import (
|
import (
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
log "github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Docker struct{}
|
type Docker struct{}
|
||||||
@ -41,6 +43,7 @@ func (d Docker) GetHost() string {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
log.Debugf("DockerHost: %s", url.Host)
|
||||||
return url.Host
|
return url.Host
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user