提交 66e7acd3 编写于 作者: T Thomas Stromberg

Fix merge regression, add localpath functions for certs

上级 1295cc1c
......@@ -139,7 +139,7 @@ type CACerts struct {
func generateSharedCACerts() (CACerts, error) {
globalPath := localpath.MiniPath()
cc := CACerts{
caCert: filepath.Join(globalPath, "ca.crt"),
caCert: localpath.CACert(),
caKey: filepath.Join(globalPath, "ca.key"),
proxyCert: filepath.Join(globalPath, "proxy-client-ca.crt"),
proxyKey: filepath.Join(globalPath, "proxy-client-ca.key"),
......@@ -214,8 +214,8 @@ func generateProfileCerts(k8s config.KubernetesConfig, n config.Node, ccs CACert
caKeyPath string
}{
{ // Client cert
certPath: filepath.Join(profilePath, "client.crt"),
keyPath: filepath.Join(profilePath, "client.key"),
certPath: localpath.ClientCert(k8s.ClusterName),
keyPath: localpath.ClientKey(k8s.ClusterName),
subject: "minikube-user",
ips: []net.IP{},
alternateNames: []string{},
......
......@@ -59,6 +59,21 @@ func Profile(name string) string {
return filepath.Join(MiniPath(), "profiles", name)
}
// ClientCert returns client certificate path, used by kubeconfig
func ClientCert(name string) string {
return filepath.Join(Profile(name), "client.crt")
}
// ClientKey returns client certificate path, used by kubeconfig
func ClientKey(name string) string {
return filepath.Join(Profile(name), "client.key")
}
// CACert returns the minikube CA certificate shared between profiles
func CACert() string {
return filepath.Join(MiniPath(), "ca.crt")
}
// MachinePath returns the Minikube machine path of a machine
func MachinePath(machine string, miniHome ...string) string {
miniPath := MiniPath()
......
......@@ -250,9 +250,9 @@ func setupKubeconfig(h *host.Host, cc *config.ClusterConfig, n *config.Node, clu
kcs := &kubeconfig.Settings{
ClusterName: clusterName,
ClusterServerAddress: addr,
ClientCertificate: localpath.MakeMiniPath("client.crt"),
ClientKey: localpath.MakeMiniPath("client.key"),
CertificateAuthority: localpath.MakeMiniPath("ca.crt"),
ClientCertificate: localpath.ClientCert(cc.Name),
ClientKey: localpath.ClientKey(cc.Name),
CertificateAuthority: localpath.CACert(),
KeepContext: viper.GetBool(keepContext),
EmbedCerts: viper.GetBool(embedCerts),
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册