diff --git a/cmd/sealctl/cmd/static_pod.go b/cmd/sealctl/cmd/static_pod.go index 1fe82ef56..b43b80583 100755 --- a/cmd/sealctl/cmd/static_pod.go +++ b/cmd/sealctl/cmd/static_pod.go @@ -20,7 +20,7 @@ import ( "os" "path" - "github.com/labring/sealos/pkg/utils/contants" + "github.com/labring/sealos/pkg/utils/constants" "github.com/labring/sealos/pkg/utils/file" "github.com/labring/sealos/pkg/ipvs" @@ -40,7 +40,7 @@ func NewStaticPodCmd() *cobra.Command { } // check route for host cmd.AddCommand(NewLvscareCmd()) - cmd.PersistentFlags().StringVar(&staticPodPath, "path", contants.KubernetesEtcStaticPod, "default kubernetes static pod path") + cmd.PersistentFlags().StringVar(&staticPodPath, "path", constants.KubernetesEtcStaticPod, "default kubernetes static pod path") return cmd } @@ -58,7 +58,7 @@ func NewLvscareCmd() *cobra.Command { } }, Run: func(cmd *cobra.Command, args []string) { - fileName := fmt.Sprintf("%s.%s", name, contants.YamlFileSuffix) + fileName := fmt.Sprintf("%s.%s", name, constants.YamlFileSuffix) yaml, err := ipvs.LvsStaticPodYaml(vip, masters, image, name) if err != nil { logger.Error(err) @@ -83,8 +83,8 @@ func NewLvscareCmd() *cobra.Command { } // manually to set host via gateway cmd.Flags().StringVar(&vip, "vip", "10.103.97.2:6443", "default vip IP") - cmd.Flags().StringVar(&name, "name", contants.LvsCareStaticPodName, "generator lvscare static pod name") - cmd.Flags().StringVar(&image, "image", contants.DefaultLvsCareImage, "generator lvscare static pod image") + cmd.Flags().StringVar(&name, "name", constants.LvsCareStaticPodName, "generator lvscare static pod name") + cmd.Flags().StringVar(&image, "image", constants.DefaultLvsCareImage, "generator lvscare static pod image") cmd.Flags().StringSliceVar(&masters, "masters", []string{}, "generator masters addrs") cmd.Flags().BoolVar(&printBool, "print", false, "is print yaml") return cmd diff --git a/cmd/sealos/cmd/root.go b/cmd/sealos/cmd/root.go index 02cca4e4a..9da8b2ef2 100644 --- a/cmd/sealos/cmd/root.go +++ b/cmd/sealos/cmd/root.go @@ -18,7 +18,7 @@ import ( "fmt" "os" - "github.com/labring/sealos/pkg/utils/contants" + "github.com/labring/sealos/pkg/utils/constants" "github.com/labring/sealos/pkg/utils/file" "github.com/labring/sealos/pkg/utils/logger" "github.com/sirupsen/logrus" @@ -53,21 +53,21 @@ func init() { cobra.OnInitialize(onBootOnDie) rootCmd.PersistentFlags().BoolVar(&debug, "debug", false, "enable debug logger") - rootCmd.PersistentFlags().StringVar(&clusterRootDir, "clusterRootDir", contants.DefaultClusterRootfsDir, "cluster root directory") + rootCmd.PersistentFlags().StringVar(&clusterRootDir, "cluster-root", constants.DefaultClusterRootfsDir, "cluster root directory") } func onBootOnDie() { - contants.DefaultClusterRootfsDir = clusterRootDir + constants.DefaultClusterRootfsDir = clusterRootDir var rootDirs = []string{ - contants.LogPath(), - contants.DataPath(), - contants.Workdir(), + constants.LogPath(), + constants.DataPath(), + constants.Workdir(), } if err := file.MkDirs(rootDirs...); err != nil { logger.Error(err) panic(1) } - logger.CfgAndFile(debug, contants.LogPath(), "sealos", false) + logger.CfgAndFile(debug, constants.LogPath(), "sealos", false) setupLogrus() } diff --git a/cmd/sealos/cmd/run.go b/cmd/sealos/cmd/run.go index c639edafc..223b05c0e 100644 --- a/cmd/sealos/cmd/run.go +++ b/cmd/sealos/cmd/run.go @@ -61,8 +61,8 @@ create a cluster with custom environment variables: ` var runArgs *apply.RunArgs -func newInitCmd() *cobra.Command { - var initCmd = &cobra.Command{ +func newRunCmd() *cobra.Command { + var runCmd = &cobra.Command{ Use: "run", Short: "Simplest way to run your kubernets HA cluster", Long: `sealos run labring/kubernetes:v1.24.0 --masters [arg] --nodes [arg]`, @@ -78,12 +78,12 @@ func newInitCmd() *cobra.Command { logger.Info(contact) }, } - return initCmd + return runCmd } func init() { runArgs = &apply.RunArgs{} - runCmd := newInitCmd() + runCmd := newRunCmd() rootCmd.AddCommand(runCmd) runCmd.Flags().StringVarP(&runArgs.Masters, "masters", "m", "", "set Count or IPList to masters") runCmd.Flags().StringVarP(&runArgs.Nodes, "nodes", "n", "", "set Count or IPList to nodes") diff --git a/pkg/apply/applydrivers/apply_drivers_default.go b/pkg/apply/applydrivers/apply_drivers_default.go index 13b2d2ed2..f8977f16e 100644 --- a/pkg/apply/applydrivers/apply_drivers_default.go +++ b/pkg/apply/applydrivers/apply_drivers_default.go @@ -26,7 +26,7 @@ import ( "github.com/labring/sealos/pkg/client-go/kubernetes" "github.com/labring/sealos/pkg/clusterfile" v2 "github.com/labring/sealos/pkg/types/v1beta1" - "github.com/labring/sealos/pkg/utils/contants" + "github.com/labring/sealos/pkg/utils/constants" "k8s.io/apimachinery/pkg/version" ) @@ -34,7 +34,7 @@ func NewDefaultApplier(cluster *v2.Cluster, images []string) (Interface, error) if cluster.Name == "" { return nil, fmt.Errorf("cluster name cannot be empty") } - cFile := clusterfile.NewClusterFile(contants.Clusterfile(cluster.Name)) + cFile := clusterfile.NewClusterFile(constants.Clusterfile(cluster.Name)) _ = cFile.Process() return &Applier{ ClusterDesired: cluster, @@ -48,7 +48,7 @@ func NewDefaultScaleApplier(current, cluster *v2.Cluster) (Interface, error) { if cluster.Name == "" { return nil, fmt.Errorf("cluster name cannot be empty") } - cFile := clusterfile.NewClusterFile(contants.Clusterfile(cluster.Name)) + cFile := clusterfile.NewClusterFile(constants.Clusterfile(cluster.Name)) return &Applier{ ClusterDesired: cluster, ClusterFile: cFile, @@ -66,7 +66,7 @@ type Applier struct { } func (c *Applier) Apply() error { - clusterPath := contants.Clusterfile(c.ClusterDesired.Name) + clusterPath := constants.Clusterfile(c.ClusterDesired.Name) if c.ClusterDesired.CreationTimestamp.IsZero() { if err := c.initCluster(); err != nil { return err diff --git a/pkg/apply/processor/create.go b/pkg/apply/processor/create.go index f830cfa14..8fc185569 100644 --- a/pkg/apply/processor/create.go +++ b/pkg/apply/processor/create.go @@ -33,7 +33,7 @@ import ( "github.com/labring/sealos/pkg/image/types" "github.com/labring/sealos/pkg/runtime" v2 "github.com/labring/sealos/pkg/types/v1beta1" - "github.com/labring/sealos/pkg/utils/contants" + "github.com/labring/sealos/pkg/utils/constants" "github.com/labring/sealos/pkg/utils/yaml" ) @@ -92,7 +92,7 @@ func (c *CreateProcessor) CheckImageType(cluster *v2.Cluster) error { imageTypes := sets.NewString() for _, oci := range ociList { if oci.Config.Labels != nil { - imageTypes.Insert(oci.Config.Labels[contants.ImageTypeKey]) + imageTypes.Insert(oci.Config.Labels[constants.ImageTypeKey]) } else { imageTypes.Insert(string(v2.AppImage)) } @@ -174,7 +174,7 @@ func (c *CreateProcessor) Join(cluster *v2.Cluster) error { if err != nil { return err } - return yaml.MarshalYamlToFile(contants.Clusterfile(cluster.Name), cluster) + return yaml.MarshalYamlToFile(constants.Clusterfile(cluster.Name), cluster) } func (c *CreateProcessor) RunGuest(cluster *v2.Cluster) error { diff --git a/pkg/apply/processor/delete.go b/pkg/apply/processor/delete.go index a1433fdb0..9e519bd35 100644 --- a/pkg/apply/processor/delete.go +++ b/pkg/apply/processor/delete.go @@ -28,7 +28,7 @@ import ( "github.com/labring/sealos/pkg/image/types" "github.com/labring/sealos/pkg/runtime" v2 "github.com/labring/sealos/pkg/types/v1beta1" - "github.com/labring/sealos/pkg/utils/contants" + "github.com/labring/sealos/pkg/utils/constants" fileutil "github.com/labring/sealos/pkg/utils/file" ) @@ -104,8 +104,8 @@ func (d DeleteProcessor) UnMountImage(cluster *v2.Cluster) error { } func (d DeleteProcessor) CleanFS(cluster *v2.Cluster) error { - workDir := contants.ClusterDir(cluster.Name) - dataDir := contants.NewData(cluster.Name).Homedir() + workDir := constants.ClusterDir(cluster.Name) + dataDir := constants.NewData(cluster.Name).Homedir() return fileutil.CleanFiles(workDir, dataDir) } diff --git a/pkg/apply/processor/install.go b/pkg/apply/processor/install.go index 2e194c880..cd562298f 100644 --- a/pkg/apply/processor/install.go +++ b/pkg/apply/processor/install.go @@ -35,7 +35,7 @@ import ( "github.com/labring/sealos/pkg/image" "github.com/labring/sealos/pkg/image/types" v2 "github.com/labring/sealos/pkg/types/v1beta1" - "github.com/labring/sealos/pkg/utils/contants" + "github.com/labring/sealos/pkg/utils/constants" ) var ForceOverride bool @@ -113,7 +113,7 @@ func (c *InstallProcessor) PreProcess(cluster *v2.Cluster) error { imageTypes := sets.NewString() for _, oci := range ociList { if oci.Config.Labels != nil { - imageTypes.Insert(oci.Config.Labels[contants.ImageTypeKey]) + imageTypes.Insert(oci.Config.Labels[constants.ImageTypeKey]) } else { imageTypes.Insert(string(v2.AppImage)) } diff --git a/pkg/apply/processor/interface.go b/pkg/apply/processor/interface.go index d4e79133c..e3da4098f 100644 --- a/pkg/apply/processor/interface.go +++ b/pkg/apply/processor/interface.go @@ -18,7 +18,7 @@ import ( "github.com/labring/sealos/pkg/image/types" v2 "github.com/labring/sealos/pkg/types/v1beta1" "github.com/labring/sealos/pkg/utils/confirm" - "github.com/labring/sealos/pkg/utils/contants" + "github.com/labring/sealos/pkg/utils/constants" "github.com/labring/sealos/pkg/utils/logger" "github.com/labring/sealos/pkg/utils/maps" "github.com/labring/sealos/pkg/utils/strings" @@ -80,8 +80,8 @@ func OCIToImageMount(mount *v2.MountImage, imgService types.Service) error { mount.Cmd = newCMDs mount.Labels = oci[0].Config.Labels imageType := v2.AppImage - if mount.Labels[contants.ImageTypeKey] != "" { - imageType = v2.ImageType(mount.Labels[contants.ImageTypeKey]) + if mount.Labels[constants.ImageTypeKey] != "" { + imageType = v2.ImageType(mount.Labels[constants.ImageTypeKey]) } mount.Type = imageType } diff --git a/pkg/apply/processor/scale.go b/pkg/apply/processor/scale.go index 2678d563c..fbcda0e6d 100644 --- a/pkg/apply/processor/scale.go +++ b/pkg/apply/processor/scale.go @@ -27,7 +27,7 @@ import ( "github.com/labring/sealos/pkg/image/types" "github.com/labring/sealos/pkg/runtime" v2 "github.com/labring/sealos/pkg/types/v1beta1" - "github.com/labring/sealos/pkg/utils/contants" + "github.com/labring/sealos/pkg/utils/constants" "github.com/labring/sealos/pkg/utils/logger" "github.com/labring/sealos/pkg/utils/yaml" "golang.org/x/sync/errgroup" @@ -149,7 +149,7 @@ func (c *ScaleProcessor) PreProcess(cluster *v2.Cluster) error { return err } if c.IsScaleUp { - clusterPath := contants.Clusterfile(cluster.Name) + clusterPath := constants.Clusterfile(cluster.Name) if err = yaml.MarshalYamlToFile(clusterPath, cluster); err != nil { return err } diff --git a/pkg/apply/reset.go b/pkg/apply/reset.go index 11e2dd8ee..6ef390efd 100644 --- a/pkg/apply/reset.go +++ b/pkg/apply/reset.go @@ -18,7 +18,7 @@ import ( "github.com/labring/sealos/pkg/apply/applydrivers" "github.com/labring/sealos/pkg/clusterfile" v2 "github.com/labring/sealos/pkg/types/v1beta1" - "github.com/labring/sealos/pkg/utils/contants" + "github.com/labring/sealos/pkg/utils/constants" fileutil "github.com/labring/sealos/pkg/utils/file" "github.com/labring/sealos/pkg/utils/logger" "github.com/labring/sealos/pkg/utils/yaml" @@ -27,7 +27,7 @@ import ( func NewApplierFromResetArgs(args *ResetArgs) (applydrivers.Interface, error) { var cluster *v2.Cluster - clusterPath := contants.Clusterfile(args.ClusterName) + clusterPath := constants.Clusterfile(args.ClusterName) if fileutil.IsExist(clusterPath) { clusterFile := clusterfile.NewClusterFile(clusterPath) err := clusterFile.Process() diff --git a/pkg/apply/run.go b/pkg/apply/run.go index 829301881..471e0f405 100644 --- a/pkg/apply/run.go +++ b/pkg/apply/run.go @@ -23,7 +23,7 @@ import ( "github.com/labring/sealos/pkg/apply/applydrivers" "github.com/labring/sealos/pkg/clusterfile" v2 "github.com/labring/sealos/pkg/types/v1beta1" - "github.com/labring/sealos/pkg/utils/contants" + "github.com/labring/sealos/pkg/utils/constants" fileutil "github.com/labring/sealos/pkg/utils/file" "github.com/labring/sealos/pkg/utils/iputils" "github.com/labring/sealos/pkg/utils/logger" @@ -38,7 +38,7 @@ type ClusterArgs struct { func NewApplierFromArgs(imageName []string, args *RunArgs) (applydrivers.Interface, error) { var cluster *v2.Cluster - clusterPath := contants.Clusterfile(args.ClusterName) + clusterPath := constants.Clusterfile(args.ClusterName) if !fileutil.IsExist(clusterPath) { cluster = initCluster(args.ClusterName) } else { diff --git a/pkg/apply/scale.go b/pkg/apply/scale.go index 33f43e8f3..4969a64e1 100644 --- a/pkg/apply/scale.go +++ b/pkg/apply/scale.go @@ -26,7 +26,7 @@ import ( "github.com/labring/sealos/pkg/apply/applydrivers" "github.com/labring/sealos/pkg/clusterfile" v2 "github.com/labring/sealos/pkg/types/v1beta1" - "github.com/labring/sealos/pkg/utils/contants" + "github.com/labring/sealos/pkg/utils/constants" fileutil "github.com/labring/sealos/pkg/utils/file" "github.com/labring/sealos/pkg/utils/iputils" strings2 "github.com/labring/sealos/pkg/utils/strings" @@ -36,7 +36,7 @@ import ( func NewScaleApplierFromArgs(scaleArgs *ScaleArgs, flag string) (applydrivers.Interface, error) { var cluster *v2.Cluster var curr *v2.Cluster - clusterPath := contants.Clusterfile(scaleArgs.ClusterName) + clusterPath := constants.Clusterfile(scaleArgs.ClusterName) if !fileutil.IsExist(clusterPath) { cluster = initCluster(scaleArgs.ClusterName) curr = cluster diff --git a/pkg/checker/cluster_checker.go b/pkg/checker/cluster_checker.go index 1cadff815..2ab3831dc 100644 --- a/pkg/checker/cluster_checker.go +++ b/pkg/checker/cluster_checker.go @@ -22,7 +22,7 @@ import ( "github.com/labring/sealos/pkg/utils/logger" - "github.com/labring/sealos/pkg/utils/contants" + "github.com/labring/sealos/pkg/utils/constants" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -48,7 +48,7 @@ func (n *ClusterChecker) Check(cluster *v2.Cluster, phase string) error { } // checker if all the node is ready - data := contants.NewData(cluster.Name) + data := constants.NewData(cluster.Name) c, err := kubernetes.NewKubernetesClient(data.AdminFile(), cluster.GetMaster0IPAPIServer()) if err != nil { return err diff --git a/pkg/checker/node_checker.go b/pkg/checker/node_checker.go index e717f42f8..614fb7c0d 100644 --- a/pkg/checker/node_checker.go +++ b/pkg/checker/node_checker.go @@ -20,7 +20,7 @@ import ( "os" "text/template" - "github.com/labring/sealos/pkg/utils/contants" + "github.com/labring/sealos/pkg/utils/constants" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -51,7 +51,7 @@ func (n *NodeChecker) Check(cluster *v2.Cluster, phase string) error { return nil } // checker if all the node is ready - data := contants.NewData(cluster.Name) + data := constants.NewData(cluster.Name) c, err := kubernetes.NewKubernetesClient(data.AdminFile(), cluster.GetMaster0IPAPIServer()) if err != nil { return err diff --git a/pkg/clusterfile/pre_process.go b/pkg/clusterfile/pre_process.go index 3bfce85f2..dcbc8cfdf 100644 --- a/pkg/clusterfile/pre_process.go +++ b/pkg/clusterfile/pre_process.go @@ -19,7 +19,7 @@ import ( "github.com/labring/sealos/pkg/runtime" v2 "github.com/labring/sealos/pkg/types/v1beta1" - "github.com/labring/sealos/pkg/utils/contants" + "github.com/labring/sealos/pkg/utils/constants" "github.com/labring/sealos/pkg/utils/decode" fileutil "github.com/labring/sealos/pkg/utils/file" ) @@ -68,7 +68,7 @@ func (c *ClusterFile) DecodeCluster(data []byte) error { } func (c *ClusterFile) DecodeConfigs(data []byte) error { - configs, err := decode.CRDForBytes(data, contants.Config) + configs, err := decode.CRDForBytes(data, constants.Config) if err != nil { return err } diff --git a/pkg/clusterfile/util.go b/pkg/clusterfile/util.go index 8da8cc48f..e8cbf2f15 100644 --- a/pkg/clusterfile/util.go +++ b/pkg/clusterfile/util.go @@ -22,7 +22,7 @@ import ( "github.com/labring/sealos/pkg/runtime" v2 "github.com/labring/sealos/pkg/types/v1beta1" - "github.com/labring/sealos/pkg/utils/contants" + "github.com/labring/sealos/pkg/utils/constants" yaml2 "github.com/labring/sealos/pkg/utils/yaml" k8sV1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -32,7 +32,7 @@ import ( var ErrClusterNotExist = fmt.Errorf("no cluster exist") func GetDefaultClusterName() (string, error) { - files, err := ioutil.ReadDir(contants.Workdir()) + files, err := ioutil.ReadDir(constants.Workdir()) if err != nil { return "", err } @@ -57,7 +57,7 @@ func GetClusterFromName(clusterName string) (cluster *v2.Cluster, err error) { return nil, err } } - clusterFile := contants.Clusterfile(clusterName) + clusterFile := constants.Clusterfile(clusterName) cluster, err = GetClusterFromFile(clusterFile) return } @@ -75,7 +75,7 @@ func GetDefaultCluster() (cluster *v2.Cluster, err error) { return nil, err } - var filepath = contants.Clusterfile(name) + var filepath = constants.Clusterfile(name) return GetClusterFromFile(filepath) } @@ -87,10 +87,10 @@ func GetClusterFromDataCompatV1(data []byte) (*v2.Cluster, error) { if err != nil { return nil, err } - if metaType.Kind != contants.Cluster { + if metaType.Kind != constants.Cluster { return nil, fmt.Errorf("not found type cluster from: \n%s", data) } - c, err := runtime.DecodeCRDFromString(string(data), contants.Cluster) + c, err := runtime.DecodeCRDFromString(string(data), constants.Cluster) if err != nil { return nil, err } else if c == nil { diff --git a/pkg/config/config.go b/pkg/config/config.go index f1360f57f..925b0c807 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -22,7 +22,7 @@ import ( "github.com/labring/sealos/pkg/utils/maps" - "github.com/labring/sealos/pkg/utils/contants" + "github.com/labring/sealos/pkg/utils/constants" "github.com/labring/sealos/pkg/types/v1beta1" "github.com/labring/sealos/pkg/utils/file" @@ -64,7 +64,7 @@ func NewConfiguration(rootPath string, configs []v1beta1.Config) Interface { } func NewDefaultConfiguration(clusterName string) Interface { return &Dumper{ - RootPath: contants.NewData(clusterName).RootFSPath(), + RootPath: constants.NewData(clusterName).RootFSPath(), } } diff --git a/pkg/filesystem/rootfs/rootfs_default.go b/pkg/filesystem/rootfs/rootfs_default.go index 1d3372742..8375d1d86 100644 --- a/pkg/filesystem/rootfs/rootfs_default.go +++ b/pkg/filesystem/rootfs/rootfs_default.go @@ -31,7 +31,7 @@ import ( "github.com/labring/sealos/pkg/env" v2 "github.com/labring/sealos/pkg/types/v1beta1" - "github.com/labring/sealos/pkg/utils/contants" + "github.com/labring/sealos/pkg/utils/constants" "github.com/labring/sealos/pkg/utils/exec" "github.com/labring/sealos/pkg/utils/file" "github.com/labring/sealos/pkg/utils/ssh" @@ -63,7 +63,7 @@ func (f *defaultRootfs) getSSH(cluster *v2.Cluster) ssh.Interface { } func (f *defaultRootfs) mountRootfs(cluster *v2.Cluster, ipList []string, initFlag, appFlag bool) error { - target := contants.NewData(f.getClusterName(cluster)).RootFSPath() + target := constants.NewData(f.getClusterName(cluster)).RootFSPath() eg, _ := errgroup.WithContext(context.Background()) envProcessor := env.NewEnvProcessor(cluster, f.images) @@ -83,7 +83,7 @@ func (f *defaultRootfs) mountRootfs(cluster *v2.Cluster, ipList []string, initFl return errors.Wrap(err, "get rootfs files failed") } if len(dirs) != 0 { - _, err = exec.RunBashCmd(fmt.Sprintf(contants.DefaultChmodBash, src.MountPoint)) + _, err = exec.RunBashCmd(fmt.Sprintf(constants.DefaultChmodBash, src.MountPoint)) if err != nil { return errors.Wrap(err, "run chmod to rootfs failed") } @@ -94,7 +94,7 @@ func (f *defaultRootfs) mountRootfs(cluster *v2.Cluster, ipList []string, initFl if err := eg.Wait(); err != nil { return err } - check := contants.NewBash(f.getClusterName(cluster), cluster.GetImageLabels()) + check := constants.NewBash(f.getClusterName(cluster), cluster.GetImageLabels()) sshClient := f.getSSH(cluster) for _, IP := range ipList { ip := IP @@ -163,7 +163,7 @@ func (f *defaultRootfs) mountRootfs(cluster *v2.Cluster, ipList []string, initFl return endEg.Wait() } func (f *defaultRootfs) unmountRootfs(cluster *v2.Cluster, ipList []string) error { - clusterRootfsDir := contants.NewData(f.getClusterName(cluster)).Homedir() + clusterRootfsDir := constants.NewData(f.getClusterName(cluster)).Homedir() rmRootfs := fmt.Sprintf("rm -rf %s", clusterRootfsDir) eg, _ := errgroup.WithContext(context.Background()) @@ -179,9 +179,9 @@ func (f *defaultRootfs) unmountRootfs(cluster *v2.Cluster, ipList []string) erro func renderENV(mountDir string, ipList []string, p env.Interface) error { var ( - renderEtc = path.Join(mountDir, contants.EtcDirName) - renderChart = path.Join(mountDir, contants.ChartsDirName) - renderManifests = path.Join(mountDir, contants.ManifestsDirName) + renderEtc = path.Join(mountDir, constants.EtcDirName) + renderChart = path.Join(mountDir, constants.ChartsDirName) + renderManifests = path.Join(mountDir, constants.ManifestsDirName) ) for _, ip := range ipList { @@ -211,7 +211,7 @@ func CopyFiles(sshEntry ssh.Interface, isRegistry, isApp bool, ip, src, target s targetIP = "127.0.0.1" } for _, f := range files { - if f.Name() == contants.RegistryDirName { + if f.Name() == constants.RegistryDirName { continue } err = sshEntry.Copy(targetIP, filepath.Join(src, f.Name()), filepath.Join(target, f.Name())) diff --git a/pkg/guest/guest.go b/pkg/guest/guest.go index 1f74db4fb..8ed215615 100644 --- a/pkg/guest/guest.go +++ b/pkg/guest/guest.go @@ -33,7 +33,7 @@ import ( "github.com/labring/sealos/pkg/image/types" "github.com/labring/sealos/pkg/runtime" v2 "github.com/labring/sealos/pkg/types/v1beta1" - "github.com/labring/sealos/pkg/utils/contants" + "github.com/labring/sealos/pkg/utils/constants" "github.com/labring/sealos/pkg/utils/maps" ) @@ -55,14 +55,14 @@ func NewGuestManager() (Interface, error) { } func (d *Default) Apply(cluster *v2.Cluster, mounts []v2.MountImage) error { - clusterRootfs := runtime.GetContantData(cluster.Name).RootFSPath() + clusterRootfs := runtime.GetConstantData(cluster.Name).RootFSPath() envInterface := env.NewEnvProcessor(cluster, cluster.Status.Mounts) envs := envInterface.WrapperEnv(cluster.GetMaster0IP()) //clusterfile guestCMD := d.getGuestCmd(envs, cluster, mounts) kubeConfig := filepath.Join(homedir.HomeDir(), ".kube", "config") if !fileutil.IsExist(kubeConfig) { - adminFile := runtime.GetContantData(cluster.Name).AdminFile() + adminFile := runtime.GetConstantData(cluster.Name).AdminFile() data, err := fileutil.ReadAll(adminFile) if err != nil { return errors.Wrap(err, "read admin.conf error in guest") @@ -82,7 +82,7 @@ func (d *Default) Apply(cluster *v2.Cluster, mounts []v2.MountImage) error { continue } logger.Info("guest cmd is %s", value) - if err := exec.Cmd("bash", "-c", fmt.Sprintf(contants.CdAndExecCmd, clusterRootfs, value)); err != nil { + if err := exec.Cmd("bash", "-c", fmt.Sprintf(constants.CdAndExecCmd, clusterRootfs, value)); err != nil { return err } } diff --git a/pkg/image/binary/image.go b/pkg/image/binary/image.go index 48e2bec04..988a11703 100644 --- a/pkg/image/binary/image.go +++ b/pkg/image/binary/image.go @@ -26,7 +26,7 @@ import ( "github.com/labring/sealos/pkg/buildimage" "github.com/labring/sealos/pkg/registry" - "github.com/labring/sealos/pkg/utils/contants" + "github.com/labring/sealos/pkg/utils/constants" "github.com/labring/sealos/pkg/utils/logger" fileutil "github.com/labring/sealos/pkg/utils/file" @@ -109,14 +109,14 @@ func inspectImage(data string) (*v1.Image, error) { } func (d *ImageService) Build(options *types.BuildOptions, contextDir, imageName string) error { - //contants.ImageShimDirName - imageFetchDir := path.Join(contextDir, contants.ManifestsDirName) + //constants.ImageShimDirName + imageFetchDir := path.Join(contextDir, constants.ManifestsDirName) yamlImages, err := buildimage.ParseYamlImages(imageFetchDir) logger.Info("fetch manifests images: %v", yamlImages) if err != nil { return errors.Wrap(err, "get images list failed in this context") } - imageListDir := path.Join(contextDir, contants.ImagesDirName, contants.ImageShimDirName) + imageListDir := path.Join(contextDir, constants.ImagesDirName, constants.ImageShimDirName) images, err := buildimage.LoadImages(imageListDir) if err != nil { return errors.Wrap(err, "load images list failed in this context") @@ -143,7 +143,7 @@ func (d *ImageService) Build(options *types.BuildOptions, contextDir, imageName } logger.Info("pull images %v for platform is %s", images, strings.Join([]string{platformVar.OS, platformVar.Architecture}, "/")) - images, err = is.SaveImages(images, path.Join(contextDir, contants.RegistryDirName), platformVar) + images, err = is.SaveImages(images, path.Join(contextDir, constants.RegistryDirName), platformVar) if err != nil { return errors.Wrap(err, "save images failed in this context") } diff --git a/pkg/image/buildah/image/build.go b/pkg/image/buildah/image/build.go index 2a3290bd9..b6b553c86 100644 --- a/pkg/image/buildah/image/build.go +++ b/pkg/image/buildah/image/build.go @@ -39,21 +39,21 @@ import ( "github.com/labring/sealos/pkg/buildimage" "github.com/labring/sealos/pkg/image/types" "github.com/labring/sealos/pkg/registry" - "github.com/labring/sealos/pkg/utils/contants" + "github.com/labring/sealos/pkg/utils/constants" "github.com/labring/sealos/pkg/utils/logger" v1 "github.com/opencontainers/image-spec/specs-go/v1" "github.com/pkg/errors" ) func (d *ImageService) Build(options *types.BuildOptions, contextDir, imageName string) error { - //contants.ImageShimDirName - imageFetchDir := path.Join(contextDir, contants.ManifestsDirName) + //constants.ImageShimDirName + imageFetchDir := path.Join(contextDir, constants.ManifestsDirName) yamlImages, err := buildimage.ParseYamlImages(imageFetchDir) logger.Info("fetch manifests images: %v", yamlImages) if err != nil { return errors.Wrap(err, "get images list failed in this context") } - imageListDir := path.Join(contextDir, contants.ImagesDirName, contants.ImageShimDirName) + imageListDir := path.Join(contextDir, constants.ImagesDirName, constants.ImageShimDirName) images, err := buildimage.LoadImages(imageListDir) if err != nil { return errors.Wrap(err, "load images list failed in this context") @@ -80,7 +80,7 @@ func (d *ImageService) Build(options *types.BuildOptions, contextDir, imageName } logger.Info("pull images %v for platform is %s", images, strings.Join([]string{platformVar.OS, platformVar.Architecture}, "/")) - images, err = is.SaveImages(images, path.Join(contextDir, contants.RegistryDirName), platformVar) + images, err = is.SaveImages(images, path.Join(contextDir, constants.RegistryDirName), platformVar) if err != nil { return errors.Wrap(err, "save images failed in this context") } diff --git a/pkg/ipvs/lvscare.go b/pkg/ipvs/lvscare.go index 8ebbcbf1a..3f51af402 100644 --- a/pkg/ipvs/lvscare.go +++ b/pkg/ipvs/lvscare.go @@ -17,7 +17,7 @@ package ipvs import ( "fmt" - "github.com/labring/sealos/pkg/utils/contants" + "github.com/labring/sealos/pkg/utils/constants" "github.com/pkg/errors" v1 "k8s.io/api/core/v1" @@ -35,7 +35,7 @@ func LvsStaticPodYaml(vip string, masters []string, image, name string) (string, return "", fmt.Errorf("vip and mster not allow empty") } if image == "" { - image = contants.DefaultLvsCareImage + image = constants.DefaultLvsCareImage } args := []string{"care", "--vs", vip, "--health-path", "/healthz", "--health-schem", "https"} for _, m := range masters { diff --git a/pkg/ipvs/lvscare_test.go b/pkg/ipvs/lvscare_test.go index 03cf11cca..d6335092e 100644 --- a/pkg/ipvs/lvscare_test.go +++ b/pkg/ipvs/lvscare_test.go @@ -17,7 +17,7 @@ package ipvs import ( "testing" - "github.com/labring/sealos/pkg/utils/contants" + "github.com/labring/sealos/pkg/utils/constants" ) var want = []string{ @@ -92,7 +92,7 @@ func TestLvsStaticPodYaml(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - if got, _ := LvsStaticPodYaml(tt.args.vip, tt.args.masters, tt.args.image, contants.LvsCareStaticPodName); got != tt.want { + if got, _ := LvsStaticPodYaml(tt.args.vip, tt.args.masters, tt.args.image, constants.LvsCareStaticPodName); got != tt.want { t.Errorf("LvsStaticPodYaml() = %v, want %v", got, tt.want) } }) diff --git a/pkg/remote/util.go b/pkg/remote/util.go index 78b27ba80..0a5797464 100644 --- a/pkg/remote/util.go +++ b/pkg/remote/util.go @@ -21,7 +21,7 @@ import ( "fmt" "text/template" - "github.com/labring/sealos/pkg/utils/contants" + "github.com/labring/sealos/pkg/utils/constants" "github.com/labring/sealos/pkg/utils/logger" "github.com/labring/sealos/pkg/utils/ssh" ) @@ -36,13 +36,13 @@ func renderTemplate(tmpl *template.Template, data map[string]interface{}) (strin } func bashToString(clusterName string, sshInterface ssh.Interface, host, cmd string) (string, error) { - data := contants.NewData(clusterName) + data := constants.NewData(clusterName) cmd = fmt.Sprintf("%s %s", data.RootFSSealctlPath(), cmd) logger.Debug("start to exec remote %s shell: %s", host, cmd) return sshInterface.CmdToString(host, cmd, "") } func bashSync(clusterName string, sshInterface ssh.Interface, host, cmd string) error { - data := contants.NewData(clusterName) + data := constants.NewData(clusterName) cmd = fmt.Sprintf("%s %s", data.RootFSSealctlPath(), cmd) logger.Debug("start to exec remote %s shell: %s", host, cmd) return sshInterface.CmdAsync(host, cmd) diff --git a/pkg/runtime/image_shim.go b/pkg/runtime/image_shim.go index f7c7a1478..49bea507c 100644 --- a/pkg/runtime/image_shim.go +++ b/pkg/runtime/image_shim.go @@ -20,7 +20,7 @@ import ( "fmt" "path" - "github.com/labring/sealos/pkg/utils/contants" + "github.com/labring/sealos/pkg/utils/constants" "github.com/labring/sealos/pkg/utils/logger" "github.com/labring/sealos/pkg/utils/yaml" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" @@ -31,7 +31,7 @@ var defaultRootDirectory = "/var/lib/image-cri-shim" //GetImageShim default dir is /var/lib/image-cri-shim func GetImageShim(rootfs string) string { const imageCustomConfig = "image-cri-shim.yaml" - etcPath := path.Join(rootfs, contants.EtcDirName, imageCustomConfig) + etcPath := path.Join(rootfs, constants.EtcDirName, imageCustomConfig) registryConfig, err := yaml.Unmarshal(etcPath) if err != nil { logger.Debug("use default registry config") @@ -44,7 +44,7 @@ func GetImageShim(rootfs string) string { func ApplyImageShimCMD(rootfs string) string { shimData := GetImageShim(rootfs) - return fmt.Sprintf(contants.DefaultCPFmt, shimData, path.Join(rootfs, contants.ImagesDirName, contants.ImageShimDirName), shimData) + return fmt.Sprintf(constants.DefaultCPFmt, shimData, path.Join(rootfs, constants.ImagesDirName, constants.ImageShimDirName), shimData) } func DeleteImageShimCMD(rootfs string) string { diff --git a/pkg/runtime/init.go b/pkg/runtime/init.go index f1c6af52d..af7afa4e9 100644 --- a/pkg/runtime/init.go +++ b/pkg/runtime/init.go @@ -19,7 +19,7 @@ import ( "path" "github.com/labring/sealos/pkg/cert" - "github.com/labring/sealos/pkg/utils/contants" + "github.com/labring/sealos/pkg/utils/constants" "github.com/labring/sealos/pkg/utils/file" "github.com/labring/sealos/pkg/utils/logger" ) @@ -30,8 +30,8 @@ func (k *KubeadmRuntime) ConfigInitKubeadmToMaster0() error { if err != nil { return fmt.Errorf("generator config init kubeadm config error: %s", err.Error()) } - initConfigPath := path.Join(k.getContentData().TmpPath(), contants.DefaultInitKubeadmFileName) - outConfigPath := path.Join(k.getContentData().EtcPath(), contants.DefaultInitKubeadmFileName) + initConfigPath := path.Join(k.getContentData().TmpPath(), constants.DefaultInitKubeadmFileName) + outConfigPath := path.Join(k.getContentData().EtcPath(), constants.DefaultInitKubeadmFileName) err = file.WriteFile(initConfigPath, data) if err != nil { return fmt.Errorf("write Config init kubeadm config error: %s", err.Error()) diff --git a/pkg/runtime/kubeadm.go b/pkg/runtime/kubeadm.go index 3a5ac859d..9bb0687d5 100644 --- a/pkg/runtime/kubeadm.go +++ b/pkg/runtime/kubeadm.go @@ -29,7 +29,7 @@ import ( "github.com/labring/sealos/pkg/runtime/apis/kubeadm/v1beta3" "github.com/pkg/errors" - "github.com/labring/sealos/pkg/utils/contants" + "github.com/labring/sealos/pkg/utils/constants" "github.com/labring/sealos/pkg/runtime/apis/kubeadm" "github.com/labring/sealos/pkg/token" @@ -140,7 +140,7 @@ func (k *KubeadmRuntime) validateVIP(ip string) error { } func (k *KubeadmRuntime) getDefaultKubeadmConfig() string { - return filepath.Join(k.getContentData().RootFSEtcPath(), contants.DefaultRootfsKubeadmFileName) + return filepath.Join(k.getContentData().RootFSEtcPath(), constants.DefaultRootfsKubeadmFileName) } func (k *KubeadmRuntime) getClusterName() string { @@ -178,7 +178,7 @@ func (k *KubeadmRuntime) getDNSDomain() string { } func (k *KubeadmRuntime) writeTokenFile() error { - tokenFile := path.Join(k.getContentData().EtcPath(), contants.DefaultKubeadmTokenFileName) + tokenFile := path.Join(k.getContentData().EtcPath(), constants.DefaultKubeadmTokenFileName) data, err := k.execToken(k.getMaster0IPAndPort()) if err != nil { return err @@ -198,7 +198,7 @@ func (k *KubeadmRuntime) writeTokenFile() error { func (k *KubeadmRuntime) setKubernetesToken() error { logger.Info("start to get kubernetes token...") if k.Token == nil { - tokenFile := path.Join(k.getContentData().EtcPath(), contants.DefaultKubeadmTokenFileName) + tokenFile := path.Join(k.getContentData().EtcPath(), constants.DefaultKubeadmTokenFileName) if !fileutil.IsExist(tokenFile) { err := k.writeTokenFile() if err != nil { diff --git a/pkg/runtime/master.go b/pkg/runtime/master.go index c62e1db59..21fb0fe41 100644 --- a/pkg/runtime/master.go +++ b/pkg/runtime/master.go @@ -20,7 +20,7 @@ import ( "path" "sync" - "github.com/labring/sealos/pkg/utils/contants" + "github.com/labring/sealos/pkg/utils/constants" "github.com/labring/sealos/pkg/utils/file" "github.com/labring/sealos/pkg/utils/logger" "github.com/labring/sealos/pkg/utils/ssh" @@ -77,8 +77,8 @@ func (k *KubeadmRuntime) ConfigJoinMasterKubeadmToMaster(master string) error { if err != nil { return fmt.Errorf("generator config join master kubeadm config error: %s", err.Error()) } - joinConfigPath := path.Join(k.getContentData().TmpPath(), contants.DefaultJoinMasterKubeadmFileName) - outConfigPath := path.Join(k.getContentData().EtcPath(), contants.DefaultJoinMasterKubeadmFileName) + joinConfigPath := path.Join(k.getContentData().TmpPath(), constants.DefaultJoinMasterKubeadmFileName) + outConfigPath := path.Join(k.getContentData().EtcPath(), constants.DefaultJoinMasterKubeadmFileName) err = file.WriteFile(joinConfigPath, data) if err != nil { return fmt.Errorf("write config join master kubeadm config error: %s", err.Error()) diff --git a/pkg/runtime/node.go b/pkg/runtime/node.go index 6febd457b..a66c42fd5 100644 --- a/pkg/runtime/node.go +++ b/pkg/runtime/node.go @@ -19,7 +19,7 @@ import ( "fmt" "path" - "github.com/labring/sealos/pkg/utils/contants" + "github.com/labring/sealos/pkg/utils/constants" "github.com/labring/sealos/pkg/utils/file" "github.com/labring/sealos/pkg/utils/logger" "github.com/labring/sealos/pkg/utils/ssh" @@ -85,8 +85,8 @@ func (k *KubeadmRuntime) ConfigJoinNodeKubeadmToNode(node string) error { if err != nil { return fmt.Errorf("generator config join kubeadm config error: %s", err.Error()) } - joinConfigPath := path.Join(k.getContentData().TmpPath(), contants.DefaultJoinNodeKubeadmFileName) - outConfigPath := path.Join(k.getContentData().EtcPath(), contants.DefaultJoinNodeKubeadmFileName) + joinConfigPath := path.Join(k.getContentData().TmpPath(), constants.DefaultJoinNodeKubeadmFileName) + outConfigPath := path.Join(k.getContentData().EtcPath(), constants.DefaultJoinNodeKubeadmFileName) err = file.WriteFile(joinConfigPath, data) if err != nil { return fmt.Errorf("write config join kubeadm config error: %s", err.Error()) diff --git a/pkg/runtime/registry.go b/pkg/runtime/registry.go index 4f5644da3..67d3ff0de 100644 --- a/pkg/runtime/registry.go +++ b/pkg/runtime/registry.go @@ -22,7 +22,7 @@ import ( "github.com/labring/sealos/pkg/utils/iputils" - "github.com/labring/sealos/pkg/utils/contants" + "github.com/labring/sealos/pkg/utils/constants" "github.com/labring/sealos/pkg/utils/yaml" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" @@ -36,10 +36,10 @@ func GetRegistry(rootfs, defaultRegistry string) *v1beta1.RegistryConfig { const registryCustomConfig = "registry.yml" var DefaultConfig = &v1beta1.RegistryConfig{ IP: defaultRegistry, - Domain: contants.DefaultRegistryDomain, + Domain: constants.DefaultRegistryDomain, Port: "5000", } - etcPath := path.Join(rootfs, contants.EtcDirName, registryCustomConfig) + etcPath := path.Join(rootfs, constants.EtcDirName, registryCustomConfig) registryConfig, err := yaml.Unmarshal(etcPath) if err != nil { logger.Debug("use default registry config") @@ -87,7 +87,7 @@ func (k *KubeadmRuntime) htpasswd() error { func (k *KubeadmRuntime) ApplyRegistry() error { logger.Info("start to apply registry") registry := k.getRegistry() - err := k.sshCmdAsync(registry.IP, fmt.Sprintf(contants.DefaultLnFmt, k.getContentData().RootFSRegistryPath(), registry.Data)) + err := k.sshCmdAsync(registry.IP, fmt.Sprintf(constants.DefaultLnFmt, k.getContentData().RootFSRegistryPath(), registry.Data)) if err != nil { return fmt.Errorf("copy registry data failed %v", err) } diff --git a/pkg/runtime/runtime_getter.go b/pkg/runtime/runtime_getter.go index 7e3025fd5..57879b711 100644 --- a/pkg/runtime/runtime_getter.go +++ b/pkg/runtime/runtime_getter.go @@ -29,7 +29,7 @@ import ( "github.com/labring/sealos/pkg/env" "github.com/labring/sealos/pkg/remote" - "github.com/labring/sealos/pkg/utils/contants" + "github.com/labring/sealos/pkg/utils/constants" "github.com/labring/sealos/pkg/utils/ssh" "golang.org/x/sync/errgroup" ) @@ -44,7 +44,7 @@ func (k *KubeadmRuntime) getKubeVersion() string { func (k *KubeadmRuntime) getKubeVersionFromImage() string { labels := k.getImageLabels() - image := labels[contants.ImageKubeVersionKey] + image := labels[constants.ImageKubeVersionKey] if image == "" { return "" } @@ -89,9 +89,9 @@ func (k *KubeadmRuntime) getMaster0IPAPIServer() string { func (k *KubeadmRuntime) getLvscareImage() (string, error) { labels := k.getImageLabels() - image := labels[contants.ImageKubeLvscareImageKey] + image := labels[constants.ImageKubeLvscareImageKey] if image == "" { - image = contants.DefaultLvsCareImage + image = constants.DefaultLvsCareImage } return image, nil } @@ -126,7 +126,7 @@ func (k *KubeadmRuntime) execIPVSPod(ip string, masters []string) error { if err != nil { return err } - return k.getRemoteInterface().StaticPod(ip, k.getVipAndPort(), contants.LvsCareStaticPodName, image, masters) + return k.getRemoteInterface().StaticPod(ip, k.getVipAndPort(), constants.LvsCareStaticPodName, image, masters) } func (k *KubeadmRuntime) execToken(ip string) (string, error) { @@ -190,15 +190,15 @@ func (k *KubeadmRuntime) getRemoteInterface() remote.Interface { return remote.New(k.getClusterName(), k.getSSHInterface()) } -func (k *KubeadmRuntime) getScriptsBash() contants.Bash { +func (k *KubeadmRuntime) getScriptsBash() constants.Bash { render := k.getImageLabels() - return contants.NewBash(k.getClusterName(), render) + return constants.NewBash(k.getClusterName(), render) } -func (k *KubeadmRuntime) getContentData() contants.Data { - return contants.NewData(k.getClusterName()) +func (k *KubeadmRuntime) getContentData() constants.Data { + return constants.NewData(k.getClusterName()) } -func GetContantData(clusterName string) contants.Data { - return contants.NewData(clusterName) +func GetConstantData(clusterName string) constants.Data { + return constants.NewData(clusterName) } diff --git a/pkg/runtime/token.go b/pkg/runtime/token.go index d0093a242..b7ac523e3 100644 --- a/pkg/runtime/token.go +++ b/pkg/runtime/token.go @@ -22,7 +22,7 @@ import ( "strconv" "strings" - "github.com/labring/sealos/pkg/utils/contants" + "github.com/labring/sealos/pkg/utils/constants" "github.com/labring/sealos/pkg/utils/logger" "github.com/labring/sealos/pkg/utils/versionutil" ) @@ -49,9 +49,9 @@ func (k *KubeadmRuntime) Command(version string, name CommandType) (cmd string) JoinNode115Upper = "kubeadm join --config=%s" ) - initConfigPath := path.Join(k.getContentData().EtcPath(), contants.DefaultInitKubeadmFileName) - joinMasterConfigPath := path.Join(k.getContentData().EtcPath(), contants.DefaultJoinMasterKubeadmFileName) - joinNodeConfigPath := path.Join(k.getContentData().EtcPath(), contants.DefaultJoinNodeKubeadmFileName) + initConfigPath := path.Join(k.getContentData().EtcPath(), constants.DefaultInitKubeadmFileName) + joinMasterConfigPath := path.Join(k.getContentData().EtcPath(), constants.DefaultJoinMasterKubeadmFileName) + joinNodeConfigPath := path.Join(k.getContentData().EtcPath(), constants.DefaultJoinNodeKubeadmFileName) var discoveryTokens []string for _, data := range k.getTokenCaCertHash() { diff --git a/pkg/runtime/utils.go b/pkg/runtime/utils.go index 01d7d623e..a05801e72 100644 --- a/pkg/runtime/utils.go +++ b/pkg/runtime/utils.go @@ -23,7 +23,7 @@ import ( "github.com/labring/sealos/pkg/utils/iputils" "github.com/labring/sealos/pkg/client-go/kubernetes" - "github.com/labring/sealos/pkg/utils/contants" + "github.com/labring/sealos/pkg/utils/constants" "github.com/labring/sealos/pkg/utils/logger" "golang.org/x/sync/errgroup" v12 "k8s.io/api/core/v1" @@ -78,14 +78,14 @@ func (k *KubeadmRuntime) ReplaceKubeConfigV1991V1992(masters []string) bool { } func (k *KubeadmRuntime) sendKubeConfigFile(hosts []string, kubeFile string) error { - absKubeFile := fmt.Sprintf("%s/%s", contants.KubernetesEtc, kubeFile) + absKubeFile := fmt.Sprintf("%s/%s", constants.KubernetesEtc, kubeFile) sealosKubeFile := fmt.Sprintf("%s/%s", k.getContentData().EtcPath(), kubeFile) return k.sendFileToHosts(hosts, sealosKubeFile, absKubeFile) } func (k *KubeadmRuntime) sendNewCertAndKey(hosts []string) error { logger.Info("start to copy etc pki files to masters") - return k.sendFileToHosts(hosts, k.getContentData().PkiPath(), contants.KubernetesEtcPKI) + return k.sendFileToHosts(hosts, k.getContentData().PkiPath(), constants.KubernetesEtcPKI) } func (k *KubeadmRuntime) sendFileToHosts(Hosts []string, src, dst string) error { diff --git a/pkg/types/v1beta1/contants.go b/pkg/types/v1beta1/contants.go index d0a6c79a5..d36466c22 100644 --- a/pkg/types/v1beta1/contants.go +++ b/pkg/types/v1beta1/contants.go @@ -17,7 +17,7 @@ limitations under the License. package v1beta1 import ( - "github.com/labring/sealos/pkg/utils/contants" + "github.com/labring/sealos/pkg/utils/constants" ) const ( @@ -46,6 +46,6 @@ const ( ) var ( - DefaultConfigPath = contants.GetHomeDir() + "/.sealos" - DefaultPKFile = contants.GetHomeDir() + "/.ssh/id_rsa" + DefaultConfigPath = constants.GetHomeDir() + "/.sealos" + DefaultPKFile = constants.GetHomeDir() + "/.ssh/id_rsa" ) diff --git a/pkg/utils/contants/README.md b/pkg/utils/constants/README.md similarity index 100% rename from pkg/utils/contants/README.md rename to pkg/utils/constants/README.md diff --git a/pkg/utils/contants/bash.go b/pkg/utils/constants/bash.go similarity index 99% rename from pkg/utils/contants/bash.go rename to pkg/utils/constants/bash.go index 7bf93ec89..0f8607297 100644 --- a/pkg/utils/contants/bash.go +++ b/pkg/utils/constants/bash.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package contants +package constants import "fmt" diff --git a/pkg/utils/contants/contants.go b/pkg/utils/constants/contants.go similarity index 98% rename from pkg/utils/contants/contants.go rename to pkg/utils/constants/contants.go index 60fe08e82..e5215d7c2 100644 --- a/pkg/utils/contants/contants.go +++ b/pkg/utils/constants/contants.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package contants +package constants import ( "github.com/mitchellh/go-homedir" diff --git a/pkg/utils/contants/data.go b/pkg/utils/constants/data.go similarity index 99% rename from pkg/utils/contants/data.go rename to pkg/utils/constants/data.go index 7897c69ef..0706e140b 100644 --- a/pkg/utils/contants/data.go +++ b/pkg/utils/constants/data.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package contants +package constants import "path/filepath" diff --git a/pkg/utils/contants/kube.go b/pkg/utils/constants/kube.go similarity index 97% rename from pkg/utils/contants/kube.go rename to pkg/utils/constants/kube.go index 04c10fe0e..9121f39a8 100644 --- a/pkg/utils/contants/kube.go +++ b/pkg/utils/constants/kube.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package contants +package constants const ( KubernetesEtcStaticPod = "/etc/kubernetes/manifests" diff --git a/pkg/utils/contants/worker.go b/pkg/utils/constants/worker.go similarity index 98% rename from pkg/utils/contants/worker.go rename to pkg/utils/constants/worker.go index e7cb235ea..e520bd553 100644 --- a/pkg/utils/contants/worker.go +++ b/pkg/utils/constants/worker.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package contants +package constants import "path/filepath" diff --git a/pkg/utils/decode/decode.go b/pkg/utils/decode/decode.go index 133bb54ab..e5b918cb6 100644 --- a/pkg/utils/decode/decode.go +++ b/pkg/utils/decode/decode.go @@ -20,14 +20,14 @@ import ( "io" "github.com/labring/sealos/pkg/types/v1beta1" - "github.com/labring/sealos/pkg/utils/contants" + "github.com/labring/sealos/pkg/utils/constants" fileutil "github.com/labring/sealos/pkg/utils/file" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/yaml" ) func Cluster(filepath string) (clusters []v1beta1.Cluster, err error) { - decodeClusters, err := decodeCRD(filepath, contants.Cluster) + decodeClusters, err := decodeCRD(filepath, constants.Cluster) if err != nil { return nil, fmt.Errorf("failed to decode cluster from %s, %v", filepath, err) } @@ -36,7 +36,7 @@ func Cluster(filepath string) (clusters []v1beta1.Cluster, err error) { } func Configs(filepath string) (configs []v1beta1.Config, err error) { - decodeConfigs, err := decodeCRD(filepath, contants.Config) + decodeConfigs, err := decodeCRD(filepath, constants.Config) if err != nil { return nil, fmt.Errorf("failed to decode config from %s, %v", filepath, err) } @@ -78,23 +78,23 @@ func CRDForBytes(data []byte, kind string) (out interface{}, err error) { } // ext.Raw switch kind { - case contants.Cluster: + case constants.Cluster: cluster := v1beta1.Cluster{} err = yaml.Unmarshal(ext.Raw, &cluster) if err != nil { return nil, fmt.Errorf("decode cluster failed %v", err) } - if cluster.Kind == contants.Cluster { + if cluster.Kind == constants.Cluster { clusters = append(clusters, cluster) } i = clusters - case contants.Config: + case constants.Config: config := v1beta1.Config{} err = yaml.Unmarshal(ext.Raw, &config) if err != nil { return nil, fmt.Errorf("decode config failed %v", err) } - if config.Kind == contants.Config { + if config.Kind == constants.Config { configs = append(configs, config) } i = configs diff --git a/vendor/golang.org/x/crypto/chacha20/chacha_arm64.s b/vendor/golang.org/x/crypto/chacha20/chacha_arm64.s index 63cae9e6f..2df91baaa 100644 --- a/vendor/golang.org/x/crypto/chacha20/chacha_arm64.s +++ b/vendor/golang.org/x/crypto/chacha20/chacha_arm64.s @@ -30,7 +30,7 @@ loop: MOVD $NUM_ROUNDS, R21 VLD1 (R11), [V30.S4, V31.S4] - // load contants + // load constants // VLD4R (R10), [V0.S4, V1.S4, V2.S4, V3.S4] WORD $0x4D60E940