Fix kubeadm typos

This commit is contained in:
Nathan Baulch 2024-08-11 09:22:30 +10:00
parent e5bafe2bed
commit ad7cb45bb2
No known key found for this signature in database
36 changed files with 55 additions and 55 deletions

View File

@ -338,7 +338,7 @@ type JoinConfiguration struct {
NodeRegistration NodeRegistrationOptions
// CACertPath is the path to the SSL certificate authority used to
// secure comunications between node and control-plane.
// secure communications between node and control-plane.
// Defaults to "/etc/kubernetes/pki/ca.crt".
CACertPath string

View File

@ -322,7 +322,7 @@ type JoinConfiguration struct {
NodeRegistration NodeRegistrationOptions `json:"nodeRegistration,omitempty"`
// CACertPath is the path to the SSL certificate authority used to
// secure comunications between node and control-plane.
// secure communications between node and control-plane.
// Defaults to "/etc/kubernetes/pki/ca.crt".
// +optional
CACertPath string `json:"caCertPath,omitempty"`

View File

@ -63,7 +63,7 @@ func Convert_v1beta4_JoinConfiguration_To_kubeadm_JoinConfiguration(in *JoinConf
return err
}
// Convert_kubeadm_JoinConfiguration_To_v1beta4_JoinConfiguration converts a private JoinConfinguration to a public JoinCOnfiguration.
// Convert_kubeadm_JoinConfiguration_To_v1beta4_JoinConfiguration converts a private JoinConfiguration to a public JoinConfiguration.
func Convert_kubeadm_JoinConfiguration_To_v1beta4_JoinConfiguration(in *kubeadm.JoinConfiguration, out *JoinConfiguration, s conversion.Scope) error {
err := autoConvert_kubeadm_JoinConfiguration_To_v1beta4_JoinConfiguration(in, out, s)
timeoutControlPlane := kubeadm.GetConversionTimeoutControlPlane() // Remove with v1beta3.

View File

@ -371,7 +371,7 @@ type JoinConfiguration struct {
NodeRegistration NodeRegistrationOptions `json:"nodeRegistration,omitempty"`
// CACertPath is the path to the SSL certificate authority used to
// secure comunications between node and control-plane.
// secure communications between node and control-plane.
// Defaults to "/etc/kubernetes/pki/ca.crt".
// +optional
CACertPath string `json:"caCertPath,omitempty"`

View File

@ -1067,7 +1067,7 @@ func TestValidateSocketPath(t *testing.T) {
{name: "valid socket URL", criSocket: kubeadmapiv1.DefaultContainerRuntimeURLScheme + "://" + "/some/path", expectedErrors: false},
{name: "unsupported URL scheme", criSocket: "bla:///some/path", expectedErrors: true},
{name: "missing URL scheme", criSocket: "/some/path", expectedErrors: true},
{name: "unparseable URL", criSocket: ":::", expectedErrors: true},
{name: "unparsable URL", criSocket: ":::", expectedErrors: true},
{name: "empty CRISocket", criSocket: "", expectedErrors: true},
}
for _, tc := range tests {

View File

@ -59,7 +59,7 @@ var (
`)
joinControPlaneDoneTemp = template.Must(template.New("join").Parse(dedent.Dedent(`
joinControlPlaneDoneTemp = template.Must(template.New("join").Parse(dedent.Dedent(`
This node has joined the cluster and a new control plane instance was created:
* Certificate signing request was sent to apiserver and approval was received.
@ -196,7 +196,7 @@ func newCmdJoin(out io.Writer, joinOptions *joinOptions) *cobra.Command {
"KubeConfigPath": kubeadmconstants.GetAdminKubeConfigPath(),
"etcdMessage": etcdMessage,
}
if err := joinControPlaneDoneTemp.Execute(data.outputWriter, ctx); err != nil {
if err := joinControlPlaneDoneTemp.Execute(data.outputWriter, ctx); err != nil {
return err
}

View File

@ -88,7 +88,7 @@ func runBootstrapToken(c workflow.RunData) error {
return errors.Wrap(err, "error updating or creating token")
}
// Create RBAC rules that makes the bootstrap tokens able to get nodes
if err := nodebootstraptokenphase.AllowBoostrapTokensToGetNodes(client); err != nil {
if err := nodebootstraptokenphase.AllowBootstrapTokensToGetNodes(client); err != nil {
return errors.Wrap(err, "error allowing bootstrap tokens to get Nodes")
}
// Create RBAC rules that makes the bootstrap tokens able to post CSRs

View File

@ -54,7 +54,7 @@ type Phase struct {
RunAllSiblings bool
// Run defines a function implementing the phase action.
// It is recommended to implent type assertion, e.g. using golang type switch,
// It is recommended to implement type assertion, e.g. using golang type switch,
// for validating the RunData type.
Run func(data RunData) error

View File

@ -284,7 +284,7 @@ func (e *Runner) Help(cmdUse string) string {
})
// prints the list of phases indented by level and formatted using the maxlength
// the list is enclosed in a mardown code block for ensuring better readability in the public web site
// the list is enclosed in a markdown code block for ensuring better readability in the public web site
line := fmt.Sprintf("The %q command executes the following phases:\n", cmdUse)
line += "```\n"
offset := 2

View File

@ -271,12 +271,12 @@ func TestGetClientSet(t *testing.T) {
defer os.RemoveAll(tmpDir)
fullPath := filepath.Join(tmpDir, testConfigTokenFile)
// test dryRun = false on a non-exisiting file
// test dryRun = false on a non-existing file
if _, err = cmdutil.GetClientSet(fullPath, false); err == nil {
t.Errorf("GetClientSet(); dry-run: false; did no fail for test file %q: %v", fullPath, err)
}
// test dryRun = true on a non-exisiting file
// test dryRun = true on a non-existing file
if _, err = cmdutil.GetClientSet(fullPath, true); err == nil {
t.Errorf("GetClientSet(); dry-run: true; did no fail for test file %q: %v", fullPath, err)
}
@ -291,7 +291,7 @@ func TestGetClientSet(t *testing.T) {
t.Errorf("Unable to write test file %q: %v", fullPath, err)
}
// test dryRun = true on an exisiting file
// test dryRun = true on an existing file
if _, err = cmdutil.GetClientSet(fullPath, true); err != nil {
t.Errorf("GetClientSet(); dry-run: true; failed for test file %q: %v", fullPath, err)
}

View File

@ -279,7 +279,7 @@ func TestConfigBaseMarshal(t *testing.T) {
`, kubeadmapiv1.SchemeGroupVersion.String())))
if expected != got {
t.Fatalf("Missmatch between expected and got:\nExpected:\n%s\n---\nGot:\n%s", expected, got)
t.Fatalf("Mismatch between expected and got:\nExpected:\n%s\n---\nGot:\n%s", expected, got)
}
})
}
@ -332,7 +332,7 @@ func TestGeneratedConfigFromCluster(t *testing.T) {
hash: testYAMLHash,
},
{
name: "Missmatching hash means user supplied config",
name: "Mismatching hash means user supplied config",
hash: mismatchHash,
userSupplied: true,
},

View File

@ -230,7 +230,7 @@ func TestKubeletDefault(t *testing.T) {
got.Default(&test.clusterCfg, &kubeadmapi.APIEndpoint{}, &kubeadmapi.NodeRegistrationOptions{})
if !reflect.DeepEqual(got, &expected) {
t.Fatalf("Missmatch between expected and got:\nExpected:\n%v\n---\nGot:\n%v", expected, *got)
t.Fatalf("Mismatch between expected and got:\nExpected:\n%v\n---\nGot:\n%v", expected, *got)
}
})
}

View File

@ -75,7 +75,7 @@ func TestMutateResolverConfig(t *testing.T) {
t.Fatalf("failed to mutate ResolverConfig for KubeletConfiguration, %v", err)
}
if !reflect.DeepEqual(test.cfg, test.expected) {
t.Errorf("Missmatch between expected and got:\nExpected:\n%+v\n---\nGot:\n%+v",
t.Errorf("Mismatch between expected and got:\nExpected:\n%+v\n---\nGot:\n%+v",
test.expected, test.cfg)
}
})

View File

@ -85,7 +85,7 @@ func TestMutatePaths(t *testing.T) {
t.Run(test.name, func(t *testing.T) {
mutatePaths(test.cfg, drive)
if !reflect.DeepEqual(test.cfg, test.expected) {
t.Errorf("Missmatch between expected and got:\nExpected:\n%+v\n---\nGot:\n%+v",
t.Errorf("Mismatch between expected and got:\nExpected:\n%+v\n---\nGot:\n%+v",
test.expected, test.cfg)
}
})

View File

@ -118,7 +118,7 @@ func TestKubeProxyDefault(t *testing.T) {
}
got.Default(&test.clusterCfg, &test.endpoint, &kubeadmapi.NodeRegistrationOptions{})
if !reflect.DeepEqual(got, &expected) {
t.Fatalf("Missmatch between expected and got:\nExpected:\n%v\n---\nGot:\n%v", expected, got)
t.Fatalf("Mismatch between expected and got:\nExpected:\n%v\n---\nGot:\n%v", expected, got)
}
})
}

View File

@ -195,7 +195,7 @@ const (
// KubeletBaseConfigMapRole defines the base kubelet configuration ConfigMap.
KubeletBaseConfigMapRole = "kubeadm:kubelet-config"
// KubeProxyClusterRoleBindingName sets the name for the kube-proxy CluterRoleBinding
// KubeProxyClusterRoleBindingName sets the name for the kube-proxy ClusterRoleBinding
KubeProxyClusterRoleBindingName = "kubeadm:node-proxier"
// NodeKubeletBootstrap defines the name of the ClusterRoleBinding that lets kubelets post CSRs
NodeKubeletBootstrap = "kubeadm:kubelet-bootstrap"
@ -236,7 +236,7 @@ const (
// KubeletHealthCheckTimeout specifies the default kubelet timeout
KubeletHealthCheckTimeout = 4 * time.Minute
// UpgradeManifestsTimeout specifies the default timeout for upgradring static Pod manifests
// UpgradeManifestsTimeout specifies the default timeout for upgrading static Pod manifests
UpgradeManifestsTimeout = 5 * time.Minute
// PullImageRetry specifies how many times ContainerRuntime retries when pulling image failed

View File

@ -61,13 +61,13 @@ func For(cfg *kubeadmapi.JoinConfiguration) (*clientcmdapi.Config, error) {
), nil
}
// if the config returned from discovery has authentication credentials, proceed with the TLS boostrap process
// if the config returned from discovery has authentication credentials, proceed with the TLS bootstrap process
if kubeconfigutil.HasAuthenticationCredentials(config) {
return config, nil
}
// if there are no authentication credentials (nor in the config returned from discovery, nor in the TLSBootstrapToken), fail
return nil, errors.New("couldn't find authentication credentials for the TLS boostrap process. Please use Token discovery, a discovery file with embedded authentication credentials or a discovery file without authentication credentials but with the TLSBootstrapToken flag")
return nil, errors.New("couldn't find authentication credentials for the TLS bootstrap process. Please use Token discovery, a discovery file with embedded authentication credentials or a discovery file without authentication credentials but with the TLSBootstrapToken flag")
}
// DiscoverValidatedKubeConfig returns a validated Config object that specifies where the cluster is and the CA cert to trust

View File

@ -49,8 +49,8 @@ func AllowBootstrapTokensToPostCSRs(client clientset.Interface) error {
})
}
// AllowBoostrapTokensToGetNodes creates RBAC rules to allow Node Bootstrap Tokens to list nodes
func AllowBoostrapTokensToGetNodes(client clientset.Interface) error {
// AllowBootstrapTokensToGetNodes creates RBAC rules to allow Node Bootstrap Tokens to list nodes
func AllowBootstrapTokensToGetNodes(client clientset.Interface) error {
fmt.Println("[bootstrap-token] Configured RBAC rules to allow Node Bootstrap tokens to get nodes")
if err := apiclient.CreateOrUpdateClusterRole(client, &rbac.ClusterRole{

View File

@ -198,7 +198,7 @@ func TestAutoApproveNodeCertificateRotation(t *testing.T) {
}
}
func TestAllowBoostrapTokensToGetNodes(t *testing.T) {
func TestAllowBootstrapTokensToGetNodes(t *testing.T) {
tests := []struct {
name string
client clientset.Interface
@ -270,8 +270,8 @@ func TestAllowBoostrapTokensToGetNodes(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if err := AllowBoostrapTokensToGetNodes(tt.client); err != nil {
t.Errorf("AllowBoostrapTokensToGetNodes() return error = %v", err)
if err := AllowBootstrapTokensToGetNodes(tt.client); err != nil {
t.Errorf("AllowBootstrapTokensToGetNodes() return error = %v", err)
}
})
}

View File

@ -184,7 +184,7 @@ func TestRenewUsingLocalCA(t *testing.T) {
}
if !newCert.NotAfter.After(cert.NotAfter) {
t.Fatalf("expected new certificate with updated expiration, but renewed certificate has same NotAfter value: saw %s, expected greather than %s", newCert.NotAfter, cert.NotAfter)
t.Fatalf("expected new certificate with updated expiration, but renewed certificate has same NotAfter value: saw %s, expected greater than %s", newCert.NotAfter, cert.NotAfter)
}
certtestutil.AssertCertificateIsSignedByCa(t, newCert, testCACert)

View File

@ -179,7 +179,7 @@ func getAPIServerCommand(cfg *kubeadmapi.ClusterConfiguration, localAPIEndpoint
{Name: "secure-port", Value: fmt.Sprintf("%d", localAPIEndpoint.BindPort)},
{Name: "allow-privileged", Value: "true"},
{Name: "kubelet-preferred-address-types", Value: "InternalIP,ExternalIP,Hostname"},
// add options to configure the front proxy. Without the generated client cert, this will never be useable
// add options to configure the front proxy. Without the generated client cert, this will never be usable
// so add it unconditionally with recommended values
{Name: "requestheader-username-headers", Value: "X-Remote-User"},
{Name: "requestheader-group-headers", Value: "X-Remote-Group"},

View File

@ -636,7 +636,7 @@ func errorDiffArguments(t *testing.T, name string, actual, expected []string) {
}
// removeCommon removes common items from left list
// makes compairing two cmdline (with lots of arguments) easier
// makes comparing two cmdline (with lots of arguments) easier
func removeCommon(left, right []string) []string {
origSet := sets.New(left...)
origSet.Delete(right...)

View File

@ -85,7 +85,7 @@ func CreateCertificateKey() (string, error) {
return hex.EncodeToString(randBytes), nil
}
// UploadCerts save certs needs to join a new control-plane on kubeadm-certs sercret.
// UploadCerts save certs needs to join a new control-plane on kubeadm-certs secret.
func UploadCerts(client clientset.Interface, cfg *kubeadmapi.InitConfiguration, key string) error {
fmt.Printf("[upload-certs] Storing the certificates in Secret %q in the %q Namespace\n", kubeadmconstants.KubeadmCertsSecret, metav1.NamespaceSystem)
decodedKey, err := hex.DecodeString(key)

View File

@ -94,7 +94,7 @@ func GetAvailableUpgrades(versionGetterImpl VersionGetter, experimentalUpgradesA
" nodes to the same version of Kubernetes", strings.Join(verMsg, ", "))
}
// Get the lastest cluster version
// Get the latest cluster version
clusterVersion, err := getLatestClusterVersion(kubeAPIServerVersions)
if err != nil {
return upgrades, err

View File

@ -127,7 +127,7 @@ const fakeCurrentCoreDNSVersion = "1.0.6"
func TestGetAvailableUpgrades(t *testing.T) {
// constansts for test cases
// constants for test cases
// variables are in the form v{MAJOR}{MINOR}{PATCH}, where MINOR is a variable so test are automatically uptodate to the latest MinimumControlPlaneVersion/
// v1.X series, e.g. v1.14

View File

@ -78,7 +78,7 @@ func PerformPostUpgradeTasks(client clientset.Interface, cfg *kubeadmapi.InitCon
}
// Create RBAC rules that makes the bootstrap tokens able to get nodes
if err := nodebootstraptoken.AllowBoostrapTokensToGetNodes(client); err != nil {
if err := nodebootstraptoken.AllowBootstrapTokensToGetNodes(client); err != nil {
errs = append(errs, err)
}
@ -186,7 +186,7 @@ func PerformAddonsUpgrade(client clientset.Interface, cfg *kubeadmapi.InitConfig
return errorsutil.NewAggregate(errs)
}
// unupgradedControlPlaneInstances returns a list of control palne instances that have not yet been upgraded.
// unupgradedControlPlaneInstances returns a list of control plane instances that have not yet been upgraded.
//
// NB. This function can only be called after the current control plane instance has been upgraded already.
// Because it determines whether the other control plane instances have been upgraded by checking whether
@ -325,7 +325,7 @@ func UpdateKubeletLocalMode(cfg *kubeadmapi.InitConfiguration, dryRun bool) erro
return err
}
// Skip changing kubeconfig file if Server does not match the ControlPlaneEndoint.
// Skip changing kubeconfig file if Server does not match the ControlPlaneEndpoint.
if config.Clusters[configContext.Cluster].Server != controlPlaneAPIEndpoint || controlPlaneAPIEndpoint == localAPIEndpoint {
klog.V(2).Infof("Skipping update of the Server URL in %s, because it's already not equal to %q or already matches the localAPIEndpoint", kubeletKubeConfigFilePath, cfg.ControlPlaneEndpoint)
return nil

View File

@ -60,11 +60,11 @@ type StaticPodPathManager interface {
TempManifestPath(component string) string
// TempManifestDir should point to the temporary directory created for generating new manifests for the upgrade
TempManifestDir() string
// BackupManifestPath gets the file path for the component in the backup directory used for backuping manifests during the transition
// BackupManifestPath gets the file path for the component in the backup directory used for backing up manifests during the transition
BackupManifestPath(component string) string
// BackupManifestDir should point to the backup directory used for backuping manifests during the transition
// BackupManifestDir should point to the backup directory used for backing up manifests during the transition
BackupManifestDir() string
// BackupEtcdDir should point to the backup directory used for backuping manifests during the transition
// BackupEtcdDir should point to the backup directory used for backing up manifests during the transition
BackupEtcdDir() string
// CleanupDirs cleans up all temporary directories
CleanupDirs() error
@ -151,17 +151,17 @@ func (spm *KubeStaticPodPathManager) TempManifestDir() string {
return spm.tempManifestDir
}
// BackupManifestPath gets the file path for the component in the backup directory used for backuping manifests during the transition
// BackupManifestPath gets the file path for the component in the backup directory used for backing up manifests during the transition
func (spm *KubeStaticPodPathManager) BackupManifestPath(component string) string {
return constants.GetStaticPodFilepath(component, spm.backupManifestDir)
}
// BackupManifestDir should point to the backup directory used for backuping manifests during the transition
// BackupManifestDir should point to the backup directory used for backing up manifests during the transition
func (spm *KubeStaticPodPathManager) BackupManifestDir() string {
return spm.backupManifestDir
}
// BackupEtcdDir should point to the backup directory used for backuping manifests during the transition
// BackupEtcdDir should point to the backup directory used for backing up manifests during the transition
func (spm *KubeStaticPodPathManager) BackupEtcdDir() string {
return spm.backupEtcdDir
}

View File

@ -792,7 +792,7 @@ func TestRenewCertsByComponent(t *testing.T) {
t.Run(test.name, func(t *testing.T) {
pkiutiltesting.Reset()
// Setup up basic requities
// Setup up basic requisites
tmpDir := testutil.SetupTempDir(t)
defer os.RemoveAll(tmpDir)

View File

@ -72,7 +72,7 @@ func (g *KubeVersionGetter) ClusterVersion() (string, *versionutil.Version, erro
// common.go#getClient()
// The problem here is that during upgrade dry-run client reactors are backed by a dynamic client
// via NewClientBackedDryRunGetterFromKubeconfig() and for GetActions there seems to be no analog to
// Discovery().Serverversion() resource for a dynamic client(?).
// Discovery().ServerVersion() resource for a dynamic client(?).
fakeclientDiscovery, ok := g.client.Discovery().(*fakediscovery.FakeDiscovery)
if ok {
clusterVersionInfo = fakeclientDiscovery.FakedServerVersion

View File

@ -110,7 +110,7 @@ func validateSupportedVersion(gvk schema.GroupVersionKind, allowDeprecated, allo
// NormalizeKubernetesVersion resolves version labels, sets alternative
// image registry if requested for CI builds, and validates minimal
// version that kubeadm SetInitDynamicDefaultssupports.
// version that kubeadm SetInitDynamicDefaults supports.
func NormalizeKubernetesVersion(cfg *kubeadmapi.ClusterConfiguration) error {
isCIVersion := kubeadmutil.KubernetesIsCIVersion(cfg.KubernetesVersion)

View File

@ -24,7 +24,7 @@ import (
"k8s.io/apimachinery/pkg/runtime/serializer/json"
)
// VerifyUnmarshalStrict takes a slice of schems, a JSON/YAML byte slice and a GroupVersionKind
// VerifyUnmarshalStrict takes a slice of schemes, a JSON/YAML byte slice and a GroupVersionKind
// and verifies if the schema is known and if the byte slice unmarshals with strict mode.
func VerifyUnmarshalStrict(schemes []*runtime.Scheme, gvk schema.GroupVersionKind, bytes []byte) error {
var scheme *runtime.Scheme

View File

@ -104,7 +104,7 @@ func TestDocMapToUpgradeConfiguration(t *testing.T) {
}
docmap, err := kubeadmutil.SplitYAMLDocuments(b)
if err != nil {
t.Fatalf("Unexpect error of SplitYAMLDocuments: %v", err)
t.Fatalf("Unexpected error of SplitYAMLDocuments: %v", err)
}
cfg, err := DocMapToUpgradeConfiguration(docmap)
if err != nil {

View File

@ -439,14 +439,14 @@ func TestGroupVersionKindsHasClusterConfiguration(t *testing.T) {
expected bool
}{
{
name: "does not have ClusterConfiguraiton",
name: "does not have ClusterConfiguration",
gvks: []schema.GroupVersionKind{
{Group: "foo.k8s.io", Version: "v1", Kind: "Foo"},
},
expected: false,
},
{
name: "has ClusterConfiguraiton",
name: "has ClusterConfiguration",
gvks: []schema.GroupVersionKind{
{Group: "foo.k8s.io", Version: "v1", Kind: "Foo"},
{Group: "foo.k8s.io", Version: "v1", Kind: "ClusterConfiguration"},

View File

@ -517,7 +517,7 @@ func NewCSR(cfg CertConfig, key crypto.Signer) (*x509.CertificateRequest, error)
return x509.ParseCertificateRequest(csrBytes)
}
// EncodeCertPEM returns PEM-endcoded certificate data
// EncodeCertPEM returns PEM-encoded certificate data
func EncodeCertPEM(cert *x509.Certificate) []byte {
block := pem.Block{
Type: CertificateBlockType,
@ -526,7 +526,7 @@ func EncodeCertPEM(cert *x509.Certificate) []byte {
return pem.EncodeToMemory(&block)
}
// EncodeCertBundlePEM returns PEM-endcoded certificate bundle
// EncodeCertBundlePEM returns PEM-encoded certificate bundle
func EncodeCertBundlePEM(certs []*x509.Certificate) ([]byte, error) {
buf := bytes.Buffer{}

View File

@ -53,7 +53,7 @@ type UsersAndGroups struct {
}
// entry is a structure that holds information about a UNIX user or group.
// It partialially conforms parsing of both users from /etc/passwd and groups from /etc/group.
// It partially conforms parsing of both users from /etc/passwd and groups from /etc/group.
type entry struct {
name string
id int64
@ -568,7 +568,7 @@ func entriesToString(entries []*entry) string {
return strings.Join(lines, ",")
}
// openFileWithLock opens the file at path by acquiring an exclive write lock.
// openFileWithLock opens the file at path by acquiring an exclusive write lock.
// The returned close() function should be called to release the lock and close the file.
// If a lock cannot be obtained the function fails after a period of time.
func openFileWithLock(path string) (f *os.File, close func(), err error) {