mirror of https://github.com/k3s-io/k3s
Remove glog added by mistake, start converting phase1+ TODOs to issues
parent
c1e8c6d878
commit
037ef3e50c
|
@ -20,7 +20,6 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
|
||||||
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/api"
|
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/api"
|
||||||
kubeadmutil "k8s.io/kubernetes/cmd/kubeadm/app/util"
|
kubeadmutil "k8s.io/kubernetes/cmd/kubeadm/app/util"
|
||||||
"k8s.io/kubernetes/pkg/apis/certificates"
|
"k8s.io/kubernetes/pkg/apis/certificates"
|
||||||
|
@ -36,7 +35,7 @@ import (
|
||||||
|
|
||||||
// PerformTLSBootstrap creates a RESTful client in order to execute certificate signing request.
|
// PerformTLSBootstrap creates a RESTful client in order to execute certificate signing request.
|
||||||
func PerformTLSBootstrap(s *kubeadmapi.KubeadmConfig, apiEndpoint string, caCert []byte) (*clientcmdapi.Config, error) {
|
func PerformTLSBootstrap(s *kubeadmapi.KubeadmConfig, apiEndpoint string, caCert []byte) (*clientcmdapi.Config, error) {
|
||||||
// TODO(phase1+) try all the api servers until we find one that works
|
// TODO(phase2) try all the api servers until we find one that works
|
||||||
bareClientConfig := kubeadmutil.CreateBasicClientConfig("kubernetes", apiEndpoint, caCert)
|
bareClientConfig := kubeadmutil.CreateBasicClientConfig("kubernetes", apiEndpoint, caCert)
|
||||||
|
|
||||||
hostName, err := os.Hostname()
|
hostName, err := os.Hostname()
|
||||||
|
@ -44,9 +43,7 @@ func PerformTLSBootstrap(s *kubeadmapi.KubeadmConfig, apiEndpoint string, caCert
|
||||||
return nil, fmt.Errorf("<node/csr> failed to get node hostname [%v]", err)
|
return nil, fmt.Errorf("<node/csr> failed to get node hostname [%v]", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: hostname == nodename doesn't hold on all clouds (AWS).
|
// TODO(phase1+) https://github.com/kubernetes/kubernetes/issues/33641
|
||||||
// But we don't have a cloudprovider, so we're stuck.
|
|
||||||
glog.Errorf("assuming that hostname is the same as NodeName")
|
|
||||||
nodeName := types.NodeName(hostName)
|
nodeName := types.NodeName(hostName)
|
||||||
|
|
||||||
bootstrapClientConfig, err := clientcmd.NewDefaultClientConfig(
|
bootstrapClientConfig, err := clientcmd.NewDefaultClientConfig(
|
||||||
|
@ -65,9 +62,7 @@ func PerformTLSBootstrap(s *kubeadmapi.KubeadmConfig, apiEndpoint string, caCert
|
||||||
}
|
}
|
||||||
csrClient := client.CertificateSigningRequests()
|
csrClient := client.CertificateSigningRequests()
|
||||||
|
|
||||||
// TODO(phase1+) checkCertsAPI() has a side-effect of making first attempt of communicating with the API,
|
// TODO(phase1+) https://github.com/kubernetes/kubernetes/issues/33643
|
||||||
// we should _make it more explicit_ and have a user-settable _retry timeout_ to account for potential connectivity issues
|
|
||||||
// (for example user may be bringing up machines in parallel and for some reasons master is slow to boot)
|
|
||||||
|
|
||||||
if err := checkCertsAPI(bootstrapClientConfig); err != nil {
|
if err := checkCertsAPI(bootstrapClientConfig); err != nil {
|
||||||
return nil, fmt.Errorf("<node/csr> failed to proceed due to API compatibility issue - %v", err)
|
return nil, fmt.Errorf("<node/csr> failed to proceed due to API compatibility issue - %v", err)
|
||||||
|
@ -85,7 +80,7 @@ func PerformTLSBootstrap(s *kubeadmapi.KubeadmConfig, apiEndpoint string, caCert
|
||||||
return nil, fmt.Errorf("<node/csr> failed to request signed certificate from the API server [%v]", err)
|
return nil, fmt.Errorf("<node/csr> failed to request signed certificate from the API server [%v]", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(phase1+) print some basic info about the cert
|
// TODO(phase1+) https://github.com/kubernetes/kubernetes/issues/33642
|
||||||
fmt.Println("<node/csr> received signed certificate from the API server, generating kubelet configuration")
|
fmt.Println("<node/csr> received signed certificate from the API server, generating kubelet configuration")
|
||||||
|
|
||||||
finalConfig := kubeadmutil.MakeClientConfigWithCerts(
|
finalConfig := kubeadmutil.MakeClientConfigWithCerts(
|
||||||
|
|
Loading…
Reference in New Issue