add tls san for non-default host name

This commit is contained in:
iwilltry42 2019-10-25 11:16:48 +02:00
parent 116dd5dad8
commit 4adb695b47

View File

@ -119,19 +119,17 @@ func patchMasterSpec(node *k3d.Node) error {
apiPort := "6443" // TODO: from defaults
if node.MasterOpts.ExposeAPI.Port != "" {
apiPort = node.MasterOpts.ExposeAPI.Port
node.Labels["k3d.master.api.port"] = node.MasterOpts.ExposeAPI.Port
}
if node.MasterOpts.ExposeAPI.Host != "" {
if node.MasterOpts.ExposeAPI.Host != "" {
hostIP = node.MasterOpts.ExposeAPI.HostIP
node.Labels["k3d.master.api.hostIP"] = node.MasterOpts.ExposeAPI.HostIP // TODO: maybe get docker machine IP here
hostIP = node.MasterOpts.ExposeAPI.HostIP
node.Labels["k3d.master.api.hostIP"] = node.MasterOpts.ExposeAPI.HostIP // TODO: maybe get docker machine IP here
node.Labels["k3d.master.api.host"] = node.MasterOpts.ExposeAPI.Host
}
node.Labels["k3d.master.api.host"] = node.MasterOpts.ExposeAPI.Host
node.Args = append(node.Args, "--tls-san", node.MasterOpts.ExposeAPI.Host) // add TLS SAN for non default host name
}
node.Ports = append(node.Ports, fmt.Sprintf("%s:%s:6443/tcp", hostIP, apiPort)) // TODO: get '6443' from defaultport variable