Skip to content

Commit

Permalink
fix misspellings (#543)
Browse files Browse the repository at this point in the history
  • Loading branch information
eaudetcobello committed Jul 14, 2024
1 parent 28ffd37 commit a44e308
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/k8s/pkg/client/dqlite/remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func (c *Client) RemoveNodeByAddress(ctx context.Context, address string) error
return fmt.Errorf("cannot transfer dqlite leadership as there is no remaining spare node")
}

// Leadership can only be transfered to a voter or standby node.
// Leadership can only be transferred to a voter or standby node.
// Therefore the remaining node in the cluster needs to be promoted first.
if err := client.Assign(ctx, freeSpareNode.ID, Voter); err != nil {
return fmt.Errorf("failed to assign voter role to %d: %w", freeSpareNode.ID, err)
Expand Down
2 changes: 1 addition & 1 deletion src/k8s/pkg/client/dqlite/remove_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func TestRemoveNodeByAddress(t *testing.T) {
g.Expect(memberToRemove.Role).To(Equal(dqlite.Voter))
g.Expect(remainingNode.Role).To(Equal(dqlite.Spare))

// Removing the last voter should succeed and leadership should be transfered.
// Removing the last voter should succeed and leadership should be transferred.
g.Expect(client.RemoveNodeByAddress(ctx, memberToRemove.Address)).To(Succeed())

members, err = client.ListMembers(ctx)
Expand Down
12 changes: 6 additions & 6 deletions src/k8s/pkg/k8sd/setup/certificates.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
// It will delete the file if contents parameter is an empty string. Trying to ensure a inexistent file
// with an empty contents parameter does not result in an error.
// It returns true if any of these is true: the file's content changed, it was created or it was deleted.
// It also returns any error that occured.
// It also returns any error that occurred.
func ensureFile(fname string, contents string, uid, gid int, mode fs.FileMode) (bool, error) {
if contents == "" {
if err := os.Remove(fname); err != nil {
Expand Down Expand Up @@ -56,7 +56,7 @@ func ensureFile(fname string, contents string, uid, gid int, mode fs.FileMode) (
}

// ensureFiles calls ensureFile for many files.
// It returns true if one or more files were updated and any error that occured.
// It returns true if one or more files were updated and any error that occurred.
func ensureFiles(uid, gid int, mode fs.FileMode, files map[string]string) (bool, error) {
var changed bool
for fname, content := range files {
Expand All @@ -71,7 +71,7 @@ func ensureFiles(uid, gid int, mode fs.FileMode, files map[string]string) (bool,

// EnsureExtDatastorePKI ensures the external datastore PKI files are present
// and have the correct content, permissions and ownership.
// It returns true if one or more files were updated and any error that occured.
// It returns true if one or more files were updated and any error that occurred.
func EnsureExtDatastorePKI(snap snap.Snap, certificates *pki.ExternalDatastorePKI) (bool, error) {
return ensureFiles(snap.UID(), snap.GID(), 0600, map[string]string{
path.Join(snap.EtcdPKIDir(), "ca.crt"): certificates.DatastoreCACert,
Expand All @@ -82,7 +82,7 @@ func EnsureExtDatastorePKI(snap snap.Snap, certificates *pki.ExternalDatastorePK

// EnsureK8sDqlitePKI ensures the k8s dqlite PKI files are present
// and have the correct content, permissions and ownership.
// It returns true if one or more files were updated and any error that occured.
// It returns true if one or more files were updated and any error that occurred.
func EnsureK8sDqlitePKI(snap snap.Snap, certificates *pki.K8sDqlitePKI) (bool, error) {
return ensureFiles(snap.UID(), snap.GID(), 0600, map[string]string{
path.Join(snap.K8sDqliteStateDir(), "cluster.crt"): certificates.K8sDqliteCert,
Expand All @@ -92,7 +92,7 @@ func EnsureK8sDqlitePKI(snap snap.Snap, certificates *pki.K8sDqlitePKI) (bool, e

// EnsureControlPlanePKI ensures the control plane PKI files are present
// and have the correct content, permissions and ownership.
// It returns true if one or more files were updated and any error that occured.
// It returns true if one or more files were updated and any error that occurred.
func EnsureControlPlanePKI(snap snap.Snap, certificates *pki.ControlPlanePKI) (bool, error) {
return ensureFiles(snap.UID(), snap.GID(), 0600, map[string]string{
path.Join(snap.KubernetesPKIDir(), "apiserver-kubelet-client.crt"): certificates.APIServerKubeletClientCert,
Expand All @@ -114,7 +114,7 @@ func EnsureControlPlanePKI(snap snap.Snap, certificates *pki.ControlPlanePKI) (b

// EnsureWorkerPKI ensures the worker PKI files are present
// and have the correct content, permissions and ownership.
// It returns true if one or more files were updated and any error that occured.
// It returns true if one or more files were updated and any error that occurred.
func EnsureWorkerPKI(snap snap.Snap, certificates *pki.WorkerNodePKI) (bool, error) {
return ensureFiles(snap.UID(), snap.GID(), 0600, map[string]string{
path.Join(snap.KubernetesPKIDir(), "ca.crt"): certificates.CACert,
Expand Down
2 changes: 1 addition & 1 deletion src/k8s/pkg/snap/util/arguments.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func GetServiceArgument(s snap.Snap, serviceName string, argument string) (strin
// UpdateServiceArguments is a no-op if updateList and delete are empty.
// updateList is a map of key-value pairs. It will replace the argument with the new value (or just append).
// delete is a list of arguments to remove completely. The argument is removed if present.
// Returns a boolean whether any of the arguments were changed, as well as any errors that may have occured.
// Returns a boolean whether any of the arguments were changed, as well as any errors that may have occurred.
func UpdateServiceArguments(snap snap.Snap, serviceName string, updateMap map[string]string, deleteList []string) (bool, error) {
if updateMap == nil {
updateMap = map[string]string{}
Expand Down

0 comments on commit a44e308

Please sign in to comment.