Fix typos in variable names and comments

Change-Id: I361916cc18c67e72fbfdbb4b6547f80a5d098327
This commit is contained in:
Ian H. Pittwood 2020-02-05 16:06:35 -06:00
parent 9dba7f7744
commit 8a3950d238
18 changed files with 46 additions and 46 deletions

View File

@ -142,7 +142,7 @@ func runSetCluster(o *config.ClusterOptions, rootSettings *environment.AirshipCT
// Update configuration file
// Just in time persistence approach
if err := airconfig.PersistConfig(); err != nil {
// Some warning here , that it didnt persit the changes because of this
// Some warning here , that it didnt persist the changes because of this
// Or should we float this up
// What would it mean? No value.
return clusterWasModified, err

View File

@ -60,7 +60,7 @@ func TestFlagLoading(t *testing.T) {
tt := tt
t.Run(tt.name, func(subTest *testing.T) {
// We don't care about the output of this test, so toss
// it into a thowaway &bytes.buffer{}
// it into a throwaway &bytes.buffer{}
rootCmd, settings, err := cmd.NewRootCmd(&bytes.Buffer{})
require.NoError(t, err)
rootCmd.SetArgs(tt.args)

View File

@ -9,7 +9,7 @@ import (
const (
// TODO (dukov) This should depend on cluster api version once it is
// fully available for Metal3. In other words:
// - Sectet for v1alpha1
// - Secret for v1alpha1
// - KubeAdmConfig for v1alpha2
EphemeralClusterConfKind = "Secret"
)

View File

@ -47,7 +47,7 @@ func GenerateBootstrapIso(settings *environment.AirshipCTLSettings, args []strin
}
// TODO (dukov) replace with the appropriate function once it's available
// in doncument module
// in document module
docBundle, err := document.NewBundle(fs.MakeRealFS(), manifest.TargetPath, "")
if err != nil {
return err
@ -111,14 +111,14 @@ func verifyArtifacts(cfg *config.Bootstrap) error {
}
func generateBootstrapIso(
docBubdle document.Bundle,
docBundle document.Bundle,
builder container.Container,
cfg *config.Bootstrap,
debug bool,
) error {
cntVol := strings.Split(cfg.Container.Volume, ":")[1]
log.Print("Creating cloud-init for ephemeral K8s")
userData, netConf, err := cloudinit.GetCloudData(docBubdle, document.EphemeralClusterMarker)
userData, netConf, err := cloudinit.GetCloudData(docBundle, document.EphemeralClusterMarker)
if err != nil {
return err
}

View File

@ -74,7 +74,7 @@ func TestBootstrapIso(t *testing.T) {
cfg *config.Bootstrap
debug bool
expectedOut []string
expectdErr error
expectedErr error
}{
{
builder: &mockContainer{
@ -83,7 +83,7 @@ func TestBootstrapIso(t *testing.T) {
cfg: testCfg,
debug: false,
expectedOut: []string{expOut[0], expOut[1]},
expectdErr: testErr,
expectedErr: testErr,
},
{
builder: &mockContainer{
@ -93,7 +93,7 @@ func TestBootstrapIso(t *testing.T) {
cfg: testCfg,
debug: true,
expectedOut: []string{expOut[0], expOut[1], expOut[2], expOut[3]},
expectdErr: nil,
expectedErr: nil,
},
{
builder: &mockContainer{
@ -104,7 +104,7 @@ func TestBootstrapIso(t *testing.T) {
cfg: testCfg,
debug: false,
expectedOut: []string{expOut[0], expOut[1], expOut[2], expOut[4]},
expectdErr: testErr,
expectedErr: testErr,
},
}
@ -118,7 +118,7 @@ func TestBootstrapIso(t *testing.T) {
assert.True(t, strings.Contains(actualOut, line))
}
assert.Equal(t, tt.expectdErr, actualErr)
assert.Equal(t, tt.expectedErr, actualErr)
}
}

View File

@ -51,7 +51,7 @@ func TestValidateCluster(t *testing.T) {
err = co.Validate()
assert.Error(t, err)
// Invalid Cluter Type
// Invalid Cluster Type
co.ClusterType = "Invalid"
err = co.Validate()
assert.Error(t, err)

View File

@ -184,7 +184,7 @@ func (c *Config) rmConfigClusterStragglers(persistIt bool) bool {
for cType, cluster := range c.Clusters[clusterName].ClusterTypes {
if _, found := c.kubeConfig.Clusters[cluster.NameInKubeconf]; !found {
// Instead of removing it , I could add a empty entry in kubeconfig as well
// Will see what is more appropriae with use of Modules configuration
// Will see what is more appropriate with use of Modules configuration
delete(c.Clusters[clusterName].ClusterTypes, cType)
// If that was the last cluster type, then we
@ -333,7 +333,7 @@ func (c *Config) EnsureComplete() error {
// If the file specified by ConfigFile does not exist it will create a new file.
func (c *Config) PersistConfig() error {
// Dont care if the file exists or not, will create if needed
// We are 100% overwriting the existsing file
// We are 100% overwriting the existing file
configyaml, err := c.ToYaml()
if err != nil {
return err
@ -421,7 +421,7 @@ func (c *Config) GetCluster(cName, cType string) (*Cluster, error) {
if !exists {
return nil, ErrMissingConfig{What: fmt.Sprintf("Cluster with name '%s' of type '%s'", cName, cType)}
}
// Alternative to this would be enhance Cluster.String() to embedd the appropriate kubeconfig cluster information
// Alternative to this would be enhance Cluster.String() to embed the appropriate kubeconfig cluster information
cluster, exists := c.Clusters[cName].ClusterTypes[cType]
if !exists {
return nil, ErrMissingConfig{What: fmt.Sprintf("Cluster with name '%s' of type '%s'", cName, cType)}

View File

@ -27,8 +27,8 @@ import (
// Top level config objects and all values required for proper functioning are not "omitempty".
// Any truly optional piece of config is allowed to be omitted.
// Config holds the information required by airshipct commands
// It is somewhat a superset of what akubeconfig looks like, we allow for this overlaps by providing
// Config holds the information required by airshipctl commands
// It is somewhat a superset of what a kubeconfig looks like, we allow for this overlaps by providing
// a mechanism to consume or produce a kubeconfig into / from the airship config.
type Config struct {
// +optional
@ -71,7 +71,7 @@ type Config struct {
kubeConfig *kubeconfig.Config
}
// Encapsultaes the Cluster Type as an enumeration
// Encapsulates the Cluster Type as an enumeration
type ClusterPurpose struct {
// Cluster map of referenceable names to cluster configs
ClusterTypes map[string]*Cluster `json:"cluster-type"`
@ -79,13 +79,13 @@ type ClusterPurpose struct {
// Cluster contains information about how to communicate with a kubernetes cluster
type Cluster struct {
// Complex cluster name defined by the using <cluster name>_<clustertype)
// Complex cluster name defined by the using <cluster name>_<cluster type>)
NameInKubeconf string `json:"cluster-kubeconf"`
// Kubeconfig Cluster Object
kCluster *kubeconfig.Cluster
// Boostrap configuration this clusters ephemral hosts will rely on
// Bootstrap configuration this clusters ephemeral hosts will rely on
Bootstrap string `json:"bootstrap-info"`
}
@ -122,7 +122,7 @@ type Manifest struct {
// Repositories is the map of repository adddressable by a name
Repositories map[string]*Repository `json:"repositories"`
// Local Targer path for working or home dirctory for all Manifest Cloned/Returned/Generated
// Local Target path for working or home directory for all Manifest Cloned/Returned/Generated
TargetPath string `json:"target-path"`
}
@ -130,7 +130,7 @@ type Manifest struct {
// Information such as location, authentication info,
// as well as details of what to get such as branch, tag, commit it, etc.
type Repository struct {
// URL for Repositor,
// URL for Repository
Url *url.URL `json:"url"`
// Username is the username for authentication to the repository .

View File

@ -5,7 +5,7 @@ import (
"io"
)
// Container interface abstracion for continer.
// Container interface abstraction for container.
// Particular implementation depends on container runtime environment (CRE). Interface
// defines methods that must be implemented for CRE (e.g. docker, containerd or CRI-O)
type Container interface {
@ -17,7 +17,7 @@ type Container interface {
}
// NewContainer returns instance of Container interface implemented by particular driver
// Returned instance type (i.e. implementation) depends on driver sceified via function
// Returned instance type (i.e. implementation) depends on driver specified via function
// arguments (e.g. "docker").
// Supported drivers:
// * docker

View File

@ -58,7 +58,7 @@ type DockerClient interface {
string,
container.WaitCondition,
) (<-chan container.ContainerWaitOKBody, <-chan error)
// ContainerLogs returns the logs generated by a continer in an
// ContainerLogs returns the logs generated by a container in an
// io.ReadCloser.
ContainerLogs(
context.Context,
@ -166,7 +166,7 @@ func (c *DockerContainer) getConfig(
return cCfg, hCfg
}
// getImageId return ID of continer image specified by URL. Method executes
// getImageId return ID of container image specified by URL. Method executes
// ImageList function supplied with "reference" filter
func (c *DockerContainer) getImageId(url string) (string, error) {
kv := filters.KeyValuePair{
@ -277,11 +277,11 @@ func (c *DockerContainer) RunCommand(
// set to false explicitly
func (c *DockerContainer) RunCommandOutput(
cmd []string,
continerInput io.Reader,
containerInput io.Reader,
volumeMounts []string,
envVars []string,
) (io.ReadCloser, error) {
if err := c.RunCommand(cmd, continerInput, volumeMounts, envVars, false); err != nil {
if err := c.RunCommand(cmd, containerInput, volumeMounts, envVars, false); err != nil {
return nil, err
}

View File

@ -242,13 +242,13 @@ func TestGetId(t *testing.T) {
cnt := getDockerContainerMock(mockDockerClient{})
err := cnt.RunCommand([]string{"testCmd"}, nil, nil, []string{}, false)
require.NoError(t, err)
actialId := cnt.GetId()
actualId := cnt.GetId()
assert.Equal(t, "testID", actialId)
assert.Equal(t, "testID", actualId)
}
func TestRunCommand(t *testing.T) {
imageListeError := fmt.Errorf("Image List Error")
imageListError := fmt.Errorf("Image List Error")
attachError := fmt.Errorf("Attach error")
containerStartError := fmt.Errorf("Container Start error")
containerWaitError := fmt.Errorf("Container Wait Error")
@ -277,10 +277,10 @@ func TestRunCommand(t *testing.T) {
debug: false,
mockDockerClient: mockDockerClient{
imageList: func() ([]types.ImageSummary, error) {
return nil, imageListeError
return nil, imageListError
},
},
expectedErr: imageListeError,
expectedErr: imageListError,
assertF: func(t *testing.T) {},
},
{
@ -467,17 +467,17 @@ func TestNewDockerContainer(t *testing.T) {
assert.Equal(t, tt.expectedErr, actualErr)
var actualResStuct resultStruct
var actualResStruct resultStruct
if actualRes == nil {
actualResStuct = resultStruct{}
actualResStruct = resultStruct{}
} else {
actualResStuct = resultStruct{
actualResStruct = resultStruct{
tag: actualRes.tag,
imageUrl: actualRes.imageUrl,
id: actualRes.id,
}
}
assert.Equal(t, tt.expectedResult, actualResStuct)
assert.Equal(t, tt.expectedResult, actualResStruct)
}
}

View File

@ -9,7 +9,7 @@ type ErrEmptyImageList struct {
}
func (e ErrEmptyImageList) Error() string {
return "Image List Error. No images filetered"
return "Image List Error. No images filtered"
}
// ErrRunContainerCommand returned if container command

View File

@ -1,6 +1,6 @@
package document
// Document lables and annotations
// Document labels and annotations
const (
ClusterType = "clustertype"
// TODO (dukov) Replace with constants defined in config module once

View File

@ -27,7 +27,7 @@ const (
var (
ErrNoOpenRepo = errors.New("No open repository is stored")
ErrRemoteRefNotImplemented = errors.New("RemoteRef is not yet impletemented")
ErrRemoteRefNotImplemented = errors.New("RemoteRef is not yet implemented")
ErrCantParseUrl = errors.New("Couldn't get target directory from URL")
)

View File

@ -75,9 +75,9 @@ func (a *AirshipCTLSettings) InitConfig() {
}
func (a *AirshipCTLSettings) setAirshipConfigPath() {
// (1) If the airshipConfigPath was received as an argument its aleady set
// (1) If the airshipConfigPath was received as an argument its already set
if a.airshipConfigPath == "" {
// (2) If not , we can check if we got the Path via ENVIRONMNT variable,
// (2) If not , we can check if we got the Path via ENVIRONMENT variable,
// set the appropriate fields
a.setAirshipConfigPathFromEnv()
}
@ -101,7 +101,7 @@ func (a *AirshipCTLSettings) setKubePathOptions() *clientcmd.PathOptions {
kubePathOptions := clientcmd.NewDefaultPathOptions()
// No need to check the Environment , since we are relying on the kubeconfig defaults
// If we did not get an explicit kubeconfig definition on airshipctl
// as far as airshipctkl is concerned will use the default expectations for the kubeconfig
// as far as airshipctl is concerned will use the default expectations for the kubeconfig
// file location . This avoids messing up someones kubeconfig if they didnt explicitly want
// airshipctl to use it.
kcp, home := a.replaceHomePlaceholder(a.kubeConfigPath)

View File

@ -7,7 +7,7 @@ type AirshipError struct {
Message string
}
// Error function implments the golang
// Error function implements the golang
// error interface
func (ae *AirshipError) Error() string {
return ae.Message

View File

@ -14,7 +14,7 @@ type Source struct{}
var _ rand.Source = &Source{}
// Uint64 returns a secure random uint64 in the range [0, 1<<64]. It will fail
// if an error is returned from the system's secure random numer generator
// if an error is returned from the system's secure random number generator
func (s *Source) Uint64() uint64 {
var value uint64
err := binary.Read(crypto.Reader, binary.BigEndian, &value)

View File

@ -13,7 +13,7 @@ const (
DashYamlSeparator = "---\n"
)
// WriteOut dumps any yaml competible document to writer, adding yaml separator `---`
// WriteOut dumps any yaml compatible document to writer, adding yaml separator `---`
// at the beginning of the document, and `...` at the end
func WriteOut(dst io.Writer, src interface{}) error {
yamlOut, err := yaml.Marshal(src)