* Update cmd typos to match unified code format.
* 1. Update Dockerfile install typo
2. run&fix `make format` on all files
This commit is contained in:
zzjin
2022-06-24 22:44:12 +08:00
committed by GitHub
parent 3b83b36a7e
commit 2ef083dfc3
88 changed files with 251 additions and 236 deletions
+2 -2
View File
@@ -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}
+2 -1
View File
@@ -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 {
+3 -2
View File
@@ -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 (
+2 -1
View File
@@ -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 {
+2 -1
View File
@@ -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
+2 -1
View File
@@ -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
+2 -1
View File
@@ -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 {
+2 -1
View File
@@ -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 {
+3 -2
View File
@@ -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 (
+2 -1
View File
@@ -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 (
+2 -1
View File
@@ -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 (
+2 -1
View File
@@ -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
+3 -2
View File
@@ -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 {
+2 -1
View File
@@ -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
+2 -1
View File
@@ -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 = `
+2 -1
View File
@@ -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
+2 -1
View File
@@ -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 {
+2 -1
View File
@@ -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 = `
+2 -1
View File
@@ -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
+2 -1
View File
@@ -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
+2 -1
View File
@@ -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 {
+2 -1
View File
@@ -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 {
+2 -1
View File
@@ -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 {
+2 -1
View File
@@ -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 {
+2 -1
View File
@@ -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 {
+2 -1
View File
@@ -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 {
+2 -1
View File
@@ -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 {
+2 -1
View File
@@ -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 = `
+2 -1
View File
@@ -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 {
+3 -2
View File
@@ -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 (
+2 -1
View File
@@ -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 = `
+2 -1
View File
@@ -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 {
+2 -1
View File
@@ -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
+2 -1
View File
@@ -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 {
+2 -1
View File
@@ -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
+1
View File
@@ -16,6 +16,7 @@ package main
import (
"github.com/containers/buildah"
"github.com/labring/sealos/cmd/sealos/cmd"
)
@@ -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) {
+4 -5
View File
@@ -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"
)
+2 -1
View File
@@ -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 {
+2 -2
View File
@@ -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 {
+2 -1
View File
@@ -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) {
+2 -1
View File
@@ -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 {
+3 -4
View File
@@ -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"
)
/*
+2 -3
View File
@@ -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
+5 -7
View File
@@ -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 {
+3 -5
View File
@@ -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"
)
+1 -1
View File
@@ -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 {
+4 -5
View File
@@ -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 {
+9 -11
View File
@@ -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
+2 -1
View File
@@ -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) {
+2 -1
View File
@@ -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) {
+3 -3
View File
@@ -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 {
+3 -3
View File
@@ -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) {
+3 -3
View File
@@ -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) {
+10 -13
View File
@@ -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 {
+5 -6
View File
@@ -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 (
+2 -3
View File
@@ -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 = "<none>"
+4 -3
View File
@@ -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 (
+2 -1
View File
@@ -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 {
+4 -5
View File
@@ -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) {
+2 -1
View File
@@ -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
+3 -4
View File
@@ -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 {
+3 -4
View File
@@ -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) {
+7 -12
View File
@@ -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
+4 -6
View File
@@ -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 {
+5 -8
View File
@@ -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
+3 -3
View File
@@ -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) {
+3 -3
View File
@@ -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
+2 -1
View File
@@ -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"
+6 -9
View File
@@ -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 (
+8 -8
View File
@@ -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
+3 -2
View File
@@ -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 {
+3 -2
View File
@@ -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 {
+4 -7
View File
@@ -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 {
+2 -1
View File
@@ -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 (
+4 -6
View File
@@ -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 {
+2 -1
View File
@@ -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 (
+5 -5
View File
@@ -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 (
+1 -2
View File
@@ -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 {
+2 -1
View File
@@ -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 (
+2 -1
View File
@@ -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.
+3 -2
View File
@@ -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) {
+2 -1
View File
@@ -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
+2 -1
View File
@@ -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) {
+2 -1
View File
@@ -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 {
+4 -6
View File
@@ -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 {
+2 -1
View File
@@ -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 {
+3 -3
View File
@@ -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) {