Fixes using externally managed certs for kubeadm
Walk the certificate tree, at each step checking for a CACert. If the CACert is found, try to use it to generate certificates. Otherwise, generate a new CA cert.
This commit is contained in:
@@ -26,8 +26,10 @@ import (
|
||||
"github.com/renstrom/dedent"
|
||||
|
||||
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
||||
kubeadmapiv1alpha3 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha3"
|
||||
kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
||||
"k8s.io/kubernetes/cmd/kubeadm/app/phases/certs/pkiutil"
|
||||
configutil "k8s.io/kubernetes/cmd/kubeadm/app/util/config"
|
||||
certtestutil "k8s.io/kubernetes/cmd/kubeadm/test/certs"
|
||||
)
|
||||
|
||||
@@ -140,3 +142,13 @@ func AssertFileExists(t *testing.T, dirName string, fileNames ...string) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// GetDefaultInternalConfig returns a defaulted kubeadmapi.InitConfiguration
|
||||
func GetDefaultInternalConfig(t *testing.T) *kubeadmapi.InitConfiguration {
|
||||
internalcfg, err := configutil.ConfigFileAndDefaultsToInternalConfig("", &kubeadmapiv1alpha3.InitConfiguration{})
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error getting default config: %v", err)
|
||||
}
|
||||
|
||||
return internalcfg
|
||||
}
|
||||
|
Reference in New Issue
Block a user