diff --git a/Dockerfile b/Dockerfile index 5070d0fda..d0ee8137b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,8 +25,8 @@ COPY . /work RUN dpkg --add-architecture arm64 && \ apt update && \ apt install -y gcc-aarch64-linux-gnu && \ - apt install -y libbtrfs-dev btrfs-tools && \ + apt install -y libbtrfs-dev btrfs-tools && \ apt install -y libgpgme-dev libdevmapper-dev && \ - apt install -y libbtrfs-dev:arm64 btrfs-tools:arm64 && \ + apt install -y libbtrfs-dev:arm64 btrfs-tools:arm64 && \ apt install -y libgpgme-dev:arm64 libdevmapper-dev:arm64 && \ make ${ACTION} diff --git a/cmd/sealctl/cmd/cert.go b/cmd/sealctl/cmd/cert.go index 980b9f05a..063daedc3 100755 --- a/cmd/sealctl/cmd/cert.go +++ b/cmd/sealctl/cmd/cert.go @@ -17,10 +17,11 @@ package cmd import ( "os" + "github.com/spf13/cobra" + "github.com/labring/sealos/pkg/cert" "github.com/labring/sealos/pkg/utils/flags" "github.com/labring/sealos/pkg/utils/logger" - "github.com/spf13/cobra" ) func newCertCmd() *cobra.Command { diff --git a/cmd/sealctl/cmd/cri.go b/cmd/sealctl/cmd/cri.go index 6e8f155a1..5088a0d05 100644 --- a/cmd/sealctl/cmd/cri.go +++ b/cmd/sealctl/cmd/cri.go @@ -21,10 +21,11 @@ import ( "strconv" "strings" - "github.com/labring/sealos/pkg/cri" - "github.com/labring/sealos/pkg/utils/logger" "github.com/spf13/cobra" utilsexec "k8s.io/utils/exec" + + "github.com/labring/sealos/pkg/cri" + "github.com/labring/sealos/pkg/utils/logger" ) var ( diff --git a/cmd/sealctl/cmd/hostname.go b/cmd/sealctl/cmd/hostname.go index ea1a50cf3..498cad6a9 100755 --- a/cmd/sealctl/cmd/hostname.go +++ b/cmd/sealctl/cmd/hostname.go @@ -17,8 +17,9 @@ package cmd import ( "os" - "github.com/labring/sealos/pkg/utils/logger" "github.com/spf13/cobra" + + "github.com/labring/sealos/pkg/utils/logger" ) func newHostsNameCmd() *cobra.Command { diff --git a/cmd/sealctl/cmd/hosts.go b/cmd/sealctl/cmd/hosts.go index 17d453550..c8fdd70f0 100644 --- a/cmd/sealctl/cmd/hosts.go +++ b/cmd/sealctl/cmd/hosts.go @@ -19,9 +19,10 @@ package cmd import ( "os" + "github.com/spf13/cobra" + "github.com/labring/sealos/pkg/hosts" "github.com/labring/sealos/pkg/utils/logger" - "github.com/spf13/cobra" ) var hostsPath string diff --git a/cmd/sealctl/cmd/ipvs.go b/cmd/sealctl/cmd/ipvs.go index eccb11bb7..2a5dc5758 100644 --- a/cmd/sealctl/cmd/ipvs.go +++ b/cmd/sealctl/cmd/ipvs.go @@ -16,8 +16,9 @@ package cmd import ( "github.com/labring/lvscare/care" - "github.com/labring/sealos/pkg/utils/flags" "github.com/spf13/cobra" + + "github.com/labring/sealos/pkg/utils/flags" ) var Ipvs care.LvsCare diff --git a/cmd/sealctl/cmd/kube.go b/cmd/sealctl/cmd/kube.go index da95071aa..26007ab17 100755 --- a/cmd/sealctl/cmd/kube.go +++ b/cmd/sealctl/cmd/kube.go @@ -18,9 +18,10 @@ import ( "fmt" "os" + "github.com/spf13/cobra" + "github.com/labring/sealos/pkg/utils/exec" "github.com/labring/sealos/pkg/utils/logger" - "github.com/spf13/cobra" ) func newKubeCmd() *cobra.Command { diff --git a/cmd/sealctl/cmd/password.go b/cmd/sealctl/cmd/password.go index dbadbbd50..ed5a132fd 100755 --- a/cmd/sealctl/cmd/password.go +++ b/cmd/sealctl/cmd/password.go @@ -18,10 +18,11 @@ import ( "io/ioutil" "os" + "github.com/spf13/cobra" + "github.com/labring/sealos/pkg/passwd" "github.com/labring/sealos/pkg/utils/file" "github.com/labring/sealos/pkg/utils/logger" - "github.com/spf13/cobra" ) func newPasswordCmd() *cobra.Command { diff --git a/cmd/sealctl/cmd/registry.go b/cmd/sealctl/cmd/registry.go index bec0bb0fb..4e447c4e2 100644 --- a/cmd/sealctl/cmd/registry.go +++ b/cmd/sealctl/cmd/registry.go @@ -22,6 +22,9 @@ import ( "strings" "github.com/docker/docker/api/types" + v1 "github.com/opencontainers/image-spec/specs-go/v1" + "github.com/spf13/cobra" + "github.com/labring/sealos/pkg/buildimage" "github.com/labring/sealos/pkg/passwd" "github.com/labring/sealos/pkg/registry" @@ -29,8 +32,6 @@ import ( "github.com/labring/sealos/pkg/utils/flags" "github.com/labring/sealos/pkg/utils/logger" "github.com/labring/sealos/pkg/utils/maps" - v1 "github.com/opencontainers/image-spec/specs-go/v1" - "github.com/spf13/cobra" ) var ( diff --git a/cmd/sealctl/cmd/root.go b/cmd/sealctl/cmd/root.go index e21c892d2..8ea9a5a8c 100644 --- a/cmd/sealctl/cmd/root.go +++ b/cmd/sealctl/cmd/root.go @@ -18,8 +18,9 @@ import ( "fmt" "os" - "github.com/labring/sealos/pkg/utils/logger" "github.com/spf13/cobra" + + "github.com/labring/sealos/pkg/utils/logger" ) var ( diff --git a/cmd/sealctl/cmd/route.go b/cmd/sealctl/cmd/route.go index b7844aa16..0ad22ce9d 100644 --- a/cmd/sealctl/cmd/route.go +++ b/cmd/sealctl/cmd/route.go @@ -17,9 +17,10 @@ package cmd import ( "os" + "github.com/spf13/cobra" + "github.com/labring/sealos/pkg/route" "github.com/labring/sealos/pkg/utils/logger" - "github.com/spf13/cobra" ) var ( diff --git a/cmd/sealctl/cmd/static_pod.go b/cmd/sealctl/cmd/static_pod.go index 29677ead8..d8cbfd417 100755 --- a/cmd/sealctl/cmd/static_pod.go +++ b/cmd/sealctl/cmd/static_pod.go @@ -20,11 +20,12 @@ import ( "os" "path" + "github.com/spf13/cobra" + "github.com/labring/sealos/pkg/ipvs" "github.com/labring/sealos/pkg/utils/constants" "github.com/labring/sealos/pkg/utils/file" "github.com/labring/sealos/pkg/utils/logger" - "github.com/spf13/cobra" ) var staticPodPath string diff --git a/cmd/sealctl/cmd/token.go b/cmd/sealctl/cmd/token.go index c00fa250d..ba2a67613 100755 --- a/cmd/sealctl/cmd/token.go +++ b/cmd/sealctl/cmd/token.go @@ -17,10 +17,11 @@ package cmd import ( "os" - "github.com/labring/sealos/pkg/token" - "github.com/labring/sealos/pkg/utils/logger" "github.com/spf13/cobra" "k8s.io/apimachinery/pkg/util/json" + + "github.com/labring/sealos/pkg/token" + "github.com/labring/sealos/pkg/utils/logger" ) func newTokenCmd() *cobra.Command { diff --git a/cmd/sealctl/cmd/version.go b/cmd/sealctl/cmd/version.go index 72bc0098e..4a7bec507 100644 --- a/cmd/sealctl/cmd/version.go +++ b/cmd/sealctl/cmd/version.go @@ -18,8 +18,9 @@ import ( "encoding/json" "fmt" - "github.com/labring/sealos/pkg/version" "github.com/spf13/cobra" + + "github.com/labring/sealos/pkg/version" ) var shortPrint bool diff --git a/cmd/sealos/cmd/add.go b/cmd/sealos/cmd/add.go index 5502edaee..48897d80b 100644 --- a/cmd/sealos/cmd/add.go +++ b/cmd/sealos/cmd/add.go @@ -17,9 +17,10 @@ package cmd import ( "errors" + "github.com/spf13/cobra" + "github.com/labring/sealos/pkg/apply" "github.com/labring/sealos/pkg/utils/logger" - "github.com/spf13/cobra" ) const exampleAdd = ` diff --git a/cmd/sealos/cmd/apply.go b/cmd/sealos/cmd/apply.go index 7105d5143..c88b6bedf 100644 --- a/cmd/sealos/cmd/apply.go +++ b/cmd/sealos/cmd/apply.go @@ -15,9 +15,10 @@ package cmd import ( + "github.com/spf13/cobra" + "github.com/labring/sealos/pkg/apply" "github.com/labring/sealos/pkg/utils/logger" - "github.com/spf13/cobra" ) var clusterFile string diff --git a/cmd/sealos/cmd/build.go b/cmd/sealos/cmd/build.go index 139fc6d8d..9a8dd0ebb 100644 --- a/cmd/sealos/cmd/build.go +++ b/cmd/sealos/cmd/build.go @@ -19,10 +19,11 @@ import ( "os" "runtime" + "github.com/spf13/cobra" + "github.com/labring/sealos/pkg/image" "github.com/labring/sealos/pkg/image/types" "github.com/labring/sealos/pkg/utils/logger" - "github.com/spf13/cobra" ) func newBuildCmd() *cobra.Command { diff --git a/cmd/sealos/cmd/create.go b/cmd/sealos/cmd/create.go index 8b50b0f6b..b8ee4c493 100644 --- a/cmd/sealos/cmd/create.go +++ b/cmd/sealos/cmd/create.go @@ -15,9 +15,10 @@ package cmd import ( + "github.com/spf13/cobra" + "github.com/labring/sealos/pkg/image" "github.com/labring/sealos/pkg/utils/logger" - "github.com/spf13/cobra" ) var exampleCreate = ` diff --git a/cmd/sealos/cmd/delete.go b/cmd/sealos/cmd/delete.go index 3490432b6..c6cd4851c 100644 --- a/cmd/sealos/cmd/delete.go +++ b/cmd/sealos/cmd/delete.go @@ -17,10 +17,11 @@ package cmd import ( "errors" + "github.com/spf13/cobra" + "github.com/labring/sealos/pkg/apply" "github.com/labring/sealos/pkg/apply/processor" "github.com/labring/sealos/pkg/utils/logger" - "github.com/spf13/cobra" ) var deleteArgs apply.ScaleArgs diff --git a/cmd/sealos/cmd/exec.go b/cmd/sealos/cmd/exec.go index 744cd0f66..865f4cbab 100644 --- a/cmd/sealos/cmd/exec.go +++ b/cmd/sealos/cmd/exec.go @@ -17,10 +17,11 @@ limitations under the License. package cmd import ( + "github.com/spf13/cobra" + "github.com/labring/sealos/pkg/clusterfile" "github.com/labring/sealos/pkg/types/v1beta1" "github.com/labring/sealos/pkg/utils/ssh" - "github.com/spf13/cobra" ) var roles string diff --git a/cmd/sealos/cmd/images.go b/cmd/sealos/cmd/images.go index 71b911a88..d968f0c61 100644 --- a/cmd/sealos/cmd/images.go +++ b/cmd/sealos/cmd/images.go @@ -15,8 +15,9 @@ package cmd import ( - "github.com/labring/sealos/pkg/image" "github.com/spf13/cobra" + + "github.com/labring/sealos/pkg/image" ) func newImagesCmd() *cobra.Command { diff --git a/cmd/sealos/cmd/load.go b/cmd/sealos/cmd/load.go index 9315e6156..bcaca0b7e 100644 --- a/cmd/sealos/cmd/load.go +++ b/cmd/sealos/cmd/load.go @@ -15,8 +15,9 @@ package cmd import ( - "github.com/labring/sealos/pkg/image" "github.com/spf13/cobra" + + "github.com/labring/sealos/pkg/image" ) func newLoadCmd() *cobra.Command { diff --git a/cmd/sealos/cmd/login.go b/cmd/sealos/cmd/login.go index 1072c649a..e8c84e179 100644 --- a/cmd/sealos/cmd/login.go +++ b/cmd/sealos/cmd/login.go @@ -17,9 +17,10 @@ package cmd import ( "os" + "github.com/spf13/cobra" + "github.com/labring/sealos/pkg/image" "github.com/labring/sealos/pkg/utils/logger" - "github.com/spf13/cobra" ) func newLoginCmd() *cobra.Command { diff --git a/cmd/sealos/cmd/logout.go b/cmd/sealos/cmd/logout.go index a239fd486..b498a5a6d 100644 --- a/cmd/sealos/cmd/logout.go +++ b/cmd/sealos/cmd/logout.go @@ -15,8 +15,9 @@ package cmd import ( - "github.com/labring/sealos/pkg/image" "github.com/spf13/cobra" + + "github.com/labring/sealos/pkg/image" ) func newLogoutCmd() *cobra.Command { diff --git a/cmd/sealos/cmd/prune.go b/cmd/sealos/cmd/prune.go index f0ca5f06e..f16342bc5 100644 --- a/cmd/sealos/cmd/prune.go +++ b/cmd/sealos/cmd/prune.go @@ -15,8 +15,9 @@ package cmd import ( - "github.com/labring/sealos/pkg/image" "github.com/spf13/cobra" + + "github.com/labring/sealos/pkg/image" ) func newPruneCmd() *cobra.Command { diff --git a/cmd/sealos/cmd/pull.go b/cmd/sealos/cmd/pull.go index b93f3dd48..3d9dfa359 100644 --- a/cmd/sealos/cmd/pull.go +++ b/cmd/sealos/cmd/pull.go @@ -15,8 +15,9 @@ package cmd import ( - "github.com/labring/sealos/pkg/image" "github.com/spf13/cobra" + + "github.com/labring/sealos/pkg/image" ) func newPullCmd() *cobra.Command { diff --git a/cmd/sealos/cmd/push.go b/cmd/sealos/cmd/push.go index 28ce88646..661cc9694 100644 --- a/cmd/sealos/cmd/push.go +++ b/cmd/sealos/cmd/push.go @@ -15,8 +15,9 @@ package cmd import ( - "github.com/labring/sealos/pkg/image" "github.com/spf13/cobra" + + "github.com/labring/sealos/pkg/image" ) func newPushCmd() *cobra.Command { diff --git a/cmd/sealos/cmd/reset.go b/cmd/sealos/cmd/reset.go index d4d30259c..d386ac207 100644 --- a/cmd/sealos/cmd/reset.go +++ b/cmd/sealos/cmd/reset.go @@ -15,11 +15,12 @@ package cmd import ( + "github.com/spf13/cobra" + "github.com/labring/sealos/pkg/apply" "github.com/labring/sealos/pkg/apply/processor" "github.com/labring/sealos/pkg/types/v1beta1" "github.com/labring/sealos/pkg/utils/logger" - "github.com/spf13/cobra" ) var exampleReset = ` diff --git a/cmd/sealos/cmd/rmi.go b/cmd/sealos/cmd/rmi.go index 6dd1fed7f..0caca7603 100644 --- a/cmd/sealos/cmd/rmi.go +++ b/cmd/sealos/cmd/rmi.go @@ -15,8 +15,9 @@ package cmd import ( - "github.com/labring/sealos/pkg/image" "github.com/spf13/cobra" + + "github.com/labring/sealos/pkg/image" ) func newRMICmd() *cobra.Command { diff --git a/cmd/sealos/cmd/root.go b/cmd/sealos/cmd/root.go index 3e803c86d..52718626b 100644 --- a/cmd/sealos/cmd/root.go +++ b/cmd/sealos/cmd/root.go @@ -18,11 +18,12 @@ import ( "fmt" "os" + "github.com/sirupsen/logrus" + "github.com/spf13/cobra" + "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" - "github.com/spf13/cobra" ) var ( diff --git a/cmd/sealos/cmd/run.go b/cmd/sealos/cmd/run.go index 7c5b805da..17422b685 100644 --- a/cmd/sealos/cmd/run.go +++ b/cmd/sealos/cmd/run.go @@ -15,11 +15,12 @@ package cmd import ( + "github.com/spf13/cobra" + "github.com/labring/sealos/pkg/apply" "github.com/labring/sealos/pkg/apply/processor" "github.com/labring/sealos/pkg/types/v1beta1" "github.com/labring/sealos/pkg/utils/logger" - "github.com/spf13/cobra" ) var contact = ` diff --git a/cmd/sealos/cmd/save.go b/cmd/sealos/cmd/save.go index 3fa3c99f4..f7540b07a 100644 --- a/cmd/sealos/cmd/save.go +++ b/cmd/sealos/cmd/save.go @@ -15,8 +15,9 @@ package cmd import ( - "github.com/labring/sealos/pkg/image" "github.com/spf13/cobra" + + "github.com/labring/sealos/pkg/image" ) func newSaveCmd() *cobra.Command { diff --git a/cmd/sealos/cmd/scp.go b/cmd/sealos/cmd/scp.go index 99b6e6cbf..2fb82d6b6 100644 --- a/cmd/sealos/cmd/scp.go +++ b/cmd/sealos/cmd/scp.go @@ -17,10 +17,11 @@ limitations under the License. package cmd import ( + "github.com/spf13/cobra" + "github.com/labring/sealos/pkg/clusterfile" "github.com/labring/sealos/pkg/types/v1beta1" "github.com/labring/sealos/pkg/utils/ssh" - "github.com/spf13/cobra" ) // Shared with exec.go diff --git a/cmd/sealos/cmd/tag.go b/cmd/sealos/cmd/tag.go index c39a68be2..33f7d2be7 100644 --- a/cmd/sealos/cmd/tag.go +++ b/cmd/sealos/cmd/tag.go @@ -15,8 +15,9 @@ package cmd import ( - "github.com/labring/sealos/pkg/image" "github.com/spf13/cobra" + + "github.com/labring/sealos/pkg/image" ) func newTagCmd() *cobra.Command { diff --git a/cmd/sealos/cmd/version.go b/cmd/sealos/cmd/version.go index 72bc0098e..4a7bec507 100644 --- a/cmd/sealos/cmd/version.go +++ b/cmd/sealos/cmd/version.go @@ -18,8 +18,9 @@ import ( "encoding/json" "fmt" - "github.com/labring/sealos/pkg/version" "github.com/spf13/cobra" + + "github.com/labring/sealos/pkg/version" ) var shortPrint bool diff --git a/cmd/sealos/main.go b/cmd/sealos/main.go index 13c850234..bde43dcc5 100644 --- a/cmd/sealos/main.go +++ b/cmd/sealos/main.go @@ -16,6 +16,7 @@ package main import ( "github.com/containers/buildah" + "github.com/labring/sealos/cmd/sealos/cmd" ) diff --git a/pkg/apply/applydrivers/apply_drivers_default.go b/pkg/apply/applydrivers/apply_drivers_default.go index 901251690..6e12e89a9 100644 --- a/pkg/apply/applydrivers/apply_drivers_default.go +++ b/pkg/apply/applydrivers/apply_drivers_default.go @@ -18,18 +18,17 @@ import ( "fmt" v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/version" "github.com/labring/sealos/pkg/apply/processor" - "github.com/labring/sealos/pkg/utils/iputils" - "github.com/labring/sealos/pkg/utils/logger" - "github.com/labring/sealos/pkg/utils/yaml" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "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/constants" - "k8s.io/apimachinery/pkg/version" + "github.com/labring/sealos/pkg/utils/iputils" + "github.com/labring/sealos/pkg/utils/logger" + "github.com/labring/sealos/pkg/utils/yaml" ) func NewDefaultApplier(cluster *v2.Cluster, images []string) (Interface, error) { diff --git a/pkg/apply/processor/create.go b/pkg/apply/processor/create.go index d7dd78be6..3c024fa0d 100644 --- a/pkg/apply/processor/create.go +++ b/pkg/apply/processor/create.go @@ -19,13 +19,10 @@ import ( "errors" "fmt" - "github.com/labring/sealos/pkg/checker" - "github.com/labring/sealos/pkg/utils/logger" + "golang.org/x/sync/errgroup" "k8s.io/apimachinery/pkg/util/sets" - "github.com/labring/sealos/pkg/utils/rand" - "golang.org/x/sync/errgroup" - + "github.com/labring/sealos/pkg/checker" "github.com/labring/sealos/pkg/clusterfile" "github.com/labring/sealos/pkg/config" "github.com/labring/sealos/pkg/filesystem" @@ -35,6 +32,8 @@ import ( "github.com/labring/sealos/pkg/runtime" v2 "github.com/labring/sealos/pkg/types/v1beta1" "github.com/labring/sealos/pkg/utils/constants" + "github.com/labring/sealos/pkg/utils/logger" + "github.com/labring/sealos/pkg/utils/rand" "github.com/labring/sealos/pkg/utils/yaml" ) diff --git a/pkg/apply/processor/interface.go b/pkg/apply/processor/interface.go index 36a5e6860..e39274b84 100644 --- a/pkg/apply/processor/interface.go +++ b/pkg/apply/processor/interface.go @@ -15,6 +15,8 @@ package processor import ( + "github.com/pkg/errors" + "github.com/labring/sealos/pkg/image/types" v2 "github.com/labring/sealos/pkg/types/v1beta1" "github.com/labring/sealos/pkg/utils/confirm" @@ -22,7 +24,6 @@ import ( "github.com/labring/sealos/pkg/utils/logger" "github.com/labring/sealos/pkg/utils/maps" "github.com/labring/sealos/pkg/utils/strings" - "github.com/pkg/errors" ) type Interface interface { diff --git a/pkg/apply/processor/scale.go b/pkg/apply/processor/scale.go index 36125cd37..a929daf48 100644 --- a/pkg/apply/processor/scale.go +++ b/pkg/apply/processor/scale.go @@ -18,8 +18,9 @@ import ( "context" "fmt" - "github.com/labring/sealos/pkg/checker" + "golang.org/x/sync/errgroup" + "github.com/labring/sealos/pkg/checker" "github.com/labring/sealos/pkg/clusterfile" "github.com/labring/sealos/pkg/config" "github.com/labring/sealos/pkg/filesystem" @@ -30,7 +31,6 @@ import ( "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" ) type ScaleProcessor struct { diff --git a/pkg/apply/reset.go b/pkg/apply/reset.go index 6ef390efd..fa9d10459 100644 --- a/pkg/apply/reset.go +++ b/pkg/apply/reset.go @@ -15,6 +15,8 @@ package apply import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "github.com/labring/sealos/pkg/apply/applydrivers" "github.com/labring/sealos/pkg/clusterfile" v2 "github.com/labring/sealos/pkg/types/v1beta1" @@ -22,7 +24,6 @@ import ( fileutil "github.com/labring/sealos/pkg/utils/file" "github.com/labring/sealos/pkg/utils/logger" "github.com/labring/sealos/pkg/utils/yaml" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) func NewApplierFromResetArgs(args *ResetArgs) (applydrivers.Interface, error) { diff --git a/pkg/apply/utils.go b/pkg/apply/utils.go index 2edb43e9e..18bf1963a 100644 --- a/pkg/apply/utils.go +++ b/pkg/apply/utils.go @@ -21,10 +21,11 @@ import ( "net" "strings" + "k8s.io/apimachinery/pkg/util/sets" + v2 "github.com/labring/sealos/pkg/types/v1beta1" "github.com/labring/sealos/pkg/utils/iputils" strings2 "github.com/labring/sealos/pkg/utils/strings" - "k8s.io/apimachinery/pkg/util/sets" ) func initCluster(clusterName string) *v2.Cluster { diff --git a/pkg/config/config.go b/pkg/config/config.go index 925b0c807..8bae29873 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -20,14 +20,13 @@ import ( "io/ioutil" "path/filepath" - "github.com/labring/sealos/pkg/utils/maps" - - "github.com/labring/sealos/pkg/utils/constants" + "sigs.k8s.io/yaml" "github.com/labring/sealos/pkg/types/v1beta1" + "github.com/labring/sealos/pkg/utils/constants" "github.com/labring/sealos/pkg/utils/file" "github.com/labring/sealos/pkg/utils/logger" - "sigs.k8s.io/yaml" + "github.com/labring/sealos/pkg/utils/maps" ) /* diff --git a/pkg/cri/cri.go b/pkg/cri/cri.go index bd9375769..47c685dc3 100644 --- a/pkg/cri/cri.go +++ b/pkg/cri/cri.go @@ -22,13 +22,12 @@ import ( goruntime "runtime" "strings" - "github.com/labring/sealos/pkg/utils/file" toml "github.com/pelletier/go-toml" - "github.com/pkg/errors" - errorsutil "k8s.io/apimachinery/pkg/util/errors" utilsexec "k8s.io/utils/exec" + + "github.com/labring/sealos/pkg/utils/file" ) // defaultKnownCRISockets holds the set of known CRI endpoints diff --git a/pkg/filesystem/rootfs/rootfs_default.go b/pkg/filesystem/rootfs/rootfs_default.go index 8375d1d86..a4d088b99 100644 --- a/pkg/filesystem/rootfs/rootfs_default.go +++ b/pkg/filesystem/rootfs/rootfs_default.go @@ -23,20 +23,18 @@ import ( "path" "path/filepath" - "github.com/labring/sealos/pkg/utils/iputils" - - "github.com/labring/sealos/pkg/runtime" - - "github.com/labring/sealos/pkg/utils/logger" + "github.com/pkg/errors" + "golang.org/x/sync/errgroup" "github.com/labring/sealos/pkg/env" + "github.com/labring/sealos/pkg/runtime" v2 "github.com/labring/sealos/pkg/types/v1beta1" "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/iputils" + "github.com/labring/sealos/pkg/utils/logger" "github.com/labring/sealos/pkg/utils/ssh" - "github.com/pkg/errors" - "golang.org/x/sync/errgroup" ) type defaultRootfs struct { diff --git a/pkg/guest/guest.go b/pkg/guest/guest.go index aa448ced3..3b24f28b5 100644 --- a/pkg/guest/guest.go +++ b/pkg/guest/guest.go @@ -19,21 +19,19 @@ import ( "path/filepath" "strings" - "github.com/labring/sealos/pkg/utils/logger" - - "github.com/labring/sealos/pkg/utils/exec" - fileutil "github.com/labring/sealos/pkg/utils/file" "github.com/pkg/errors" "k8s.io/client-go/util/homedir" "github.com/labring/sealos/fork/golang/expansion" - "github.com/labring/sealos/pkg/env" "github.com/labring/sealos/pkg/image" "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/constants" + "github.com/labring/sealos/pkg/utils/exec" + fileutil "github.com/labring/sealos/pkg/utils/file" + "github.com/labring/sealos/pkg/utils/logger" "github.com/labring/sealos/pkg/utils/maps" ) diff --git a/pkg/hosts/hosts.go b/pkg/hosts/hosts.go index d11672808..7168afc15 100644 --- a/pkg/hosts/hosts.go +++ b/pkg/hosts/hosts.go @@ -24,10 +24,10 @@ import ( "strings" "github.com/emirpasic/gods/maps/linkedhashmap" - strings2 "github.com/labring/sealos/pkg/utils/strings" "github.com/labring/sealos/pkg/utils/file" "github.com/labring/sealos/pkg/utils/logger" + strings2 "github.com/labring/sealos/pkg/utils/strings" ) type HostFile struct { diff --git a/pkg/image/binary/cluster.go b/pkg/image/binary/cluster.go index 73b1ff225..87abee9d2 100644 --- a/pkg/image/binary/cluster.go +++ b/pkg/image/binary/cluster.go @@ -19,14 +19,13 @@ package binary import ( "fmt" - "github.com/labring/sealos/pkg/utils/logger" - - "github.com/labring/sealos/pkg/image/types" - - "github.com/labring/sealos/pkg/utils/exec" "github.com/pkg/errors" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/util/json" + + "github.com/labring/sealos/pkg/image/types" + "github.com/labring/sealos/pkg/utils/exec" + "github.com/labring/sealos/pkg/utils/logger" ) type ClusterService struct { diff --git a/pkg/image/binary/image.go b/pkg/image/binary/image.go index 928cd744d..19d695bd0 100644 --- a/pkg/image/binary/image.go +++ b/pkg/image/binary/image.go @@ -24,21 +24,19 @@ import ( "path/filepath" "strings" - "github.com/labring/sealos/pkg/buildimage" - "github.com/labring/sealos/pkg/registry" - "github.com/labring/sealos/pkg/utils/constants" - "github.com/labring/sealos/pkg/utils/logger" - - fileutil "github.com/labring/sealos/pkg/utils/file" - - "github.com/labring/sealos/pkg/image/types" - - "github.com/labring/sealos/pkg/utils/exec" - json2 "github.com/labring/sealos/pkg/utils/json" v1 "github.com/opencontainers/image-spec/specs-go/v1" "github.com/pkg/errors" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/util/json" + + "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/constants" + "github.com/labring/sealos/pkg/utils/exec" + fileutil "github.com/labring/sealos/pkg/utils/file" + json2 "github.com/labring/sealos/pkg/utils/json" + "github.com/labring/sealos/pkg/utils/logger" ) // ImageService is the default service, which is used for image pull/push diff --git a/pkg/image/buildah.go b/pkg/image/buildah.go index bf7fcc431..6071e8495 100644 --- a/pkg/image/buildah.go +++ b/pkg/image/buildah.go @@ -17,9 +17,10 @@ limitations under the License. package image import ( + "github.com/pkg/errors" + "github.com/labring/sealos/pkg/utils/exec" fileutil "github.com/labring/sealos/pkg/utils/file" - "github.com/pkg/errors" ) func initBuildah() (bool, error) { diff --git a/pkg/image/buildah/cluster/create.go b/pkg/image/buildah/cluster/create.go index 1b2f33f9f..5dbff334b 100644 --- a/pkg/image/buildah/cluster/create.go +++ b/pkg/image/buildah/cluster/create.go @@ -17,9 +17,10 @@ limitations under the License. package cluster import ( + "github.com/pkg/errors" + bb "github.com/labring/sealos/pkg/image/buildah/cluster/buildah" "github.com/labring/sealos/pkg/image/types" - "github.com/pkg/errors" ) func (c *Service) Create(name string, image string) (*types.ClusterManifest, error) { diff --git a/pkg/image/buildah/cluster/delete.go b/pkg/image/buildah/cluster/delete.go index 72c4902e9..600107b9b 100644 --- a/pkg/image/buildah/cluster/delete.go +++ b/pkg/image/buildah/cluster/delete.go @@ -17,10 +17,10 @@ limitations under the License. package cluster import ( - bb "github.com/labring/sealos/pkg/image/buildah/cluster/buildah" - - "github.com/labring/sealos/pkg/utils/logger" "github.com/pkg/errors" + + bb "github.com/labring/sealos/pkg/image/buildah/cluster/buildah" + "github.com/labring/sealos/pkg/utils/logger" ) func (c *Service) Delete(name string) error { diff --git a/pkg/image/buildah/cluster/inspect.go b/pkg/image/buildah/cluster/inspect.go index 80d555dcd..6b26a18b2 100644 --- a/pkg/image/buildah/cluster/inspect.go +++ b/pkg/image/buildah/cluster/inspect.go @@ -16,10 +16,10 @@ limitations under the License. package cluster import ( - bb "github.com/labring/sealos/pkg/image/buildah/cluster/buildah" - - "github.com/labring/sealos/pkg/image/types" "github.com/pkg/errors" + + bb "github.com/labring/sealos/pkg/image/buildah/cluster/buildah" + "github.com/labring/sealos/pkg/image/types" ) func (*Service) Inspect(name string) (*types.ClusterManifest, error) { diff --git a/pkg/image/buildah/cluster/list.go b/pkg/image/buildah/cluster/list.go index 9327c89bb..c572324f4 100644 --- a/pkg/image/buildah/cluster/list.go +++ b/pkg/image/buildah/cluster/list.go @@ -18,10 +18,10 @@ package cluster import ( "encoding/json" - bb "github.com/labring/sealos/pkg/image/buildah/cluster/buildah" - - "github.com/labring/sealos/pkg/image/types" "github.com/pkg/errors" + + bb "github.com/labring/sealos/pkg/image/buildah/cluster/buildah" + "github.com/labring/sealos/pkg/image/types" ) func (*Service) List() ([]types.ClusterInfo, error) { diff --git a/pkg/image/buildah/image/build.go b/pkg/image/buildah/image/build.go index acfec177e..f1d2478a6 100644 --- a/pkg/image/buildah/image/build.go +++ b/pkg/image/buildah/image/build.go @@ -16,33 +16,30 @@ package image import ( "context" + "io" + "io/ioutil" + "os" + "path" + "path/filepath" + "strings" + "time" "github.com/containers/buildah/define" "github.com/containers/buildah/imagebuildah" buildahcli "github.com/containers/buildah/pkg/cli" "github.com/containers/buildah/pkg/parse" buildahutil "github.com/containers/buildah/pkg/util" - - "io" - "io/ioutil" - "path/filepath" - "time" - + "github.com/containers/common/pkg/auth" image_types "github.com/containers/image/v5/types" + v1 "github.com/opencontainers/image-spec/specs-go/v1" + "github.com/pkg/errors" "github.com/sirupsen/logrus" - "os" - "path" - "strings" - - "github.com/containers/common/pkg/auth" "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/constants" "github.com/labring/sealos/pkg/utils/logger" - v1 "github.com/opencontainers/image-spec/specs-go/v1" - "github.com/pkg/errors" ) func (d *Service) Build(options *types.BuildOptions, contextDir, imageName string) error { diff --git a/pkg/image/buildah/image/common.go b/pkg/image/buildah/image/common.go index 05762eb03..1db453833 100644 --- a/pkg/image/buildah/image/common.go +++ b/pkg/image/buildah/image/common.go @@ -22,20 +22,19 @@ import ( "strings" "time" - "github.com/containers/buildah/pkg/formats" - "github.com/containers/common/libimage" - "github.com/docker/go-units" - "github.com/containers/buildah" "github.com/containers/buildah/define" + "github.com/containers/buildah/pkg/formats" + "github.com/containers/common/libimage" "github.com/containers/image/v5/types" encconfig "github.com/containers/ocicrypt/config" enchelpers "github.com/containers/ocicrypt/helpers" - labring_types "github.com/labring/sealos/pkg/image/types" - "github.com/containers/storage" "github.com/containers/storage/pkg/unshare" + "github.com/docker/go-units" "github.com/pkg/errors" + + labring_types "github.com/labring/sealos/pkg/image/types" ) const ( diff --git a/pkg/image/buildah/image/image.go b/pkg/image/buildah/image/image.go index 44c35a9b2..146c707bc 100644 --- a/pkg/image/buildah/image/image.go +++ b/pkg/image/buildah/image/image.go @@ -24,11 +24,10 @@ import ( "github.com/containers/buildah/pkg/formats" "github.com/containers/common/libimage" image_types "github.com/containers/image/v5/types" - "github.com/docker/go-units" - "github.com/labring/sealos/pkg/image/types" - "github.com/pkg/errors" + + "github.com/labring/sealos/pkg/image/types" ) const none = "" diff --git a/pkg/image/buildah/image/inspect.go b/pkg/image/buildah/image/inspect.go index b7170b492..36a136422 100644 --- a/pkg/image/buildah/image/inspect.go +++ b/pkg/image/buildah/image/inspect.go @@ -19,12 +19,13 @@ import ( "github.com/containers/buildah" image_types "github.com/containers/image/v5/types" - "github.com/labring/sealos/pkg/image/types" - json2 "github.com/labring/sealos/pkg/utils/json" - "github.com/labring/sealos/pkg/utils/logger" v1 "github.com/opencontainers/image-spec/specs-go/v1" "github.com/pkg/errors" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + + "github.com/labring/sealos/pkg/image/types" + json2 "github.com/labring/sealos/pkg/utils/json" + "github.com/labring/sealos/pkg/utils/logger" ) const ( diff --git a/pkg/image/buildah/image/load.go b/pkg/image/buildah/image/load.go index 2718ee19c..032f951ad 100644 --- a/pkg/image/buildah/image/load.go +++ b/pkg/image/buildah/image/load.go @@ -25,9 +25,10 @@ import ( "github.com/containers/buildah/pkg/parse" "github.com/containers/common/pkg/auth" image_types "github.com/containers/image/v5/types" + "github.com/pkg/errors" + labring_types "github.com/labring/sealos/pkg/image/types" "github.com/labring/sealos/pkg/utils/logger" - "github.com/pkg/errors" ) func (d *Service) Load(archiveName string) error { diff --git a/pkg/image/buildah/image/manifest.go b/pkg/image/buildah/image/manifest.go index 09d830ebb..bb5df853a 100644 --- a/pkg/image/buildah/image/manifest.go +++ b/pkg/image/buildah/image/manifest.go @@ -18,24 +18,23 @@ import ( "bytes" "context" "encoding/json" - - "github.com/containers/buildah/util" - cp "github.com/containers/image/v5/copy" - "io/ioutil" "os" + "github.com/containers/buildah/util" "github.com/containers/common/libimage" "github.com/containers/common/libimage/manifests" + cp "github.com/containers/image/v5/copy" "github.com/containers/image/v5/manifest" "github.com/containers/image/v5/transports" "github.com/containers/image/v5/transports/alltransports" "github.com/containers/image/v5/types" "github.com/containers/storage" - labring_types "github.com/labring/sealos/pkg/image/types" imgspecv1 "github.com/opencontainers/image-spec/specs-go/v1" "github.com/pkg/errors" "github.com/sirupsen/logrus" + + labring_types "github.com/labring/sealos/pkg/image/types" ) func manifestInspect(ctx context.Context, store storage.Store, systemContext *types.SystemContext, imageSpec string) (string, error) { diff --git a/pkg/image/buildah/image/root.go b/pkg/image/buildah/image/root.go index 73b58a10f..7ca49213d 100644 --- a/pkg/image/buildah/image/root.go +++ b/pkg/image/buildah/image/root.go @@ -22,9 +22,10 @@ import ( is "github.com/containers/image/v5/storage" "github.com/containers/storage" "github.com/containers/storage/pkg/unshare" - "github.com/labring/sealos/pkg/image/types" "github.com/pkg/errors" "github.com/sirupsen/logrus" + + "github.com/labring/sealos/pkg/image/types" ) // Service is the default service, which is used for image pull/push diff --git a/pkg/infra/aliyun/ali_ecs.go b/pkg/infra/aliyun/ali_ecs.go index 46896f128..b4c1aa986 100644 --- a/pkg/infra/aliyun/ali_ecs.go +++ b/pkg/infra/aliyun/ali_ecs.go @@ -20,13 +20,12 @@ import ( "strconv" "strings" - strings2 "github.com/labring/sealos/pkg/utils/strings" - - "github.com/labring/sealos/pkg/utils/logger" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" "github.com/aliyun/alibaba-cloud-sdk-go/services/ecs" + "github.com/labring/sealos/pkg/types/v1beta1" + "github.com/labring/sealos/pkg/utils/logger" + strings2 "github.com/labring/sealos/pkg/utils/strings" ) type Instance struct { diff --git a/pkg/infra/aliyun/ali_image.go b/pkg/infra/aliyun/ali_image.go index e141c54f1..4b8b0b8ae 100644 --- a/pkg/infra/aliyun/ali_image.go +++ b/pkg/infra/aliyun/ali_image.go @@ -18,13 +18,12 @@ import ( "fmt" "strings" - "github.com/labring/sealos/pkg/utils/rand" - - "github.com/labring/sealos/pkg/utils/logger" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" "github.com/aliyun/alibaba-cloud-sdk-go/services/ecs" + "github.com/labring/sealos/pkg/types/v1beta1" + "github.com/labring/sealos/pkg/utils/logger" + "github.com/labring/sealos/pkg/utils/rand" ) func (a *AliProvider) GetAvailableImageID(host *v1beta1.InfraHost) (string, error) { diff --git a/pkg/infra/aliyun/ali_provider.go b/pkg/infra/aliyun/ali_provider.go index 7f8a04242..5914d494f 100644 --- a/pkg/infra/aliyun/ali_provider.go +++ b/pkg/infra/aliyun/ali_provider.go @@ -17,21 +17,16 @@ package aliyun import ( "strings" - "github.com/labring/sealos/pkg/utils/rand" - - "github.com/labring/sealos/pkg/utils/logger" - - "github.com/labring/sealos/pkg/types/validation" - - "k8s.io/apimachinery/pkg/util/validation/field" - - "k8s.io/apimachinery/pkg/util/sets" - - "github.com/pkg/errors" - "github.com/aliyun/alibaba-cloud-sdk-go/services/ecs" "github.com/aliyun/alibaba-cloud-sdk-go/services/vpc" + "github.com/pkg/errors" + "k8s.io/apimachinery/pkg/util/sets" + "k8s.io/apimachinery/pkg/util/validation/field" + "github.com/labring/sealos/pkg/types/v1beta1" + "github.com/labring/sealos/pkg/types/validation" + "github.com/labring/sealos/pkg/utils/logger" + "github.com/labring/sealos/pkg/utils/rand" ) type ActionName string diff --git a/pkg/infra/aliyun/ali_vpc.go b/pkg/infra/aliyun/ali_vpc.go index 3540841f9..eaebb3a48 100644 --- a/pkg/infra/aliyun/ali_vpc.go +++ b/pkg/infra/aliyun/ali_vpc.go @@ -18,15 +18,13 @@ import ( "errors" "fmt" - "github.com/labring/sealos/pkg/utils/rand" - - "github.com/labring/sealos/pkg/utils/logger" - - "github.com/aliyun/alibaba-cloud-sdk-go/services/ecs" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/services/ecs" "github.com/aliyun/alibaba-cloud-sdk-go/services/vpc" + "github.com/labring/sealos/pkg/types/v1beta1" + "github.com/labring/sealos/pkg/utils/logger" + "github.com/labring/sealos/pkg/utils/rand" ) func (a *AliProvider) CreateVPC() error { diff --git a/pkg/infra/huawei/hw_provider.go b/pkg/infra/huawei/hw_provider.go index d3bb04194..802a2ae47 100644 --- a/pkg/infra/huawei/hw_provider.go +++ b/pkg/infra/huawei/hw_provider.go @@ -17,18 +17,15 @@ package huawei import ( "fmt" - "github.com/labring/sealos/pkg/utils/rand" - - "github.com/labring/sealos/pkg/utils/logger" - - "k8s.io/apimachinery/pkg/util/validation/field" - "github.com/huaweicloud/huaweicloud-sdk-go-v3/core" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" ecs "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/ecs/v2" - v2 "github.com/labring/sealos/pkg/types/v1beta1" - vpc "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/vpc/v2" + "k8s.io/apimachinery/pkg/util/validation/field" + + v2 "github.com/labring/sealos/pkg/types/v1beta1" + "github.com/labring/sealos/pkg/utils/logger" + "github.com/labring/sealos/pkg/utils/rand" ) type ActionName string diff --git a/pkg/infra/huawei/retry.go b/pkg/infra/huawei/retry.go index 1e468eb9d..d43cdf639 100644 --- a/pkg/infra/huawei/retry.go +++ b/pkg/infra/huawei/retry.go @@ -15,12 +15,12 @@ package huawei import ( - "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/def" - "github.com/labring/sealos/pkg/utils/retry" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" "github.com/aliyun/alibaba-cloud-sdk-go/services/ecs" + "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/def" + + "github.com/labring/sealos/pkg/utils/retry" ) func (a *HwProvider) RetryVpcRequest(request interface{}, def *def.HttpRequestDef) (interface{}, error) { diff --git a/pkg/registry/util.go b/pkg/registry/util.go index 089082bd6..f866cb39a 100644 --- a/pkg/registry/util.go +++ b/pkg/registry/util.go @@ -18,11 +18,11 @@ import ( "fmt" "strings" - "github.com/labring/sealos/pkg/utils/logger" - "github.com/docker/docker/api/types" - fileutil "github.com/labring/sealos/pkg/utils/file" "k8s.io/apimachinery/pkg/util/json" + + fileutil "github.com/labring/sealos/pkg/utils/file" + "github.com/labring/sealos/pkg/utils/logger" ) //this package contains some utils to handle docker image name diff --git a/pkg/runtime/image_shim.go b/pkg/runtime/image_shim.go index 49bea507c..566824dde 100644 --- a/pkg/runtime/image_shim.go +++ b/pkg/runtime/image_shim.go @@ -20,10 +20,11 @@ import ( "fmt" "path" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "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" ) var defaultRootDirectory = "/var/lib/image-cri-shim" diff --git a/pkg/runtime/kubeadm.go b/pkg/runtime/kubeadm.go index 9bb0687d5..7f190b956 100644 --- a/pkg/runtime/kubeadm.go +++ b/pkg/runtime/kubeadm.go @@ -21,23 +21,20 @@ import ( "strings" "time" - "github.com/labring/sealos/pkg/utils/iputils" - - fileutil "github.com/labring/sealos/pkg/utils/file" - - "github.com/labring/sealos/pkg/runtime/apis/kubeadm/v1beta2" - "github.com/labring/sealos/pkg/runtime/apis/kubeadm/v1beta3" "github.com/pkg/errors" - - "github.com/labring/sealos/pkg/utils/constants" + "k8s.io/apimachinery/pkg/util/json" "github.com/labring/sealos/pkg/runtime/apis/kubeadm" + "github.com/labring/sealos/pkg/runtime/apis/kubeadm/v1beta2" + "github.com/labring/sealos/pkg/runtime/apis/kubeadm/v1beta3" "github.com/labring/sealos/pkg/token" + "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" strings2 "github.com/labring/sealos/pkg/utils/strings" "github.com/labring/sealos/pkg/utils/versionutil" "github.com/labring/sealos/pkg/utils/yaml" - "k8s.io/apimachinery/pkg/util/json" ) const ( diff --git a/pkg/runtime/kubeadm_config.go b/pkg/runtime/kubeadm_config.go index ce821149e..bebf01990 100644 --- a/pkg/runtime/kubeadm_config.go +++ b/pkg/runtime/kubeadm_config.go @@ -22,17 +22,17 @@ import ( "path/filepath" "strings" + "github.com/imdario/mergo" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + k8sruntime "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/util/yaml" + "k8s.io/kube-proxy/config/v1alpha1" + "k8s.io/kubelet/config/v1beta1" + + "github.com/labring/sealos/pkg/runtime/apis/kubeadm" v2 "github.com/labring/sealos/pkg/types/v1beta1" "github.com/labring/sealos/pkg/utils/file" "github.com/labring/sealos/pkg/utils/logger" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/util/yaml" - - "github.com/imdario/mergo" - "github.com/labring/sealos/pkg/runtime/apis/kubeadm" - k8sruntime "k8s.io/apimachinery/pkg/runtime" - "k8s.io/kube-proxy/config/v1alpha1" - "k8s.io/kubelet/config/v1beta1" ) // https://github.com/kubernetes/kubernetes/blob/master/cmd/kubeadm/app/apis/kubeadm/v1beta2/types.go diff --git a/pkg/runtime/master.go b/pkg/runtime/master.go index 21fb0fe41..9f4ae6187 100644 --- a/pkg/runtime/master.go +++ b/pkg/runtime/master.go @@ -20,13 +20,14 @@ import ( "path" "sync" + "github.com/pkg/errors" + "golang.org/x/sync/errgroup" + "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" "github.com/labring/sealos/pkg/utils/strings" - "github.com/pkg/errors" - "golang.org/x/sync/errgroup" ) func (k *KubeadmRuntime) InitMaster0() error { diff --git a/pkg/runtime/node.go b/pkg/runtime/node.go index a66c42fd5..12c5f079c 100644 --- a/pkg/runtime/node.go +++ b/pkg/runtime/node.go @@ -19,12 +19,13 @@ import ( "fmt" "path" + "github.com/pkg/errors" + "golang.org/x/sync/errgroup" + "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" - "github.com/pkg/errors" - "golang.org/x/sync/errgroup" ) func (k *KubeadmRuntime) joinNodes(newNodesIPList []string) error { diff --git a/pkg/runtime/registry.go b/pkg/runtime/registry.go index 67d3ff0de..2c0defc15 100644 --- a/pkg/runtime/registry.go +++ b/pkg/runtime/registry.go @@ -18,18 +18,15 @@ import ( "fmt" "path" - "github.com/labring/sealos/pkg/types/v1beta1" - - "github.com/labring/sealos/pkg/utils/iputils" - - "github.com/labring/sealos/pkg/utils/constants" - "github.com/labring/sealos/pkg/utils/yaml" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "github.com/labring/sealos/pkg/passwd" + "github.com/labring/sealos/pkg/types/v1beta1" + "github.com/labring/sealos/pkg/utils/constants" "github.com/labring/sealos/pkg/utils/file" - + "github.com/labring/sealos/pkg/utils/iputils" "github.com/labring/sealos/pkg/utils/logger" + "github.com/labring/sealos/pkg/utils/yaml" ) func GetRegistry(rootfs, defaultRegistry string) *v1beta1.RegistryConfig { diff --git a/pkg/runtime/reset.go b/pkg/runtime/reset.go index 8d2ada172..924eac633 100644 --- a/pkg/runtime/reset.go +++ b/pkg/runtime/reset.go @@ -18,8 +18,9 @@ import ( "context" "fmt" - "github.com/labring/sealos/pkg/utils/logger" "golang.org/x/sync/errgroup" + + "github.com/labring/sealos/pkg/utils/logger" ) const ( diff --git a/pkg/runtime/runtime_getter.go b/pkg/runtime/runtime_getter.go index 57879b711..c4ab43fbe 100644 --- a/pkg/runtime/runtime_getter.go +++ b/pkg/runtime/runtime_getter.go @@ -21,17 +21,15 @@ import ( "fmt" "strings" - "github.com/labring/sealos/pkg/types/v1beta1" - - "github.com/labring/sealos/pkg/utils/iputils" - - "github.com/labring/sealos/pkg/utils/logger" + "golang.org/x/sync/errgroup" "github.com/labring/sealos/pkg/env" "github.com/labring/sealos/pkg/remote" + "github.com/labring/sealos/pkg/types/v1beta1" "github.com/labring/sealos/pkg/utils/constants" + "github.com/labring/sealos/pkg/utils/iputils" + "github.com/labring/sealos/pkg/utils/logger" "github.com/labring/sealos/pkg/utils/ssh" - "golang.org/x/sync/errgroup" ) func (k *KubeadmRuntime) getRegistry() *v1beta1.RegistryConfig { diff --git a/pkg/runtime/static_files.go b/pkg/runtime/static_files.go index d9c0736ce..8191a8867 100644 --- a/pkg/runtime/static_files.go +++ b/pkg/runtime/static_files.go @@ -19,8 +19,9 @@ import ( "fmt" "path/filepath" - "github.com/labring/sealos/pkg/utils/logger" "golang.org/x/sync/errgroup" + + "github.com/labring/sealos/pkg/utils/logger" ) const ( diff --git a/pkg/runtime/utils.go b/pkg/runtime/utils.go index a05801e72..7022f976c 100644 --- a/pkg/runtime/utils.go +++ b/pkg/runtime/utils.go @@ -20,15 +20,15 @@ import ( "context" "fmt" - "github.com/labring/sealos/pkg/utils/iputils" - - "github.com/labring/sealos/pkg/client-go/kubernetes" - "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" "k8s.io/apimachinery/pkg/api/errors" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + "github.com/labring/sealos/pkg/client-go/kubernetes" + "github.com/labring/sealos/pkg/utils/constants" + "github.com/labring/sealos/pkg/utils/iputils" + "github.com/labring/sealos/pkg/utils/logger" ) const ( diff --git a/pkg/token/token.go b/pkg/token/token.go index 2304c0f35..d839c1c37 100644 --- a/pkg/token/token.go +++ b/pkg/token/token.go @@ -22,13 +22,12 @@ import ( "time" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/sets" v1 "github.com/labring/sealos/pkg/token/bootstraptoken/v1" - "github.com/labring/sealos/pkg/utils/exec" "github.com/labring/sealos/pkg/utils/file" "github.com/labring/sealos/pkg/utils/yaml" - "k8s.io/apimachinery/pkg/util/sets" ) type Token struct { diff --git a/pkg/types/v1beta1/defaults_infra.go b/pkg/types/v1beta1/defaults_infra.go index 45b43a465..c6af8d1f1 100644 --- a/pkg/types/v1beta1/defaults_infra.go +++ b/pkg/types/v1beta1/defaults_infra.go @@ -20,8 +20,9 @@ import ( "math/rand" "time" - "github.com/labring/sealos/pkg/utils/strings" "k8s.io/apimachinery/pkg/util/sets" + + "github.com/labring/sealos/pkg/utils/strings" ) const ( diff --git a/pkg/types/validation/validation_infra.go b/pkg/types/validation/validation_infra.go index 5badafa54..b577e5674 100644 --- a/pkg/types/validation/validation_infra.go +++ b/pkg/types/validation/validation_infra.go @@ -17,11 +17,12 @@ package validation import ( "strings" - "github.com/labring/sealos/pkg/types/v1beta1" apiequality "k8s.io/apimachinery/pkg/api/equality" apimachineryvalidation "k8s.io/apimachinery/pkg/api/validation" "k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/validation/field" + + "github.com/labring/sealos/pkg/types/v1beta1" ) // ValidateInfraName validates that the given name can be used as a infra name. diff --git a/pkg/utils/decode/decode.go b/pkg/utils/decode/decode.go index e5b918cb6..b79c34a29 100644 --- a/pkg/utils/decode/decode.go +++ b/pkg/utils/decode/decode.go @@ -19,11 +19,12 @@ import ( "fmt" "io" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/util/yaml" + "github.com/labring/sealos/pkg/types/v1beta1" "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) { diff --git a/pkg/utils/flags/flags.go b/pkg/utils/flags/flags.go index ca3849cac..7f7306633 100644 --- a/pkg/utils/flags/flags.go +++ b/pkg/utils/flags/flags.go @@ -17,8 +17,9 @@ limitations under the License. package flags import ( - "github.com/labring/sealos/pkg/utils/logger" "github.com/spf13/pflag" + + "github.com/labring/sealos/pkg/utils/logger" ) // PrintFlags logs the flags in the flagset diff --git a/pkg/utils/json/json.go b/pkg/utils/json/json.go index 82c2198fc..ef3fbfe90 100644 --- a/pkg/utils/json/json.go +++ b/pkg/utils/json/json.go @@ -17,9 +17,10 @@ limitations under the License. package json import ( - "github.com/labring/sealos/pkg/utils/file" "github.com/pkg/errors" "k8s.io/apimachinery/pkg/util/json" + + "github.com/labring/sealos/pkg/utils/file" ) func Unmarshal(path string) (map[string]interface{}, error) { diff --git a/pkg/utils/ssh/exec.go b/pkg/utils/ssh/exec.go index 6cd01c77a..011685419 100644 --- a/pkg/utils/ssh/exec.go +++ b/pkg/utils/ssh/exec.go @@ -21,9 +21,10 @@ import ( "fmt" "strings" + "golang.org/x/sync/errgroup" + v2 "github.com/labring/sealos/pkg/types/v1beta1" "github.com/labring/sealos/pkg/utils/logger" - "golang.org/x/sync/errgroup" ) type Exec struct { diff --git a/pkg/utils/ssh/scp.go b/pkg/utils/ssh/scp.go index ec040fa9b..d02d45346 100644 --- a/pkg/utils/ssh/scp.go +++ b/pkg/utils/ssh/scp.go @@ -23,17 +23,15 @@ import ( "path/filepath" "strings" - "github.com/labring/sealos/pkg/utils/hash" + "github.com/pkg/sftp" + "github.com/schollz/progressbar/v3" + "golang.org/x/crypto/ssh" "github.com/labring/sealos/pkg/utils/file" + "github.com/labring/sealos/pkg/utils/hash" "github.com/labring/sealos/pkg/utils/iputils" - "github.com/labring/sealos/pkg/utils/logger" "github.com/labring/sealos/pkg/utils/progress" - "github.com/schollz/progressbar/v3" - - "github.com/pkg/sftp" - "golang.org/x/crypto/ssh" ) func (s *SSH) RemoteMd5Sum(host, remoteFilePath string) string { diff --git a/pkg/utils/toml/toml.go b/pkg/utils/toml/toml.go index d0edcd76a..ad80b43cc 100644 --- a/pkg/utils/toml/toml.go +++ b/pkg/utils/toml/toml.go @@ -17,8 +17,9 @@ limitations under the License. package toml import ( - fileutil "github.com/labring/sealos/pkg/utils/file" "github.com/pelletier/go-toml" + + fileutil "github.com/labring/sealos/pkg/utils/file" ) func MarshalTomlToFile(file string, obj interface{}) error { diff --git a/pkg/utils/yaml/yaml.go b/pkg/utils/yaml/yaml.go index 260c8cbe8..93960f988 100644 --- a/pkg/utils/yaml/yaml.go +++ b/pkg/utils/yaml/yaml.go @@ -23,11 +23,11 @@ import ( "path/filepath" "strings" - fileutil "github.com/labring/sealos/pkg/utils/file" - "sigs.k8s.io/yaml" - "k8s.io/apimachinery/pkg/runtime" utilyaml "k8s.io/apimachinery/pkg/util/yaml" + "sigs.k8s.io/yaml" + + fileutil "github.com/labring/sealos/pkg/utils/file" ) func Unmarshal(path string) (map[string]interface{}, error) {