Commit 01b9d496 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #38677 from bruceauyeung/k8s-branch-fix-typos-and-comments

Automatic merge from submit-queue path.Clean paths in GlobalEnvParams and remove unnecessary path.Join **What this PR does / why we need it**: 1. clean all paths in `GlobalEnvParams` 1. remove unnecessary path.Join call in `pki.go` 2. fix some typos and comment errors Signed-off-by: 's avatarbruceauyeung <ouyang.qinhua@zte.com.cn>
parents 5b2823ad 02c18141
...@@ -19,6 +19,7 @@ package kubeadm ...@@ -19,6 +19,7 @@ package kubeadm
import ( import (
"fmt" "fmt"
"os" "os"
"path"
"runtime" "runtime"
"strings" "strings"
) )
...@@ -46,9 +47,9 @@ func SetEnvParams() *EnvParams { ...@@ -46,9 +47,9 @@ func SetEnvParams() *EnvParams {
} }
return &EnvParams{ return &EnvParams{
KubernetesDir: envParams["kubernetes_dir"], KubernetesDir: path.Clean(envParams["kubernetes_dir"]),
HostPKIPath: envParams["host_pki_path"], HostPKIPath: path.Clean(envParams["host_pki_path"]),
HostEtcdPath: envParams["host_etcd_path"], HostEtcdPath: path.Clean(envParams["host_etcd_path"]),
HyperkubeImage: envParams["hyperkube_image"], HyperkubeImage: envParams["hyperkube_image"],
RepositoryPrefix: envParams["repo_prefix"], RepositoryPrefix: envParams["repo_prefix"],
DiscoveryImage: envParams["discovery_image"], DiscoveryImage: envParams["discovery_image"],
......
...@@ -67,7 +67,7 @@ func encodeKubeDiscoverySecretData(dcfg *kubeadmapi.TokenDiscovery, apicfg kubea ...@@ -67,7 +67,7 @@ func encodeKubeDiscoverySecretData(dcfg *kubeadmapi.TokenDiscovery, apicfg kubea
func newKubeDiscoveryPodSpec(cfg *kubeadmapi.MasterConfiguration) v1.PodSpec { func newKubeDiscoveryPodSpec(cfg *kubeadmapi.MasterConfiguration) v1.PodSpec {
return v1.PodSpec{ return v1.PodSpec{
// We have to use host network namespace, as `HostPort`/`HostIP` are Docker's // We have to use host network namespace, as `HostPort`/`HostIP` are Docker's
// buisness and CNI support isn't quite there yet (except for kubenet) // business and CNI support isn't quite there yet (except for kubenet)
// (see https://github.com/kubernetes/kubernetes/issues/31307) // (see https://github.com/kubernetes/kubernetes/issues/31307)
// TODO update this when #31307 is resolved // TODO update this when #31307 is resolved
HostNetwork: true, HostNetwork: true,
......
...@@ -158,7 +158,7 @@ func CreatePKIAssets(cfg *kubeadmapi.MasterConfiguration) (*rsa.PrivateKey, *x50 ...@@ -158,7 +158,7 @@ func CreatePKIAssets(cfg *kubeadmapi.MasterConfiguration) (*rsa.PrivateKey, *x50
} }
altNames.DNSNames = append(altNames.DNSNames, cfg.API.ExternalDNSNames...) altNames.DNSNames = append(altNames.DNSNames, cfg.API.ExternalDNSNames...)
pkiPath := path.Join(kubeadmapi.GlobalEnvParams.HostPKIPath) pkiPath := kubeadmapi.GlobalEnvParams.HostPKIPath
caKey, caCert, err := newCertificateAuthority() caKey, caCert, err := newCertificateAuthority()
if err != nil { if err != nil {
......
...@@ -126,7 +126,7 @@ func createClients(caCert []byte, endpoint, token string, nodeName types.NodeNam ...@@ -126,7 +126,7 @@ func createClients(caCert []byte, endpoint, token string, nodeName types.NodeNam
return clientSet, nil return clientSet, nil
} }
// check to see if there are other nodes in the cluster with identical node names. // CheckForNodeNameDuplicates checks whether there are other nodes in the cluster with identical node names.
func CheckForNodeNameDuplicates(connection *ConnectionDetails) error { func CheckForNodeNameDuplicates(connection *ConnectionDetails) error {
hostName, err := os.Hostname() hostName, err := os.Hostname()
if err != nil { if err != nil {
......
...@@ -28,7 +28,7 @@ func TestEmptyVersion(t *testing.T) { ...@@ -28,7 +28,7 @@ func TestEmptyVersion(t *testing.T) {
ver, err := KubernetesReleaseVersion("") ver, err := KubernetesReleaseVersion("")
if err == nil { if err == nil {
t.Error("KubernetesReleaseVersion returned succesfully, but error expected") t.Error("KubernetesReleaseVersion returned successfully, but error expected")
} }
if ver != "" { if ver != "" {
t.Error("KubernetesReleaseVersion returned value, expected only error") t.Error("KubernetesReleaseVersion returned value, expected only error")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment