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
|
||||
// parse the port mapping
|
||||
var (
|
||||
err error
|
||||
err error
|
||||
exposeAPI *k3d.ExposureOpts
|
||||
)
|
||||
|
||||
|
@ -374,7 +374,7 @@ func patchAgentSpec(node *k3d.Node) error {
|
||||
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 {
|
||||
// command / arguments
|
||||
if node.Cmd == nil {
|
||||
@ -391,6 +391,8 @@ func patchServerSpec(node *k3d.Node, runtime runtimes.Runtime) error {
|
||||
if runtime == runtimes.Docker {
|
||||
dockerHost := runtime.GetHost()
|
||||
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.LabelServerAPIHost] = dockerHost
|
||||
}
|
||||
|
@ -25,6 +25,8 @@ package docker
|
||||
import (
|
||||
"net/url"
|
||||
"os"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
type Docker struct{}
|
||||
@ -41,6 +43,7 @@ func (d Docker) GetHost() string {
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
log.Debugf("DockerHost: %s", url.Host)
|
||||
return url.Host
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user