When running on a docker machine, the default X598 certificate does not allow access via docker machine's IP. This patch fixes this by adding "--tls-san <docker machine IP>" to the K3S server argument list.
27 lines
465 B
Go
27 lines
465 B
Go
package run
|
|
|
|
import (
|
|
"os"
|
|
"os/exec"
|
|
"strings"
|
|
)
|
|
|
|
func getDockerMachineIp() (string, error) {
|
|
machine := os.ExpandEnv("$DOCKER_MACHINE_NAME")
|
|
|
|
if machine == "" {
|
|
return "", nil
|
|
}
|
|
|
|
dockerMachinePath, err := exec.LookPath("docker-machine")
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
|
|
out, err := exec.Command(dockerMachinePath, "ip", machine).Output()
|
|
|
|
ipStr := strings.TrimSuffix(string(out), "\n")
|
|
ipStr = strings.TrimSuffix(ipStr, "\r")
|
|
return ipStr, err
|
|
}
|