mirror of
https://github.com/rancher/rke.git
synced 2025-09-17 23:49:06 +00:00
add support for specifc control plane IP per host
This commit is contained in:
11
pki/pki.go
11
pki/pki.go
@@ -74,7 +74,7 @@ func generateCerts(cpHosts []hosts.Host, clusterDomain string, KubernetesService
|
||||
certs[KubeControllerName] = CertificatePKI{
|
||||
certificate: kubeControllerCrt,
|
||||
key: kubeControllerKey,
|
||||
config: getKubeConfigX509("https://"+cpHosts[0].IP+":6443", KubeControllerName, CACertPath, KubeControllerCertPath, KubeControllerKeyPath),
|
||||
config: getKubeConfigX509("https://"+cpHosts[0].ControlPlaneIP+":6443", KubeControllerName, CACertPath, KubeControllerCertPath, KubeControllerKeyPath),
|
||||
}
|
||||
|
||||
// generate Kube scheduler certificate and key
|
||||
@@ -87,7 +87,7 @@ func generateCerts(cpHosts []hosts.Host, clusterDomain string, KubernetesService
|
||||
certs[KubeSchedulerName] = CertificatePKI{
|
||||
certificate: kubeSchedulerCrt,
|
||||
key: kubeSchedulerKey,
|
||||
config: getKubeConfigX509("https://"+cpHosts[0].IP+":6443", KubeSchedulerName, CACertPath, KubeSchedulerCertPath, KubeSchedulerKeyPath),
|
||||
config: getKubeConfigX509("https://"+cpHosts[0].ControlPlaneIP+":6443", KubeSchedulerName, CACertPath, KubeSchedulerCertPath, KubeSchedulerKeyPath),
|
||||
}
|
||||
|
||||
// generate Kube Proxy certificate and key
|
||||
@@ -100,7 +100,7 @@ func generateCerts(cpHosts []hosts.Host, clusterDomain string, KubernetesService
|
||||
certs[KubeProxyName] = CertificatePKI{
|
||||
certificate: kubeProxyCrt,
|
||||
key: kubeProxyKey,
|
||||
config: getKubeConfigX509("https://"+cpHosts[0].IP+":6443", KubeProxyName, CACertPath, KubeProxyCertPath, KubeProxyKeyPath),
|
||||
config: getKubeConfigX509("https://"+cpHosts[0].ControlPlaneIP+":6443", KubeProxyName, CACertPath, KubeProxyCertPath, KubeProxyKeyPath),
|
||||
}
|
||||
|
||||
logrus.Infof("[certificates] Generating Node certificate")
|
||||
@@ -112,7 +112,7 @@ func generateCerts(cpHosts []hosts.Host, clusterDomain string, KubernetesService
|
||||
certs[KubeNodeName] = CertificatePKI{
|
||||
certificate: nodeCrt,
|
||||
key: nodeKey,
|
||||
config: getKubeConfigX509("https://"+cpHosts[0].IP+":6443", KubeNodeName, CACertPath, KubeNodeCertPath, KubeNodeKeyPath),
|
||||
config: getKubeConfigX509("https://"+cpHosts[0].ControlPlaneIP+":6443", KubeNodeName, CACertPath, KubeNodeCertPath, KubeNodeKeyPath),
|
||||
}
|
||||
return certs, nil
|
||||
}
|
||||
@@ -174,6 +174,9 @@ func getAltNames(cpHosts []hosts.Host, clusterDomain string, KubernetesServiceIP
|
||||
dnsNames := []string{}
|
||||
for _, host := range cpHosts {
|
||||
ips = append(ips, net.ParseIP(host.IP))
|
||||
if host.IP != host.ControlPlaneIP {
|
||||
ips = append(ips, net.ParseIP(host.ControlPlaneIP))
|
||||
}
|
||||
dnsNames = append(dnsNames, host.Hostname)
|
||||
}
|
||||
ips = append(ips, net.ParseIP("127.0.0.1"))
|
||||
|
Reference in New Issue
Block a user