diff --git a/cmd/image-cri-shim/cmd/root.go b/cmd/image-cri-shim/cmd/root.go index 6eaba4f4168..cc6feb8232d 100644 --- a/cmd/image-cri-shim/cmd/root.go +++ b/cmd/image-cri-shim/cmd/root.go @@ -22,15 +22,12 @@ import ( "os/signal" "syscall" - "github.com/labring/image-cri-shim/pkg/types" - - "github.com/labring/sealos/pkg/version" - "github.com/labring/image-cri-shim/pkg/shim" - "github.com/pkg/errors" + "github.com/labring/image-cri-shim/pkg/types" "github.com/spf13/cobra" "github.com/labring/sealos/pkg/utils/logger" + "github.com/labring/sealos/pkg/version" ) var cfg *types.Config @@ -50,7 +47,7 @@ var rootCmd = &cobra.Command{ var err error cfg, err = types.Unmarshal(cfgFile) if err != nil { - return errors.Wrap(err, "image shim config load error") + return fmt.Errorf("image shim config load error: %w", err) } if err = cfg.PreProcess(); err != nil { diff --git a/cmd/sealos/cmd/version.go b/cmd/sealos/cmd/version.go index 63765ec34b5..b921fbea8d6 100644 --- a/cmd/sealos/cmd/version.go +++ b/cmd/sealos/cmd/version.go @@ -16,21 +16,17 @@ package cmd import ( "encoding/json" + "errors" "fmt" "strings" - "github.com/labring/sealos/pkg/utils/logger" - - "github.com/pkg/errors" - + "github.com/spf13/cobra" "sigs.k8s.io/yaml" "github.com/labring/sealos/pkg/clusterfile" "github.com/labring/sealos/pkg/constants" - + "github.com/labring/sealos/pkg/utils/logger" "github.com/labring/sealos/pkg/version" - - "github.com/spf13/cobra" ) var shortPrint bool @@ -88,19 +84,19 @@ func PrintInfo() error { case "yaml": marshalled, err = yaml.Marshal(&OutputInfo) if err != nil { - return errors.Wrap(err, "fail to marshal yaml") + return fmt.Errorf("fail to marshal yaml: %w", err) } fmt.Println(string(marshalled)) case "json": marshalled, err = json.Marshal(&OutputInfo) if err != nil { - return errors.Wrap(err, "fail to marshal json") + return fmt.Errorf("fail to marshal json: %w", err) } fmt.Println(string(marshalled)) default: // There is a bug in the program if we hit this case. // However, we follow a policy of never panicking. - return fmt.Errorf("VersionOptions were not validated: --output=%q should have been rejected", output) + return fmt.Errorf("versionOptions were not validated: --output=%q should have been rejected", output) } missinfo := []string{} if OutputInfo.KubernetesVersion == nil { diff --git a/controllers/account/go.mod b/controllers/account/go.mod index dbee2315a59..a39ef9036a7 100644 --- a/controllers/account/go.mod +++ b/controllers/account/go.mod @@ -73,8 +73,8 @@ require ( gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/apiextensions-apiserver v0.25.0 // indirect - k8s.io/component-base v0.25.0 // indirect + k8s.io/apiextensions-apiserver v0.25.6 // indirect + k8s.io/component-base v0.25.6 // indirect k8s.io/klog/v2 v2.80.1 // indirect k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 // indirect k8s.io/utils v0.0.0-20221107191617-1a15be271d1d // indirect diff --git a/controllers/account/go.sum b/controllers/account/go.sum index ddd196952df..07d9d55882d 100644 --- a/controllers/account/go.sum +++ b/controllers/account/go.sum @@ -200,7 +200,7 @@ go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= -go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA= +go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI= go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ= @@ -350,16 +350,16 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -k8s.io/api v0.25.0 h1:H+Q4ma2U/ww0iGB78ijZx6DRByPz6/733jIuFpX70e0= -k8s.io/api v0.25.0/go.mod h1:ttceV1GyV1i1rnmvzT3BST08N6nGt+dudGrquzVQWPk= -k8s.io/apiextensions-apiserver v0.25.0 h1:CJ9zlyXAbq0FIW8CD7HHyozCMBpDSiH7EdrSTCZcZFY= -k8s.io/apiextensions-apiserver v0.25.0/go.mod h1:3pAjZiN4zw7R8aZC5gR0y3/vCkGlAjCazcg1me8iB/E= -k8s.io/apimachinery v0.25.0 h1:MlP0r6+3XbkUG2itd6vp3oxbtdQLQI94fD5gCS+gnoU= -k8s.io/apimachinery v0.25.0/go.mod h1:qMx9eAk0sZQGsXGu86fab8tZdffHbwUfsvzqKn4mfB0= -k8s.io/client-go v0.25.0 h1:CVWIaCETLMBNiTUta3d5nzRbXvY5Hy9Dpl+VvREpu5E= -k8s.io/client-go v0.25.0/go.mod h1:lxykvypVfKilxhTklov0wz1FoaUZ8X4EwbhS6rpRfN8= -k8s.io/component-base v0.25.0 h1:haVKlLkPCFZhkcqB6WCvpVxftrg6+FK5x1ZuaIDaQ5Y= -k8s.io/component-base v0.25.0/go.mod h1:F2Sumv9CnbBlqrpdf7rKZTmmd2meJq0HizeyY/yAFxk= +k8s.io/api v0.25.6 h1:LwDY2H6kD/3R8TekJYYaJWOdekNdXDO44eVpX6sNtJA= +k8s.io/api v0.25.6/go.mod h1:bVp01KUcl8VUHFBTJMOknWNo7XvR0cMbeTTuFg1zCUs= +k8s.io/apiextensions-apiserver v0.25.6 h1:MwdaCpHtGVSM5SiA6Hm4g2w5voMNiPCwBjOqz9YTlrg= +k8s.io/apiextensions-apiserver v0.25.6/go.mod h1:aXw8Xmhf6/gfGx3y0xkj8o8evTZbfOFqZeWIigg4XsE= +k8s.io/apimachinery v0.25.6 h1:r6KIF2AHwLqFfZ0LcOA3I11SF62YZK83dxj1fn14NOQ= +k8s.io/apimachinery v0.25.6/go.mod h1:1S2i1QHkmxc8+EZCIxe/fX5hpldVXk4gvnJInMEb8D4= +k8s.io/client-go v0.25.6 h1:CHxACHi0DijmlYyUR7ooZoXnD5P8jYLgBHcxp775x/U= +k8s.io/client-go v0.25.6/go.mod h1:s9mMAGFYiH3Z66j7BESzu0GEradT9GQ2LjFf/YRrnyc= +k8s.io/component-base v0.25.6 h1:v3ci6FbXFcxpjyQJaaLq0MgzT3vyFzwUDWtO+KRv9Bk= +k8s.io/component-base v0.25.6/go.mod h1:k7DfcfJ8cOI6A2xTCfU5LxsnXV+lWw1ME8cRCHzIh6o= k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4= k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 h1:+70TFaan3hfJzs+7VK2o+OGxg8HsuBr/5f6tVAjDu6E= diff --git a/controllers/cluster/go.mod b/controllers/cluster/go.mod index 81571307035..cdd7c60565b 100644 --- a/controllers/cluster/go.mod +++ b/controllers/cluster/go.mod @@ -74,7 +74,7 @@ require ( go.uber.org/multierr v1.8.0 // indirect go.uber.org/zap v1.24.0 // indirect golang.org/x/crypto v0.1.0 // indirect - golang.org/x/net v0.3.0 // indirect + golang.org/x/net v0.3.1-0.20221206200815-1e63c2f08a10 // indirect golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 // indirect golang.org/x/sys v0.3.0 // indirect golang.org/x/term v0.3.0 // indirect @@ -88,8 +88,8 @@ require ( gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/apiextensions-apiserver v0.25.0 // indirect - k8s.io/component-base v0.25.0 // indirect + k8s.io/apiextensions-apiserver v0.25.6 // indirect + k8s.io/component-base v0.25.6 // indirect k8s.io/klog/v2 v2.70.1 // indirect k8s.io/kube-openapi v0.0.0-20220803164354-a70c9af30aea // indirect k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed // indirect diff --git a/controllers/cluster/go.sum b/controllers/cluster/go.sum index 563a1fd9332..9859304151a 100644 --- a/controllers/cluster/go.sum +++ b/controllers/cluster/go.sum @@ -916,7 +916,7 @@ go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= -go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA= +go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.8.0 h1:dg6GjLku4EH+249NNmoIciG9N/jURbDG+pFlTkhzIC8= @@ -1045,8 +1045,8 @@ golang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.3.0 h1:VWL6FNY2bEEmsGVKabSlHu5Irp34xmMRoqb/9lF9lxk= -golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= +golang.org/x/net v0.3.1-0.20221206200815-1e63c2f08a10 h1:Frnccbp+ok2GkUS2tC84yAq/U9Vg+0sIO7aRL3T4Xnc= +golang.org/x/net v0.3.1-0.20221206200815-1e63c2f08a10/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1535,17 +1535,17 @@ k8s.io/api v0.20.1/go.mod h1:KqwcCVogGxQY3nBlRpwt+wpAMF/KjaCc7RpywacvqUo= k8s.io/api v0.20.4/go.mod h1:++lNL1AJMkDymriNniQsWRkMDzRaX2Y/POTUi8yvqYQ= k8s.io/api v0.20.6/go.mod h1:X9e8Qag6JV/bL5G6bU8sdVRltWKmdHsFUGS3eVndqE8= k8s.io/api v0.21.1/go.mod h1:FstGROTmsSHBarKc8bylzXih8BLNYTiS3TZcsoEDg2s= -k8s.io/api v0.25.0 h1:H+Q4ma2U/ww0iGB78ijZx6DRByPz6/733jIuFpX70e0= -k8s.io/api v0.25.0/go.mod h1:ttceV1GyV1i1rnmvzT3BST08N6nGt+dudGrquzVQWPk= +k8s.io/api v0.25.6 h1:LwDY2H6kD/3R8TekJYYaJWOdekNdXDO44eVpX6sNtJA= +k8s.io/api v0.25.6/go.mod h1:bVp01KUcl8VUHFBTJMOknWNo7XvR0cMbeTTuFg1zCUs= k8s.io/apiextensions-apiserver v0.21.1/go.mod h1:KESQFCGjqVcVsZ9g0xX5bacMjyX5emuWcS2arzdEouA= -k8s.io/apiextensions-apiserver v0.25.0 h1:CJ9zlyXAbq0FIW8CD7HHyozCMBpDSiH7EdrSTCZcZFY= -k8s.io/apiextensions-apiserver v0.25.0/go.mod h1:3pAjZiN4zw7R8aZC5gR0y3/vCkGlAjCazcg1me8iB/E= +k8s.io/apiextensions-apiserver v0.25.6 h1:MwdaCpHtGVSM5SiA6Hm4g2w5voMNiPCwBjOqz9YTlrg= +k8s.io/apiextensions-apiserver v0.25.6/go.mod h1:aXw8Xmhf6/gfGx3y0xkj8o8evTZbfOFqZeWIigg4XsE= k8s.io/apimachinery v0.20.1/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRpU= k8s.io/apimachinery v0.20.4/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRpU= k8s.io/apimachinery v0.20.6/go.mod h1:ejZXtW1Ra6V1O5H8xPBGz+T3+4gfkTCeExAHKU57MAc= k8s.io/apimachinery v0.21.1/go.mod h1:jbreFvJo3ov9rj7eWT7+sYiRx+qZuCYXwWT1bcDswPY= -k8s.io/apimachinery v0.25.0 h1:MlP0r6+3XbkUG2itd6vp3oxbtdQLQI94fD5gCS+gnoU= -k8s.io/apimachinery v0.25.0/go.mod h1:qMx9eAk0sZQGsXGu86fab8tZdffHbwUfsvzqKn4mfB0= +k8s.io/apimachinery v0.25.6 h1:r6KIF2AHwLqFfZ0LcOA3I11SF62YZK83dxj1fn14NOQ= +k8s.io/apimachinery v0.25.6/go.mod h1:1S2i1QHkmxc8+EZCIxe/fX5hpldVXk4gvnJInMEb8D4= k8s.io/apiserver v0.20.1/go.mod h1:ro5QHeQkgMS7ZGpvf4tSMx6bBOgPfE+f52KwvXfScaU= k8s.io/apiserver v0.20.4/go.mod h1:Mc80thBKOyy7tbvFtB4kJv1kbdD0eIH8k8vianJcbFM= k8s.io/apiserver v0.20.6/go.mod h1:QIJXNt6i6JB+0YQRNcS0hdRHJlMhflFmsBDeSgT1r8Q= @@ -1554,16 +1554,16 @@ k8s.io/client-go v0.20.1/go.mod h1:/zcHdt1TeWSd5HoUe6elJmHSQ6uLLgp4bIJHVEuy+/Y= k8s.io/client-go v0.20.4/go.mod h1:LiMv25ND1gLUdBeYxBIwKpkSC5IsozMMmOOeSJboP+k= k8s.io/client-go v0.20.6/go.mod h1:nNQMnOvEUEsOzRRFIIkdmYOjAZrC8bgq0ExboWSU1I0= k8s.io/client-go v0.21.1/go.mod h1:/kEw4RgW+3xnBGzvp9IWxKSNA+lXn3A7AuH3gdOAzLs= -k8s.io/client-go v0.25.0 h1:CVWIaCETLMBNiTUta3d5nzRbXvY5Hy9Dpl+VvREpu5E= -k8s.io/client-go v0.25.0/go.mod h1:lxykvypVfKilxhTklov0wz1FoaUZ8X4EwbhS6rpRfN8= +k8s.io/client-go v0.25.6 h1:CHxACHi0DijmlYyUR7ooZoXnD5P8jYLgBHcxp775x/U= +k8s.io/client-go v0.25.6/go.mod h1:s9mMAGFYiH3Z66j7BESzu0GEradT9GQ2LjFf/YRrnyc= k8s.io/code-generator v0.19.7/go.mod h1:lwEq3YnLYb/7uVXLorOJfxg+cUu2oihFhHZ0n9NIla0= k8s.io/code-generator v0.21.1/go.mod h1:hUlps5+9QaTrKx+jiM4rmq7YmH8wPOIko64uZCHDh6Q= k8s.io/component-base v0.20.1/go.mod h1:guxkoJnNoh8LNrbtiQOlyp2Y2XFCZQmrcg2n/DeYNLk= k8s.io/component-base v0.20.4/go.mod h1:t4p9EdiagbVCJKrQ1RsA5/V4rFQNDfRlevJajlGwgjI= k8s.io/component-base v0.20.6/go.mod h1:6f1MPBAeI+mvuts3sIdtpjljHWBQ2cIy38oBIWMYnrM= k8s.io/component-base v0.21.1/go.mod h1:NgzFZ2qu4m1juby4TnrmpR8adRk6ka62YdH5DkIIyKA= -k8s.io/component-base v0.25.0 h1:haVKlLkPCFZhkcqB6WCvpVxftrg6+FK5x1ZuaIDaQ5Y= -k8s.io/component-base v0.25.0/go.mod h1:F2Sumv9CnbBlqrpdf7rKZTmmd2meJq0HizeyY/yAFxk= +k8s.io/component-base v0.25.6 h1:v3ci6FbXFcxpjyQJaaLq0MgzT3vyFzwUDWtO+KRv9Bk= +k8s.io/component-base v0.25.6/go.mod h1:k7DfcfJ8cOI6A2xTCfU5LxsnXV+lWw1ME8cRCHzIh6o= k8s.io/cri-api v0.17.3/go.mod h1:X1sbHmuXhwaHs9xxYffLqJogVsnI+f6cPRcgPel7ywM= k8s.io/cri-api v0.20.1/go.mod h1:2JRbKt+BFLTjtrILYVqQK5jqhI+XNdF6UiGMgczeBCI= k8s.io/cri-api v0.20.4/go.mod h1:2JRbKt+BFLTjtrILYVqQK5jqhI+XNdF6UiGMgczeBCI= diff --git a/controllers/imagehub/controllers/data_helper.go b/controllers/imagehub/controllers/data_helper.go index c7be823d9d1..2d3e690f8f2 100644 --- a/controllers/imagehub/controllers/data_helper.go +++ b/controllers/imagehub/controllers/data_helper.go @@ -14,7 +14,7 @@ type DataHelper struct { logr.Logger } -var ErrNotMatch = errors.New("NotMatch") +var ErrNotMatch = errors.New("notMatch") type MatchingLabelsModifier func(name any, labels client.MatchingLabels) diff --git a/controllers/imagehub/controllers/image_controller.go b/controllers/imagehub/controllers/image_controller.go index 7a4b66d1768..b6e7c89a5ce 100644 --- a/controllers/imagehub/controllers/image_controller.go +++ b/controllers/imagehub/controllers/image_controller.go @@ -18,11 +18,11 @@ package controllers import ( "context" + "errors" "github.com/go-logr/logr" "github.com/labring/endpoints-operator/library/controller" imagehubv1 "github.com/labring/sealos/controllers/imagehub/api/v1" - "github.com/pkg/errors" apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/tools/record" diff --git a/controllers/imagehub/controllers/repository_controller.go b/controllers/imagehub/controllers/repository_controller.go index b7a46ec7327..aa10ca69134 100644 --- a/controllers/imagehub/controllers/repository_controller.go +++ b/controllers/imagehub/controllers/repository_controller.go @@ -18,12 +18,12 @@ package controllers import ( "context" + "errors" "sort" "github.com/go-logr/logr" "github.com/labring/endpoints-operator/library/controller" imagehubv1 "github.com/labring/sealos/controllers/imagehub/api/v1" - "github.com/pkg/errors" "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/tools/record" ctrl "sigs.k8s.io/controller-runtime" diff --git a/controllers/imagehub/go.mod b/controllers/imagehub/go.mod index 924f4e4975a..079cde5c2d6 100644 --- a/controllers/imagehub/go.mod +++ b/controllers/imagehub/go.mod @@ -7,7 +7,6 @@ require ( github.com/labring/endpoints-operator/library v0.0.0-20220819031233-733d330beaea github.com/onsi/ginkgo/v2 v2.1.6 github.com/onsi/gomega v1.20.1 - github.com/pkg/errors v0.9.1 k8s.io/api v0.25.6 k8s.io/apimachinery v0.25.6 k8s.io/client-go v0.25.6 @@ -50,21 +49,21 @@ require ( github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect + github.com/pkg/errors v0.9.1 // indirect github.com/prometheus/client_golang v1.12.2 // indirect github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/common v0.32.1 // indirect github.com/prometheus/procfs v0.7.3 // indirect github.com/spf13/pflag v1.0.5 // indirect - github.com/stretchr/testify v1.8.0 // indirect go.uber.org/atomic v1.7.0 // indirect go.uber.org/multierr v1.6.0 // indirect go.uber.org/zap v1.21.0 // indirect golang.org/x/crypto v0.0.0-20220315160706-3147a52a75dd // indirect - golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect + golang.org/x/net v0.3.1-0.20221206200815-1e63c2f08a10 // indirect golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect - golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect - golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect - golang.org/x/text v0.3.7 // indirect + golang.org/x/sys v0.3.0 // indirect + golang.org/x/term v0.3.0 // indirect + golang.org/x/text v0.5.0 // indirect golang.org/x/time v0.0.0-20220609170525-579cf78fd858 // indirect gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect google.golang.org/appengine v1.6.7 // indirect diff --git a/controllers/imagehub/go.sum b/controllers/imagehub/go.sum index 45deeebe48c..9721f8e2f31 100644 --- a/controllers/imagehub/go.sum +++ b/controllers/imagehub/go.sum @@ -480,16 +480,13 @@ github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= @@ -625,8 +622,8 @@ golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b h1:PxfKdU9lEEDYjdIzOtC4qFWgkU2rGHdKlKowJSMN9h0= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.3.1-0.20221206200815-1e63c2f08a10 h1:Frnccbp+ok2GkUS2tC84yAq/U9Vg+0sIO7aRL3T4Xnc= +golang.org/x/net v0.3.1-0.20221206200815-1e63c2f08a10/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -724,13 +721,13 @@ golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f h1:v4INt8xihDGvnrfjMDVXGxw9wrfxYyCjk0KbXjhR55s= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ= +golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.3.0 h1:qoo4akIqOcDME5bhc/NgxUdovd6BSS2uMsVjB56q1xI= +golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -739,8 +736,8 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.5.0 h1:OLmvp0KP+FVG99Ct/qFiL/Fhk4zp4QQnZ7b2U+5piUM= +golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -991,18 +988,18 @@ honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= k8s.io/api v0.21.1/go.mod h1:FstGROTmsSHBarKc8bylzXih8BLNYTiS3TZcsoEDg2s= -k8s.io/api v0.25.0 h1:H+Q4ma2U/ww0iGB78ijZx6DRByPz6/733jIuFpX70e0= -k8s.io/api v0.25.0/go.mod h1:ttceV1GyV1i1rnmvzT3BST08N6nGt+dudGrquzVQWPk= +k8s.io/api v0.25.6 h1:LwDY2H6kD/3R8TekJYYaJWOdekNdXDO44eVpX6sNtJA= +k8s.io/api v0.25.6/go.mod h1:bVp01KUcl8VUHFBTJMOknWNo7XvR0cMbeTTuFg1zCUs= k8s.io/apiextensions-apiserver v0.21.1/go.mod h1:KESQFCGjqVcVsZ9g0xX5bacMjyX5emuWcS2arzdEouA= k8s.io/apiextensions-apiserver v0.25.0 h1:CJ9zlyXAbq0FIW8CD7HHyozCMBpDSiH7EdrSTCZcZFY= k8s.io/apiextensions-apiserver v0.25.0/go.mod h1:3pAjZiN4zw7R8aZC5gR0y3/vCkGlAjCazcg1me8iB/E= k8s.io/apimachinery v0.21.1/go.mod h1:jbreFvJo3ov9rj7eWT7+sYiRx+qZuCYXwWT1bcDswPY= -k8s.io/apimachinery v0.25.0 h1:MlP0r6+3XbkUG2itd6vp3oxbtdQLQI94fD5gCS+gnoU= -k8s.io/apimachinery v0.25.0/go.mod h1:qMx9eAk0sZQGsXGu86fab8tZdffHbwUfsvzqKn4mfB0= +k8s.io/apimachinery v0.25.6 h1:r6KIF2AHwLqFfZ0LcOA3I11SF62YZK83dxj1fn14NOQ= +k8s.io/apimachinery v0.25.6/go.mod h1:1S2i1QHkmxc8+EZCIxe/fX5hpldVXk4gvnJInMEb8D4= k8s.io/apiserver v0.21.1/go.mod h1:nLLYZvMWn35glJ4/FZRhzLG/3MPxAaZTgV4FJZdr+tY= k8s.io/client-go v0.21.1/go.mod h1:/kEw4RgW+3xnBGzvp9IWxKSNA+lXn3A7AuH3gdOAzLs= -k8s.io/client-go v0.25.0 h1:CVWIaCETLMBNiTUta3d5nzRbXvY5Hy9Dpl+VvREpu5E= -k8s.io/client-go v0.25.0/go.mod h1:lxykvypVfKilxhTklov0wz1FoaUZ8X4EwbhS6rpRfN8= +k8s.io/client-go v0.25.6 h1:CHxACHi0DijmlYyUR7ooZoXnD5P8jYLgBHcxp775x/U= +k8s.io/client-go v0.25.6/go.mod h1:s9mMAGFYiH3Z66j7BESzu0GEradT9GQ2LjFf/YRrnyc= k8s.io/code-generator v0.21.1/go.mod h1:hUlps5+9QaTrKx+jiM4rmq7YmH8wPOIko64uZCHDh6Q= k8s.io/component-base v0.21.1/go.mod h1:NgzFZ2qu4m1juby4TnrmpR8adRk6ka62YdH5DkIIyKA= k8s.io/component-base v0.25.0 h1:haVKlLkPCFZhkcqB6WCvpVxftrg6+FK5x1ZuaIDaQ5Y= diff --git a/controllers/infra/drivers/reconcile.go b/controllers/infra/drivers/reconcile.go index d0a1623b43c..47fe069192b 100644 --- a/controllers/infra/drivers/reconcile.go +++ b/controllers/infra/drivers/reconcile.go @@ -181,7 +181,7 @@ func (a *Applier) ReconcileHosts(current []v1.Hosts, infra *v1.Infra, driver Dri // can't modify volume type when volume being used. can't smaller size when volume being used. //if !reflect.DeepEqual(cur.Disks, d.Disks) { // if err := a.ReconcileDisks(infra, cur, d.Disks, driver); err != nil { - // return fmt.Errorf("ReconcileDisks failed: %v", err) + // return fmt.Errorf("reconcileDisks failed: %v", err) // } //} diff --git a/controllers/infra/go.mod b/controllers/infra/go.mod index 6017044bcb2..1018424bbb3 100644 --- a/controllers/infra/go.mod +++ b/controllers/infra/go.mod @@ -10,6 +10,8 @@ require ( github.com/aws/smithy-go v1.12.0 github.com/google/uuid v1.3.0 github.com/labring/endpoints-operator/library v0.0.0-20220819031233-733d330beaea + github.com/labring/sealos v0.0.0 + github.com/labring/sealos/controllers/cluster v0.0.0 github.com/onsi/ginkgo v1.16.5 github.com/onsi/gomega v1.22.1 golang.org/x/sync v0.1.0 @@ -75,7 +77,7 @@ require ( go.uber.org/multierr v1.8.0 // indirect go.uber.org/zap v1.24.0 // indirect golang.org/x/crypto v0.1.0 // indirect - golang.org/x/net v0.3.0 // indirect + golang.org/x/net v0.3.1-0.20221206200815-1e63c2f08a10 // indirect golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 // indirect golang.org/x/sys v0.3.0 // indirect golang.org/x/term v0.3.0 // indirect @@ -90,8 +92,8 @@ require ( gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/apiextensions-apiserver v0.25.0 // indirect - k8s.io/component-base v0.25.0 // indirect + k8s.io/apiextensions-apiserver v0.25.6 // indirect + k8s.io/component-base v0.25.6 // indirect k8s.io/klog/v2 v2.70.1 // indirect k8s.io/kube-openapi v0.0.0-20220803164354-a70c9af30aea // indirect k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed // indirect @@ -100,6 +102,7 @@ require ( sigs.k8s.io/yaml v1.3.0 // indirect ) -require github.com/labring/sealos v0.0.0-00010101000000-000000000000 - -replace github.com/labring/sealos => ../../ +replace ( + github.com/labring/sealos => ../../ + github.com/labring/sealos/controllers/cluster => ../../controllers/cluster +) diff --git a/controllers/infra/go.sum b/controllers/infra/go.sum index e0db82b0f62..3892e2dae0c 100644 --- a/controllers/infra/go.sum +++ b/controllers/infra/go.sum @@ -593,7 +593,7 @@ go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= -go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA= +go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.8.0 h1:dg6GjLku4EH+249NNmoIciG9N/jURbDG+pFlTkhzIC8= @@ -708,8 +708,8 @@ golang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.3.0 h1:VWL6FNY2bEEmsGVKabSlHu5Irp34xmMRoqb/9lF9lxk= -golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= +golang.org/x/net v0.3.1-0.20221206200815-1e63c2f08a10 h1:Frnccbp+ok2GkUS2tC84yAq/U9Vg+0sIO7aRL3T4Xnc= +golang.org/x/net v0.3.1-0.20221206200815-1e63c2f08a10/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1146,22 +1146,22 @@ honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= k8s.io/api v0.21.1/go.mod h1:FstGROTmsSHBarKc8bylzXih8BLNYTiS3TZcsoEDg2s= -k8s.io/api v0.25.0 h1:H+Q4ma2U/ww0iGB78ijZx6DRByPz6/733jIuFpX70e0= -k8s.io/api v0.25.0/go.mod h1:ttceV1GyV1i1rnmvzT3BST08N6nGt+dudGrquzVQWPk= +k8s.io/api v0.25.6 h1:LwDY2H6kD/3R8TekJYYaJWOdekNdXDO44eVpX6sNtJA= +k8s.io/api v0.25.6/go.mod h1:bVp01KUcl8VUHFBTJMOknWNo7XvR0cMbeTTuFg1zCUs= k8s.io/apiextensions-apiserver v0.21.1/go.mod h1:KESQFCGjqVcVsZ9g0xX5bacMjyX5emuWcS2arzdEouA= -k8s.io/apiextensions-apiserver v0.25.0 h1:CJ9zlyXAbq0FIW8CD7HHyozCMBpDSiH7EdrSTCZcZFY= -k8s.io/apiextensions-apiserver v0.25.0/go.mod h1:3pAjZiN4zw7R8aZC5gR0y3/vCkGlAjCazcg1me8iB/E= +k8s.io/apiextensions-apiserver v0.25.6 h1:MwdaCpHtGVSM5SiA6Hm4g2w5voMNiPCwBjOqz9YTlrg= +k8s.io/apiextensions-apiserver v0.25.6/go.mod h1:aXw8Xmhf6/gfGx3y0xkj8o8evTZbfOFqZeWIigg4XsE= k8s.io/apimachinery v0.21.1/go.mod h1:jbreFvJo3ov9rj7eWT7+sYiRx+qZuCYXwWT1bcDswPY= -k8s.io/apimachinery v0.25.0 h1:MlP0r6+3XbkUG2itd6vp3oxbtdQLQI94fD5gCS+gnoU= -k8s.io/apimachinery v0.25.0/go.mod h1:qMx9eAk0sZQGsXGu86fab8tZdffHbwUfsvzqKn4mfB0= +k8s.io/apimachinery v0.25.6 h1:r6KIF2AHwLqFfZ0LcOA3I11SF62YZK83dxj1fn14NOQ= +k8s.io/apimachinery v0.25.6/go.mod h1:1S2i1QHkmxc8+EZCIxe/fX5hpldVXk4gvnJInMEb8D4= k8s.io/apiserver v0.21.1/go.mod h1:nLLYZvMWn35glJ4/FZRhzLG/3MPxAaZTgV4FJZdr+tY= k8s.io/client-go v0.21.1/go.mod h1:/kEw4RgW+3xnBGzvp9IWxKSNA+lXn3A7AuH3gdOAzLs= -k8s.io/client-go v0.25.0 h1:CVWIaCETLMBNiTUta3d5nzRbXvY5Hy9Dpl+VvREpu5E= -k8s.io/client-go v0.25.0/go.mod h1:lxykvypVfKilxhTklov0wz1FoaUZ8X4EwbhS6rpRfN8= +k8s.io/client-go v0.25.6 h1:CHxACHi0DijmlYyUR7ooZoXnD5P8jYLgBHcxp775x/U= +k8s.io/client-go v0.25.6/go.mod h1:s9mMAGFYiH3Z66j7BESzu0GEradT9GQ2LjFf/YRrnyc= k8s.io/code-generator v0.21.1/go.mod h1:hUlps5+9QaTrKx+jiM4rmq7YmH8wPOIko64uZCHDh6Q= k8s.io/component-base v0.21.1/go.mod h1:NgzFZ2qu4m1juby4TnrmpR8adRk6ka62YdH5DkIIyKA= -k8s.io/component-base v0.25.0 h1:haVKlLkPCFZhkcqB6WCvpVxftrg6+FK5x1ZuaIDaQ5Y= -k8s.io/component-base v0.25.0/go.mod h1:F2Sumv9CnbBlqrpdf7rKZTmmd2meJq0HizeyY/yAFxk= +k8s.io/component-base v0.25.6 h1:v3ci6FbXFcxpjyQJaaLq0MgzT3vyFzwUDWtO+KRv9Bk= +k8s.io/component-base v0.25.6/go.mod h1:k7DfcfJ8cOI6A2xTCfU5LxsnXV+lWw1ME8cRCHzIh6o= k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/gengo v0.0.0-20201214224949-b6c5ce23f027/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E= k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE= diff --git a/controllers/metering/go.mod b/controllers/metering/go.mod index c4d665550bf..5a935667d36 100644 --- a/controllers/metering/go.mod +++ b/controllers/metering/go.mod @@ -78,8 +78,8 @@ require ( gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/apiextensions-apiserver v0.25.0 // indirect - k8s.io/component-base v0.25.0 // indirect + k8s.io/apiextensions-apiserver v0.25.6 // indirect + k8s.io/component-base v0.25.6 // indirect k8s.io/klog/v2 v2.80.1 // indirect k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 // indirect k8s.io/utils v0.0.0-20221107191617-1a15be271d1d // indirect diff --git a/controllers/metering/go.sum b/controllers/metering/go.sum index ee353b07ce1..016f61eebaa 100644 --- a/controllers/metering/go.sum +++ b/controllers/metering/go.sum @@ -200,7 +200,7 @@ go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= -go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA= +go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI= go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ= @@ -353,16 +353,16 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -k8s.io/api v0.25.0 h1:H+Q4ma2U/ww0iGB78ijZx6DRByPz6/733jIuFpX70e0= -k8s.io/api v0.25.0/go.mod h1:ttceV1GyV1i1rnmvzT3BST08N6nGt+dudGrquzVQWPk= -k8s.io/apiextensions-apiserver v0.25.0 h1:CJ9zlyXAbq0FIW8CD7HHyozCMBpDSiH7EdrSTCZcZFY= -k8s.io/apiextensions-apiserver v0.25.0/go.mod h1:3pAjZiN4zw7R8aZC5gR0y3/vCkGlAjCazcg1me8iB/E= -k8s.io/apimachinery v0.25.0 h1:MlP0r6+3XbkUG2itd6vp3oxbtdQLQI94fD5gCS+gnoU= -k8s.io/apimachinery v0.25.0/go.mod h1:qMx9eAk0sZQGsXGu86fab8tZdffHbwUfsvzqKn4mfB0= -k8s.io/client-go v0.25.0 h1:CVWIaCETLMBNiTUta3d5nzRbXvY5Hy9Dpl+VvREpu5E= -k8s.io/client-go v0.25.0/go.mod h1:lxykvypVfKilxhTklov0wz1FoaUZ8X4EwbhS6rpRfN8= -k8s.io/component-base v0.25.0 h1:haVKlLkPCFZhkcqB6WCvpVxftrg6+FK5x1ZuaIDaQ5Y= -k8s.io/component-base v0.25.0/go.mod h1:F2Sumv9CnbBlqrpdf7rKZTmmd2meJq0HizeyY/yAFxk= +k8s.io/api v0.25.6 h1:LwDY2H6kD/3R8TekJYYaJWOdekNdXDO44eVpX6sNtJA= +k8s.io/api v0.25.6/go.mod h1:bVp01KUcl8VUHFBTJMOknWNo7XvR0cMbeTTuFg1zCUs= +k8s.io/apiextensions-apiserver v0.25.6 h1:MwdaCpHtGVSM5SiA6Hm4g2w5voMNiPCwBjOqz9YTlrg= +k8s.io/apiextensions-apiserver v0.25.6/go.mod h1:aXw8Xmhf6/gfGx3y0xkj8o8evTZbfOFqZeWIigg4XsE= +k8s.io/apimachinery v0.25.6 h1:r6KIF2AHwLqFfZ0LcOA3I11SF62YZK83dxj1fn14NOQ= +k8s.io/apimachinery v0.25.6/go.mod h1:1S2i1QHkmxc8+EZCIxe/fX5hpldVXk4gvnJInMEb8D4= +k8s.io/client-go v0.25.6 h1:CHxACHi0DijmlYyUR7ooZoXnD5P8jYLgBHcxp775x/U= +k8s.io/client-go v0.25.6/go.mod h1:s9mMAGFYiH3Z66j7BESzu0GEradT9GQ2LjFf/YRrnyc= +k8s.io/component-base v0.25.6 h1:v3ci6FbXFcxpjyQJaaLq0MgzT3vyFzwUDWtO+KRv9Bk= +k8s.io/component-base v0.25.6/go.mod h1:k7DfcfJ8cOI6A2xTCfU5LxsnXV+lWw1ME8cRCHzIh6o= k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4= k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 h1:+70TFaan3hfJzs+7VK2o+OGxg8HsuBr/5f6tVAjDu6E= diff --git a/controllers/terminal/go.mod b/controllers/terminal/go.mod index de002cbcf49..b0ae2f92be0 100644 --- a/controllers/terminal/go.mod +++ b/controllers/terminal/go.mod @@ -6,7 +6,7 @@ require ( github.com/apache/apisix-ingress-controller v1.4.1 github.com/jaevor/go-nanoid v1.3.0 github.com/onsi/ginkgo v1.16.5 - github.com/onsi/gomega v1.20.0 + github.com/onsi/gomega v1.20.1 k8s.io/api v0.25.6 k8s.io/apimachinery v0.25.6 k8s.io/client-go v0.25.6 @@ -61,11 +61,11 @@ require ( go.uber.org/multierr v1.8.0 // indirect go.uber.org/zap v1.21.0 // indirect golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa // indirect - golang.org/x/net v0.0.0-20220805013720-a33c5aa5df48 // indirect + golang.org/x/net v0.3.1-0.20221206200815-1e63c2f08a10 // indirect golang.org/x/oauth2 v0.0.0-20220808172628-8227340efae7 // indirect - golang.org/x/sys v0.0.0-20220808155132-1c4a2a72c664 // indirect - golang.org/x/term v0.0.0-20220722155259-a9ba230a4035 // indirect - golang.org/x/text v0.3.7 // indirect + golang.org/x/sys v0.3.0 // indirect + golang.org/x/term v0.3.0 // indirect + golang.org/x/text v0.5.0 // indirect golang.org/x/time v0.0.0-20220722155302-e5dcc9cfc0b9 // indirect gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect google.golang.org/appengine v1.6.7 // indirect diff --git a/controllers/terminal/go.sum b/controllers/terminal/go.sum index a3fce84c6ce..3f0fd91ffbc 100644 --- a/controllers/terminal/go.sum +++ b/controllers/terminal/go.sum @@ -493,14 +493,14 @@ github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9k github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= -github.com/onsi/ginkgo/v2 v2.1.4 h1:GNapqRSid3zijZ9H77KrgVG4/8KqiyRsxcSxe+7ApXY= +github.com/onsi/ginkgo/v2 v2.1.6 h1:Fx2POJZfKRQcM1pH49qSZiYeu319wji004qX+GDovrU= github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.14.0/go.mod h1:cIuvLEne0aoVhAgh/O6ac0Op8WWw9H6eYCriF+tEHG0= -github.com/onsi/gomega v1.20.0 h1:8W0cWlwFkflGPLltQvLRB7ZVD5HuP6ng320w2IS245Q= -github.com/onsi/gomega v1.20.0/go.mod h1:DtrZpjmvpn2mPm4YWQa0/ALMDj9v4YxLgojwPeREyVo= +github.com/onsi/gomega v1.20.1 h1:PA/3qinGoukvymdIDV8pii6tiZgC8kbmJO6Z5+b002Q= +github.com/onsi/gomega v1.20.1/go.mod h1:DtrZpjmvpn2mPm4YWQa0/ALMDj9v4YxLgojwPeREyVo= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= @@ -790,8 +790,8 @@ golang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.0.0-20220805013720-a33c5aa5df48 h1:N9Vc/rorQUDes6B9CNdIxAn5jODGj2wzfrei2x4wNj4= -golang.org/x/net v0.0.0-20220805013720-a33c5aa5df48/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= +golang.org/x/net v0.3.1-0.20221206200815-1e63c2f08a10 h1:Frnccbp+ok2GkUS2tC84yAq/U9Vg+0sIO7aRL3T4Xnc= +golang.org/x/net v0.3.1-0.20221206200815-1e63c2f08a10/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -915,14 +915,14 @@ golang.org/x/sys v0.0.0-20220502124256-b6088ccd6cba/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220610221304-9f5ed59c137d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220808155132-1c4a2a72c664 h1:v1W7bwXHsnLLloWYTVEdvGvA7BHMeBYsPcF0GLDxIRs= -golang.org/x/sys v0.0.0-20220808155132-1c4a2a72c664/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ= +golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.0.0-20220722155259-a9ba230a4035 h1:Q5284mrmYTpACcm+eAKjKJH48BBwSyfJqmmGDTtT8Vc= -golang.org/x/term v0.0.0-20220722155259-a9ba230a4035/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.3.0 h1:qoo4akIqOcDME5bhc/NgxUdovd6BSS2uMsVjB56q1xI= +golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -931,8 +931,9 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.5.0 h1:OLmvp0KP+FVG99Ct/qFiL/Fhk4zp4QQnZ7b2U+5piUM= +golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1241,23 +1242,26 @@ honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9 k8s.io/api v0.21.3/go.mod h1:hUgeYHUbBp23Ue4qdX9tR8/ANi/g3ehylAqDn9NWVOg= k8s.io/api v0.22.1/go.mod h1:bh13rkTp3F1XEaLGykbyRD2QaTTzPm0e/BMd8ptFONY= k8s.io/api v0.22.4/go.mod h1:Rgs+9gIGYC5laXQSZZ9JqT5NevNgoGiOdVWi1BAB3qk= -k8s.io/api v0.24.3 h1:tt55QEmKd6L2k5DP6G/ZzdMQKvG5ro4H4teClqm0sTY= k8s.io/api v0.24.3/go.mod h1:elGR/XSZrS7z7cSZPzVWaycpJuGIw57j9b95/1PdJNI= +k8s.io/api v0.25.6 h1:LwDY2H6kD/3R8TekJYYaJWOdekNdXDO44eVpX6sNtJA= +k8s.io/api v0.25.6/go.mod h1:bVp01KUcl8VUHFBTJMOknWNo7XvR0cMbeTTuFg1zCUs= k8s.io/apiextensions-apiserver v0.21.3/go.mod h1:kl6dap3Gd45+21Jnh6utCx8Z2xxLm8LGDkprcd+KbsE= k8s.io/apiextensions-apiserver v0.24.3 h1:kyx+Tmro1qEsTUr07ZGQOfvTsF61yn+AxnxytBWq8As= k8s.io/apiextensions-apiserver v0.24.3/go.mod h1:cL0xkmUefpYM4f6IuOau+6NMFEIh6/7wXe/O4vPVJ8A= k8s.io/apimachinery v0.21.3/go.mod h1:H/IM+5vH9kZRNJ4l3x/fXP/5bOPJaVP/guptnZPeCFI= k8s.io/apimachinery v0.22.1/go.mod h1:O3oNtNadZdeOMxHFVxOreoznohCpy0z6mocxbZr7oJ0= k8s.io/apimachinery v0.22.4/go.mod h1:yU6oA6Gnax9RrxGzVvPFFJ+mpnW6PBSqp0sx0I0HHW0= -k8s.io/apimachinery v0.24.3 h1:hrFiNSA2cBZqllakVYyH/VyEh4B581bQRmqATJSeQTg= k8s.io/apimachinery v0.24.3/go.mod h1:82Bi4sCzVBdpYjyI4jY6aHX+YCUchUIrZrXKedjd2UM= +k8s.io/apimachinery v0.25.6 h1:r6KIF2AHwLqFfZ0LcOA3I11SF62YZK83dxj1fn14NOQ= +k8s.io/apimachinery v0.25.6/go.mod h1:1S2i1QHkmxc8+EZCIxe/fX5hpldVXk4gvnJInMEb8D4= k8s.io/apiserver v0.21.3/go.mod h1:eDPWlZG6/cCCMj/JBcEpDoK+I+6i3r9GsChYBHSbAzU= k8s.io/apiserver v0.24.3/go.mod h1:aXfwtIn4U27B7lYs5f2BKgz6DRbgWy+HJeYReN1jLJ8= k8s.io/client-go v0.21.3/go.mod h1:+VPhCgTsaFmGILxR/7E1N0S+ryO010QBeNCv5JwRGYU= k8s.io/client-go v0.22.1/go.mod h1:BquC5A4UOo4qVDUtoc04/+Nxp1MeHcVc1HJm1KmG8kk= k8s.io/client-go v0.22.4/go.mod h1:Yzw4e5e7h1LNHA4uqnMVrpEpUs1hJOiuBsJKIlRCHDA= -k8s.io/client-go v0.24.3 h1:Nl1840+6p4JqkFWEW2LnMKU667BUxw03REfLAVhuKQY= k8s.io/client-go v0.24.3/go.mod h1:AAovolf5Z9bY1wIg2FZ8LPQlEdKHjLI7ZD4rw920BJw= +k8s.io/client-go v0.25.6 h1:CHxACHi0DijmlYyUR7ooZoXnD5P8jYLgBHcxp775x/U= +k8s.io/client-go v0.25.6/go.mod h1:s9mMAGFYiH3Z66j7BESzu0GEradT9GQ2LjFf/YRrnyc= k8s.io/code-generator v0.21.3/go.mod h1:K3y0Bv9Cz2cOW2vXUrNZlFbflhuPvuadW6JdnN6gGKo= k8s.io/code-generator v0.22.0/go.mod h1:eV77Y09IopzeXOJzndrDyCI88UBok2h6WxAlBwpxa+o= k8s.io/code-generator v0.22.1/go.mod h1:eV77Y09IopzeXOJzndrDyCI88UBok2h6WxAlBwpxa+o= diff --git a/controllers/user/api/v1/user_types.go b/controllers/user/api/v1/user_types.go index d8b730784c5..ab4eb8ad186 100644 --- a/controllers/user/api/v1/user_types.go +++ b/controllers/user/api/v1/user_types.go @@ -119,7 +119,7 @@ func init() { func (r *User) validateCSRExpirationSeconds() error { if r.Spec.CSRExpirationSeconds == 0 { - return errors.New("CSRExpirationSeconds is not allowed to be 0") + return errors.New("csrExpirationSeconds is not allowed to be 0") } return nil } diff --git a/controllers/user/api/v1/usergroupbinding_webhook.go b/controllers/user/api/v1/usergroupbinding_webhook.go index 73a7d7358f5..89a51b41f59 100644 --- a/controllers/user/api/v1/usergroupbinding_webhook.go +++ b/controllers/user/api/v1/usergroupbinding_webhook.go @@ -17,9 +17,9 @@ limitations under the License. package v1 import ( + "errors" "strings" - "github.com/pkg/errors" "k8s.io/apimachinery/pkg/runtime" ctrl "sigs.k8s.io/controller-runtime" logf "sigs.k8s.io/controller-runtime/pkg/log" diff --git a/controllers/user/controllers/user_controller.go b/controllers/user/controllers/user_controller.go index c314f068a45..9363b75ae4e 100644 --- a/controllers/user/controllers/user_controller.go +++ b/controllers/user/controllers/user_controller.go @@ -18,6 +18,7 @@ package controllers import ( "context" + "errors" "fmt" "time" @@ -30,7 +31,6 @@ import ( "github.com/labring/endpoints-operator/library/controller" userv1 "github.com/labring/sealos/controllers/user/api/v1" "github.com/labring/sealos/controllers/user/controllers/helper" - "github.com/pkg/errors" v1 "k8s.io/api/core/v1" rbacv1 "k8s.io/api/rbac/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -298,7 +298,7 @@ func (r *UserReconciler) syncOwnerUG(ctx context.Context, user *userv1.User) { ug.Annotations = map[string]string{userAnnotationOwnerKey: user.Name} return nil }); err != nil { - return errors.Wrap(err, "unable to create UserGroup") + return fmt.Errorf("unable to create UserGroup: %w", err) } r.Logger.V(1).Info("create or update UserGroup ", "OperationResult", change) return nil @@ -340,7 +340,7 @@ func (r *UserReconciler) syncOwnerUGNamespaceBinding(ctx context.Context, user * } return nil }); err != nil { - return errors.Wrap(err, "unable to create namespace UserGroupBinding") + return fmt.Errorf("unable to create namespace UserGroupBinding: %w", err) } r.Logger.V(1).Info("create or update namespace UserGroupBinding", "OperationResult", change) return nil diff --git a/controllers/user/controllers/user_expiration_controller.go b/controllers/user/controllers/user_expiration_controller.go index 61fcecc0e43..0f6ceacb9b9 100644 --- a/controllers/user/controllers/user_expiration_controller.go +++ b/controllers/user/controllers/user_expiration_controller.go @@ -18,8 +18,7 @@ package controllers import ( "context" - - "github.com/pkg/errors" + "errors" "github.com/go-logr/logr" "github.com/labring/endpoints-operator/library/controller" diff --git a/controllers/user/controllers/usergroup_controller.go b/controllers/user/controllers/usergroup_controller.go index a8214ebe058..73ff7427854 100644 --- a/controllers/user/controllers/usergroup_controller.go +++ b/controllers/user/controllers/usergroup_controller.go @@ -18,13 +18,13 @@ package controllers import ( "context" + "errors" "fmt" "sigs.k8s.io/controller-runtime/pkg/handler" "sigs.k8s.io/controller-runtime/pkg/source" "github.com/labring/sealos/controllers/user/controllers/helper" - "github.com/pkg/errors" v1 "k8s.io/api/core/v1" rbacv1 "k8s.io/api/rbac/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -231,7 +231,7 @@ func (r *UserGroupReconciler) syncOwnerUGUserBinding(ctx context.Context, ug *us ugBinding.RoleRef = userv1.RoleRefTypeUser return nil }); err != nil { - return errors.Wrap(err, "unable to create user UserGroupBinding") + return fmt.Errorf("unable to create user UserGroupBinding: %w", err) } r.Logger.V(1).Info("create or update user UserGroupBinding", "OperationResult", change) return nil diff --git a/controllers/user/controllers/usergroupbinding_controller.go b/controllers/user/controllers/usergroupbinding_controller.go index e5635aeb0f3..c3bf817bfe3 100644 --- a/controllers/user/controllers/usergroupbinding_controller.go +++ b/controllers/user/controllers/usergroupbinding_controller.go @@ -18,8 +18,7 @@ package controllers import ( "context" - - "github.com/pkg/errors" + "errors" "github.com/go-logr/logr" "github.com/labring/endpoints-operator/library/controller" diff --git a/controllers/user/controllers/usergroupnamespacebinding_controller.go b/controllers/user/controllers/usergroupnamespacebinding_controller.go index 286bdb2a291..de57871cef6 100644 --- a/controllers/user/controllers/usergroupnamespacebinding_controller.go +++ b/controllers/user/controllers/usergroupnamespacebinding_controller.go @@ -18,24 +18,20 @@ package controllers import ( "context" + "fmt" + userv1 "github.com/labring/sealos/controllers/user/api/v1" "github.com/labring/sealos/controllers/user/controllers/cache" - - apierrors "k8s.io/apimachinery/pkg/api/errors" - - "golang.org/x/sync/errgroup" - "github.com/labring/sealos/controllers/user/controllers/helper" - "github.com/pkg/errors" + "golang.org/x/sync/errgroup" v1 "k8s.io/api/core/v1" rbacv1 "k8s.io/api/rbac/v1" + apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/util/retry" - "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" - - userv1 "github.com/labring/sealos/controllers/user/api/v1" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" ) // UserGroupNamespaceBindingController reconciles a UserGroupBinding namespace object @@ -96,7 +92,7 @@ func (r *UserGroupNamespaceBindingController) syncNamespace(ctx context.Context, return nil }); err != nil { - return errors.Wrap(err, "unable to create namespace by UserGroupBinding") + return fmt.Errorf("unable to create namespace by UserGroupBinding: %w", err) } r.Logger.V(1).Info("create or update namespace by UserGroupBinding", "OperationResult", change) return nil @@ -158,7 +154,7 @@ func (r *UserGroupNamespaceBindingController) syncRoleBinding(ctx context.Contex return nil }); err != nil { - return errors.Wrap(err, "unable to create namespace UserGroupBinding roleBinding") + return fmt.Errorf("unable to create namespace UserGroupBinding roleBinding: %w", err) } r.Logger.V(1).Info("create or update namespace UserGroupBinding roleBinding", "OperationResult", change, "user", user.Subject.Name) return nil diff --git a/controllers/user/controllers/usergroupuserbinding_controller.go b/controllers/user/controllers/usergroupuserbinding_controller.go index 7cb980c652c..d097915a7fb 100644 --- a/controllers/user/controllers/usergroupuserbinding_controller.go +++ b/controllers/user/controllers/usergroupuserbinding_controller.go @@ -18,6 +18,7 @@ package controllers import ( "context" + "fmt" "sort" "github.com/labring/sealos/controllers/user/controllers/cache" @@ -27,7 +28,6 @@ import ( apierrors "k8s.io/apimachinery/pkg/api/errors" "github.com/labring/sealos/controllers/user/controllers/helper" - "github.com/pkg/errors" v1 "k8s.io/api/core/v1" rbacv1 "k8s.io/api/rbac/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -105,7 +105,7 @@ func (r *UserGroupUserBindingController) syncClusterRoleGenerate(ctx context.Con } return nil }); err != nil { - return errors.Wrap(err, "unable to create user UserGroupBinding generate clusterRole") + return fmt.Errorf("unable to create user UserGroupBinding generate clusterRole: %w", err) } r.Logger.V(1).Info("create or update user UserGroupBinding generate clusterRole", "OperationResult", change) return nil @@ -133,7 +133,7 @@ func (r *UserGroupUserBindingController) syncClusterRoleGenerate(ctx context.Con } return nil }); err != nil { - return errors.Wrap(err, "unable to create user UserGroupBinding generate clusterRoleBinding") + return fmt.Errorf("unable to create user UserGroupBinding generate clusterRoleBinding: %w", err) } r.Logger.V(1).Info("create or update user UserGroupBinding generate clusterRoleBinding", "OperationResult", change) return nil @@ -184,7 +184,7 @@ func (r *UserGroupUserBindingController) syncClusterRoleBinding(ctx context.Cont return nil }); err != nil { - return errors.Wrap(err, "unable to create user UserGroupBinding clusterRoleBinding") + return fmt.Errorf("unable to create user UserGroupBinding clusterRoleBinding: %w", err) } r.Logger.V(1).Info("create or update user UserGroupBinding clusterRoleBinding", "OperationResult", change) return nil @@ -227,7 +227,7 @@ func (r *UserGroupUserBindingController) syncClusterRoleBindingByOwner(ctx conte return nil }); err != nil { - return errors.Wrap(err, "unable to create owner user UserGroupBinding clusterRoleBinding") + return fmt.Errorf("unable to create owner user UserGroupBinding clusterRoleBinding: %w", err) } r.Logger.V(1).Info("create or update owner user UserGroupBinding clusterRoleBinding", "OperationResult", change) return nil @@ -289,7 +289,7 @@ func (r *UserGroupUserBindingController) syncRoleBinding(ctx context.Context, ug return nil }); err != nil { - return errors.Wrap(err, "unable to create namespace UserGroupBinding roleBinding") + return fmt.Errorf("unable to create namespace UserGroupBinding roleBinding: %w", err) } r.Logger.V(1).Info("create or update namespace UserGroupBinding roleBinding", "OperationResult", change, "user", ugBinding.Subject.Name, "namespace", namespace.Name) return nil diff --git a/controllers/user/go.mod b/controllers/user/go.mod index 7e448ef49a2..0bfbecdf755 100644 --- a/controllers/user/go.mod +++ b/controllers/user/go.mod @@ -7,7 +7,6 @@ require ( github.com/labring/endpoints-operator/library v0.0.0-20221201063058-fa2d5a457d1d github.com/onsi/ginkgo v1.16.5 github.com/onsi/gomega v1.22.1 - github.com/pkg/errors v0.9.1 golang.org/x/sync v0.1.0 k8s.io/api v0.25.6 k8s.io/apimachinery v0.25.6 @@ -52,6 +51,7 @@ require ( github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/nxadm/tail v1.4.8 // indirect github.com/onsi/ginkgo/v2 v2.3.1 // indirect + github.com/pkg/errors v0.9.1 // indirect github.com/prometheus/client_golang v1.14.0 // indirect github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.37.0 // indirect @@ -62,7 +62,7 @@ require ( go.uber.org/multierr v1.8.0 // indirect go.uber.org/zap v1.24.0 // indirect golang.org/x/crypto v0.1.0 // indirect - golang.org/x/net v0.3.0 // indirect + golang.org/x/net v0.3.1-0.20221206200815-1e63c2f08a10 // indirect golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 // indirect golang.org/x/sys v0.3.0 // indirect golang.org/x/term v0.3.0 // indirect diff --git a/controllers/user/go.sum b/controllers/user/go.sum index 2004133afbb..053eea39835 100644 --- a/controllers/user/go.sum +++ b/controllers/user/go.sum @@ -604,8 +604,8 @@ golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.3.0 h1:VWL6FNY2bEEmsGVKabSlHu5Irp34xmMRoqb/9lF9lxk= -golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= +golang.org/x/net v0.3.1-0.20221206200815-1e63c2f08a10 h1:Frnccbp+ok2GkUS2tC84yAq/U9Vg+0sIO7aRL3T4Xnc= +golang.org/x/net v0.3.1-0.20221206200815-1e63c2f08a10/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -896,18 +896,18 @@ honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= k8s.io/api v0.21.1/go.mod h1:FstGROTmsSHBarKc8bylzXih8BLNYTiS3TZcsoEDg2s= -k8s.io/api v0.25.0 h1:H+Q4ma2U/ww0iGB78ijZx6DRByPz6/733jIuFpX70e0= -k8s.io/api v0.25.0/go.mod h1:ttceV1GyV1i1rnmvzT3BST08N6nGt+dudGrquzVQWPk= +k8s.io/api v0.25.6 h1:LwDY2H6kD/3R8TekJYYaJWOdekNdXDO44eVpX6sNtJA= +k8s.io/api v0.25.6/go.mod h1:bVp01KUcl8VUHFBTJMOknWNo7XvR0cMbeTTuFg1zCUs= k8s.io/apiextensions-apiserver v0.21.1/go.mod h1:KESQFCGjqVcVsZ9g0xX5bacMjyX5emuWcS2arzdEouA= k8s.io/apiextensions-apiserver v0.25.0 h1:CJ9zlyXAbq0FIW8CD7HHyozCMBpDSiH7EdrSTCZcZFY= k8s.io/apiextensions-apiserver v0.25.0/go.mod h1:3pAjZiN4zw7R8aZC5gR0y3/vCkGlAjCazcg1me8iB/E= k8s.io/apimachinery v0.21.1/go.mod h1:jbreFvJo3ov9rj7eWT7+sYiRx+qZuCYXwWT1bcDswPY= -k8s.io/apimachinery v0.25.0 h1:MlP0r6+3XbkUG2itd6vp3oxbtdQLQI94fD5gCS+gnoU= -k8s.io/apimachinery v0.25.0/go.mod h1:qMx9eAk0sZQGsXGu86fab8tZdffHbwUfsvzqKn4mfB0= +k8s.io/apimachinery v0.25.6 h1:r6KIF2AHwLqFfZ0LcOA3I11SF62YZK83dxj1fn14NOQ= +k8s.io/apimachinery v0.25.6/go.mod h1:1S2i1QHkmxc8+EZCIxe/fX5hpldVXk4gvnJInMEb8D4= k8s.io/apiserver v0.21.1/go.mod h1:nLLYZvMWn35glJ4/FZRhzLG/3MPxAaZTgV4FJZdr+tY= k8s.io/client-go v0.21.1/go.mod h1:/kEw4RgW+3xnBGzvp9IWxKSNA+lXn3A7AuH3gdOAzLs= -k8s.io/client-go v0.25.0 h1:CVWIaCETLMBNiTUta3d5nzRbXvY5Hy9Dpl+VvREpu5E= -k8s.io/client-go v0.25.0/go.mod h1:lxykvypVfKilxhTklov0wz1FoaUZ8X4EwbhS6rpRfN8= +k8s.io/client-go v0.25.6 h1:CHxACHi0DijmlYyUR7ooZoXnD5P8jYLgBHcxp775x/U= +k8s.io/client-go v0.25.6/go.mod h1:s9mMAGFYiH3Z66j7BESzu0GEradT9GQ2LjFf/YRrnyc= k8s.io/code-generator v0.21.1/go.mod h1:hUlps5+9QaTrKx+jiM4rmq7YmH8wPOIko64uZCHDh6Q= k8s.io/component-base v0.21.1/go.mod h1:NgzFZ2qu4m1juby4TnrmpR8adRk6ka62YdH5DkIIyKA= k8s.io/component-base v0.25.0 h1:haVKlLkPCFZhkcqB6WCvpVxftrg6+FK5x1ZuaIDaQ5Y= diff --git a/go.mod b/go.mod index 1ab9fb36dfc..02223317f83 100644 --- a/go.mod +++ b/go.mod @@ -35,7 +35,6 @@ require ( github.com/opencontainers/go-digest v1.0.1-0.20220411205349-bde1400a84be github.com/opencontainers/image-spec v1.1.0-rc1 github.com/pelletier/go-toml v1.9.5 - github.com/pkg/errors v0.9.1 github.com/pkg/sftp v1.13.5 github.com/schollz/progressbar/v3 v3.8.6 github.com/sirupsen/logrus v1.9.0 @@ -155,6 +154,7 @@ require ( github.com/openshift/imagebuilder v1.2.4-0.20220711175835-4151e43600df // indirect github.com/ostreedev/ostree-go v0.0.0-20210805093236-719684c64e4f // indirect github.com/peterbourgon/diskv v2.0.1+incompatible // indirect + github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/proglottis/gpgme v0.1.3 // indirect github.com/prometheus/client_golang v1.14.0 // indirect diff --git a/go.work.sum b/go.work.sum index 55763e03b16..7783c92bb9a 100644 --- a/go.work.sum +++ b/go.work.sum @@ -1629,6 +1629,7 @@ golang.org/x/net v0.0.0-20220826154423-83b083e8dc8b/go.mod h1:YDH+HFinaLZZlnHAfS golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= +golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/oauth2 v0.0.0-20220622183110-fd043fe589d2/go.mod h1:jaDAt6Dkxork7LmZnYtzbRWj0W47D86a3TGe0YHBvmE= golang.org/x/oauth2 v0.0.0-20220718184931-c8730f7fcb92/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= @@ -1818,8 +1819,6 @@ k8s.io/kube-aggregator v0.24.3 h1:7ScKNCG5JuSGnZPPH1DOu5R28/TU0DWll0fJgnKbEC8= k8s.io/kube-controller-manager v0.24.3 h1:8U9wCyx7FARr0bu30rfUiWw1bcy4ZdZ/bZMP+bBzT3I= k8s.io/kube-scheduler v0.24.3 h1:F4831qPvbTy8Eo2DamDnyyag+/Wczl+vSGZ6h8nrsAo= k8s.io/kubectl v0.24.3 h1:PqY8ho/S/KuE2/hCC3Iee7X+lOtARYo0LQsNzvV/edE= -k8s.io/kubernetes v1.25.6 h1:3zBcz3I4CXKnzR/K37Kzjtmu4O+/5XV/tUCa7gSiJG4= -k8s.io/kubernetes v1.25.6/go.mod h1:iB7lKyWeYg8+Oi5EPDEfdMtmae8BvjzziSpek2CcBe4= k8s.io/legacy-cloud-providers v0.24.3 h1:fy/H/26dp22QjuAIrEYqw8xNbUF2y9XnapaHjpoByiI= k8s.io/metrics v0.24.3 h1:pXzh+PG8L8ANg0PD3Ce8+yG5oj8BLvzBgsz8yCVEXyg= k8s.io/mount-utils v0.24.3 h1:o16GMv2uk3MzGgbgSYT49lNPHMgpmVbwJu9VPO47KgI= diff --git a/pkg/apply/processor/interface.go b/pkg/apply/processor/interface.go index ec80915f698..e28d57e6912 100644 --- a/pkg/apply/processor/interface.go +++ b/pkg/apply/processor/interface.go @@ -16,10 +16,10 @@ package processor import ( "context" + "errors" "path" "github.com/containers/storage" - "github.com/pkg/errors" "k8s.io/apimachinery/pkg/util/sets" "github.com/labring/sealos/pkg/buildah" diff --git a/pkg/auth/auth.go b/pkg/auth/auth.go index a3cdda194ab..108f1a1444f 100644 --- a/pkg/auth/auth.go +++ b/pkg/auth/auth.go @@ -15,7 +15,8 @@ package auth import ( - "github.com/pkg/errors" + "fmt" + "golang.org/x/oauth2" "github.com/labring/sealos/pkg/auth/conf" @@ -33,14 +34,14 @@ func Init(config conf.Config) error { var err error ssoClient, err = sso.InitSSO() if err != nil { - return errors.Wrap(err, "Init SSO platform failed") + return fmt.Errorf("init SSO platform failed: %w", err) } return nil } func GetLoginRedirect() (string, error) { redirectURL, err := ssoClient.GetRedirectURL() - return redirectURL, errors.Wrap(err, "Get redirect url failed") + return redirectURL, fmt.Errorf("get redirect url failed: %w", err) } func GetOAuthToken(state, code string) (*oauth2.Token, error) { @@ -54,17 +55,17 @@ func GetUserInfo(accessToken string) (*sso.User, error) { func GetKubeConfig(accessToken string) (string, error) { user, err := ssoClient.GetUserInfo(accessToken) if err != nil { - return "", errors.Wrap(err, "Get user info failed") + return "", fmt.Errorf("get user info failed: %w", err) } err = utils.CreateOrUpdateKubeConfig(user.ID) if err != nil { - return "", errors.Wrap(err, "Create kube config failed") + return "", fmt.Errorf("create kube config failed: %w", err) } // Wait for user controller to write kubeconfig into status kubeConfig, err := utils.GetKubeConfig(user.ID, 10) if err != nil { - return "", errors.Wrap(err, "Create kubeconfig failed") + return "", fmt.Errorf("create kubeconfig failed: %w", err) } return kubeConfig, nil } diff --git a/pkg/auth/sso/casdoor.go b/pkg/auth/sso/casdoor.go index ef63abfb8d9..7def0e1381c 100644 --- a/pkg/auth/sso/casdoor.go +++ b/pkg/auth/sso/casdoor.go @@ -16,10 +16,10 @@ package sso import ( "encoding/json" + "fmt" "os" casdoorAuth "github.com/casdoor/casdoor-go-sdk/auth" - "github.com/pkg/errors" "golang.org/x/oauth2" "github.com/labring/sealos/pkg/auth/conf" @@ -107,7 +107,7 @@ type Provider struct { func NewCasdoorClient() (*CasdoorClient, error) { initData, err := readInitDataFromFile() if err != nil { - return nil, errors.Wrap(err, "Read Casdoor init data failed") + return nil, fmt.Errorf("read Casdoor init data failed: %w", err) } client := &CasdoorClient{ Endpoint: conf.GlobalConfig.SSOEndpoint, @@ -142,7 +142,7 @@ func (c *CasdoorClient) GetToken(state, code string) (*oauth2.Token, error) { func (c *CasdoorClient) GetUserInfo(accessToken string) (*User, error) { casdoorUser, err := casdoorAuth.ParseJwtToken(accessToken) if err != nil { - return nil, errors.Wrap(err, "Parse Jwt token failed") + return nil, fmt.Errorf("parse Jwt token failed: %w", err) } return &User{ ID: casdoorUser.Id, @@ -158,11 +158,11 @@ func readInitDataFromFile() (*CasdoorInitData, error) { } data, err := os.ReadFile(path) if err != nil { - return nil, errors.Wrap(err, "Read init data failed") + return nil, fmt.Errorf("read init data failed: %w", err) } var initData CasdoorInitData if err := json.Unmarshal(data, &initData); err != nil { - return nil, errors.Wrap(err, "Unmarshal init data failed") + return nil, fmt.Errorf("unmarshal init data failed: %w", err) } return &initData, nil } diff --git a/pkg/buildah/imagesaver.go b/pkg/buildah/imagesaver.go index 28079c767de..72dfd7cf206 100644 --- a/pkg/buildah/imagesaver.go +++ b/pkg/buildah/imagesaver.go @@ -15,6 +15,7 @@ package buildah import ( + "fmt" "path" "runtime" "strings" @@ -22,7 +23,6 @@ import ( "github.com/containerd/containerd/platforms" "github.com/containers/buildah/pkg/parse" v1 "github.com/opencontainers/image-spec/specs-go/v1" - "github.com/pkg/errors" "github.com/spf13/cobra" "github.com/spf13/pflag" @@ -63,7 +63,7 @@ func runSaveImages(contextDir string, platforms []v1.Platform, opts *saveOptions logger.Debug("pull images %v for platform %s", images, strings.Join([]string{pf.OS, pf.Architecture}, "/")) images, err = is.SaveImages(images, path.Join(contextDir, constants.RegistryDirName), pf) if err != nil { - return errors.Wrap(err, "failed to save images") + return fmt.Errorf("failed to save images: %w", err) } logger.Info("saving images %s", strings.Join(images, ", ")) } diff --git a/pkg/buildah/internal/util/util.go b/pkg/buildah/internal/util/util.go index bbb58da80d1..3cdda1d09fc 100644 --- a/pkg/buildah/internal/util/util.go +++ b/pkg/buildah/internal/util/util.go @@ -20,7 +20,6 @@ import ( "github.com/containers/buildah/define" encconfig "github.com/containers/ocicrypt/config" enchelpers "github.com/containers/ocicrypt/helpers" - "github.com/pkg/errors" ) func DecryptConfig(decryptionKeys []string) (*encconfig.DecryptConfig, error) { @@ -29,7 +28,7 @@ func DecryptConfig(decryptionKeys []string) (*encconfig.DecryptConfig, error) { // decryption dcc, err := enchelpers.CreateCryptoConfig([]string{}, decryptionKeys) if err != nil { - return nil, errors.Wrapf(err, "invalid decryption keys") + return nil, fmt.Errorf("invalid decryption keys: %w", err) } cc := encconfig.CombineCryptoConfigs([]encconfig.CryptoConfig{dcc}) decConfig = cc.DecryptConfig diff --git a/pkg/buildimage/images.go b/pkg/buildimage/images.go index a4d6a46ae0c..bbed312378a 100644 --- a/pkg/buildimage/images.go +++ b/pkg/buildimage/images.go @@ -15,12 +15,12 @@ package buildimage import ( + "fmt" "io/fs" "path" "path/filepath" "strings" - "github.com/pkg/errors" "k8s.io/apimachinery/pkg/util/sets" "github.com/labring/sealos/pkg/buildimage/manifests" @@ -82,12 +82,12 @@ func ParseShimImages(dir string) ([]string, error) { list := sets.NewString() paths, err := file.GetFiles(dir) if err != nil { - return nil, errors.Wrap(err, "load image list files error") + return nil, fmt.Errorf("load image list files error: %w", err) } for _, p := range paths { images, err := file.ReadLines(p) if err != nil { - return nil, errors.Wrap(err, "load image list error") + return nil, fmt.Errorf("load image list error: %w", err) } list = list.Insert(images...) } @@ -97,7 +97,7 @@ func ParseShimImages(dir string) ([]string, error) { func List(dir string) ([]string, error) { wrapGetImageErr := func(err error, s string) error { - return errors.Wrapf(err, "failed to get images in %s", s) + return fmt.Errorf("failed to get images in %s: %w", s, err) } chrtDir := path.Join(dir, constants.ChartsDirName) chrtImgs, err := ParseChartImages(chrtDir) diff --git a/pkg/cert/kubeconfig.go b/pkg/cert/kubeconfig.go index 96cf41dd699..1626fb50934 100644 --- a/pkg/cert/kubeconfig.go +++ b/pkg/cert/kubeconfig.go @@ -18,16 +18,16 @@ import ( "bytes" "crypto" "crypto/x509" + "errors" "fmt" "os" "path/filepath" - "github.com/labring/sealos/pkg/utils/logger" - - "github.com/pkg/errors" "k8s.io/client-go/tools/clientcmd" clientcmdapi "k8s.io/client-go/tools/clientcmd/api" "k8s.io/client-go/util/keyutil" + + "github.com/labring/sealos/pkg/utils/logger" ) // clientCertAuth struct holds info required to build a client certificate to provide authentication info in a kubeconfig object @@ -87,7 +87,7 @@ func createKubeConfigFiles(outDir string, cfg Config, nodeName, controlPlaneEndp // retrieves the KubeConfigSpec for given kubeConfigFileName spec, exists := specs[kubeConfigFileName] if !exists { - return errors.Errorf("couldn't retrieve KubeConfigSpec for %s", kubeConfigFileName) + return fmt.Errorf("couldn't retrieve KubeConfigSpec for %s", kubeConfigFileName) } // builds the KubeConfig object @@ -110,7 +110,7 @@ func createKubeConfigFiles(outDir string, cfg Config, nodeName, controlPlaneEndp func getKubeConfigSpecs(cfg Config, nodeName, controlPlaneEndpoint string) (map[string]*kubeConfigSpec, error) { caCert, caKey, err := LoadCaCertAndKeyFromDisk(cfg) if err != nil { - return nil, errors.Wrap(err, "couldn't create a kubeconfig; the CA files couldn't be loaded") + return nil, fmt.Errorf("couldn't create a kubeconfig; the CA files couldn't be loaded: %w", err) } if len(nodeName) == 0 { @@ -185,12 +185,12 @@ func buildKubeConfigFromSpec(spec *kubeConfigSpec, clustername string) (*clientc clientCert, clientKey, err := NewCaCertAndKeyFromRoot(clientCertConfig, spec.CACert, spec.ClientCertAuth.CAKey) if err != nil { - return nil, errors.Wrapf(err, "failure while creating %s client certificate", spec.ClientName) + return nil, fmt.Errorf("failure while creating %s client certificate: %w", spec.ClientName, err) } encodedClientKey, err := keyutil.MarshalPrivateKeyToPEM(clientKey) if err != nil { - return nil, errors.Wrapf(err, "failed to marshal private key to PEM") + return nil, fmt.Errorf("failed to marshal private key to PEM: %w", err) } // create a kubeconfig with the client certs return CreateWithCerts( @@ -214,21 +214,21 @@ func validateKubeConfig(outDir, filename string, config *clientcmdapi.Config) er // The kubeconfig already exists, let's check if it has got the same CA and server URL currentConfig, err := clientcmd.LoadFromFile(kubeConfigFilePath) if err != nil { - return errors.Wrapf(err, "failed to load kubeconfig file %s that already exists on disk", kubeConfigFilePath) + return fmt.Errorf("failed to load kubeconfig file %s that already exists on disk: %w", kubeConfigFilePath, err) } expectedCtx, exists := config.Contexts[config.CurrentContext] if !exists { - return errors.Errorf("failed to find expected context %s", config.CurrentContext) + return fmt.Errorf("failed to find expected context %s", config.CurrentContext) } expectedCluster := expectedCtx.Cluster currentCtx, exists := currentConfig.Contexts[currentConfig.CurrentContext] if !exists { - return errors.Errorf("failed to find CurrentContext in Contexts of the kubeconfig file %s", kubeConfigFilePath) + return fmt.Errorf("failed to find CurrentContext in Contexts of the kubeconfig file %s", kubeConfigFilePath) } currentCluster := currentCtx.Cluster if currentConfig.Clusters[currentCluster] == nil { - return errors.Errorf("failed to find the given CurrentContext Infra in Clusters of the kubeconfig file %s", kubeConfigFilePath) + return fmt.Errorf("failed to find the given CurrentContext Infra in Clusters of the kubeconfig file %s", kubeConfigFilePath) } // Make sure the compared CAs are whitespace-trimmed. The function clientcmd.LoadFromFile() just decodes @@ -239,11 +239,11 @@ func validateKubeConfig(outDir, filename string, config *clientcmdapi.Config) er // If the current CA cert on disk doesn't match the expected CA cert, error out because we have a file, but it's stale if !bytes.Equal(caCurrent, caExpected) { - return errors.Errorf("a kubeconfig file %q exists already but has got the wrong CA cert", kubeConfigFilePath) + return fmt.Errorf("a kubeconfig file %q exists already but has got the wrong CA cert", kubeConfigFilePath) } // If the current API Server location on disk doesn't match the expected API server, error out because we have a file, but it's stale if currentConfig.Clusters[currentCluster].Server != config.Clusters[expectedCluster].Server { - return errors.Errorf("a kubeconfig file %q exists already but has got the wrong API Server URL", kubeConfigFilePath) + return fmt.Errorf("a kubeconfig file %q exists already but has got the wrong API Server URL", kubeConfigFilePath) } return nil @@ -265,7 +265,7 @@ func createKubeConfigFileIfNotExists(outDir, filename string, config *clientcmda logger.Debug("[kubeconfig] Writing %q kubeconfig file\n", filename) err = WriteToDisk(kubeConfigFilePath, config) if err != nil { - return errors.Wrapf(err, "failed to save kubeconfig file %q on disk", kubeConfigFilePath) + return fmt.Errorf("failed to save kubeconfig file %q on disk: %w", kubeConfigFilePath, err) } return nil } diff --git a/pkg/checker/cri_shim_checker.go b/pkg/checker/cri_shim_checker.go index da531a4507a..17b490ae027 100644 --- a/pkg/checker/cri_shim_checker.go +++ b/pkg/checker/cri_shim_checker.go @@ -17,14 +17,14 @@ limitations under the License. package checker import ( + "errors" + "fmt" "os" - "github.com/labring/sealos/pkg/template" - "github.com/labring/image-cri-shim/pkg/types" - "github.com/pkg/errors" "github.com/labring/sealos/pkg/buildimage" + "github.com/labring/sealos/pkg/template" v2 "github.com/labring/sealos/pkg/types/v1beta1" "github.com/labring/sealos/pkg/utils/logger" ) @@ -52,7 +52,7 @@ func (n *CRIShimChecker) Check(cluster *v2.Cluster, phase string) error { criShimConfig := "/etc/image-cri-shim.yaml" if shimCfg, err := types.Unmarshal(criShimConfig); err != nil { - status.Error = errors.Wrap(err, "read image-cri-shim config error").Error() + status.Error = fmt.Errorf("read image-cri-shim config error: %w", err).Error() } else { status.Config = map[string]string{} @@ -69,7 +69,7 @@ func (n *CRIShimChecker) Check(cluster *v2.Cluster, phase string) error { if dir := status.Config["RootfsImageList"]; dir != "" { images, err := buildimage.ParseShimImages(dir) if err != nil { - status.Error = errors.Wrap(err, "read image-cri-shim config error").Error() + status.Error = fmt.Errorf("read image-cri-shim config error: %w", err).Error() } else { status.ImageList = images } diff --git a/pkg/checker/crictl_checker.go b/pkg/checker/crictl_checker.go index d31ae3192e9..013408b8617 100644 --- a/pkg/checker/crictl_checker.go +++ b/pkg/checker/crictl_checker.go @@ -18,19 +18,18 @@ package checker import ( "encoding/json" + "errors" "fmt" "os" "strings" - "github.com/labring/sealos/pkg/template" - - "github.com/pkg/errors" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/utils/exec" "github.com/labring/sealos/pkg/bootstrap" "github.com/labring/sealos/pkg/constants" "github.com/labring/sealos/pkg/ssh" + "github.com/labring/sealos/pkg/template" v2 "github.com/labring/sealos/pkg/types/v1beta1" exec2 "github.com/labring/sealos/pkg/utils/exec" fileutil "github.com/labring/sealos/pkg/utils/file" @@ -72,7 +71,7 @@ func (n *CRICtlChecker) Check(cluster *v2.Cluster, phase string) error { criShimConfig := "/etc/crictl.yaml" if cfg, err := fileutil.ReadAll(criShimConfig); err != nil { - status.Error = errors.Wrap(err, "read crictl config error").Error() + status.Error = fmt.Errorf("read crictl config error: %w", err).Error() } else { cfgMap, _ := yaml.UnmarshalData(cfg) status.Config = map[string]string{} @@ -82,19 +81,19 @@ func (n *CRICtlChecker) Check(cluster *v2.Cluster, phase string) error { execer := exec.New() crictlPath, err := execer.LookPath("crictl") if err != nil { - status.Error = errors.Wrap(err, "error looking for path of crictl").Error() + status.Error = fmt.Errorf("error looking for path of crictl: %w", err).Error() return nil } imageList, err := n.getCRICtlImageList(crictlPath) if err != nil { - status.Error = errors.Wrap(err, "error list images of crictl").Error() + status.Error = fmt.Errorf("error list images of crictl: %w", err).Error() } status.ImageList = imageList containerList, err := n.getCRICtlContainerList(crictlPath) if err != nil { - status.Error = errors.Wrap(err, "error ps container of crictl").Error() + status.Error = fmt.Errorf("error ps container of crictl: %w", err).Error() } status.ContainerList = containerList @@ -106,7 +105,7 @@ func (n *CRICtlChecker) Check(cluster *v2.Cluster, phase string) error { } sshCtx, err := ssh.NewSSHByCluster(cluster, false) if err != nil { - status.Error = errors.Wrap(err, "get ssh interface error").Error() + status.Error = fmt.Errorf("get ssh interface error: %w", err).Error() return nil } @@ -115,13 +114,13 @@ func (n *CRICtlChecker) Check(cluster *v2.Cluster, phase string) error { regStatus, err := n.getRegistryStatus(crictlPath, pauseImage, fmt.Sprintf("%s:%s", regInfo.Domain, regInfo.Port)) if err != nil { - status.Error = errors.Wrap(err, "pull registry image error").Error() + status.Error = fmt.Errorf("pull registry image error: %w", err).Error() } status.RegistryPullStatus = regStatus shimStatus, err := n.getRegistryStatus(crictlPath, pauseImage, "k8s.gcr.io") if err != nil { - status.Error = errors.Wrap(err, "pull shim image error").Error() + status.Error = fmt.Errorf("pull shim image error: %w", err).Error() } status.ImageShimPullStatus = shimStatus status.Error = Nil diff --git a/pkg/checker/initsystem_check.go b/pkg/checker/initsystem_check.go index 680a8a3f883..9521619234e 100644 --- a/pkg/checker/initsystem_check.go +++ b/pkg/checker/initsystem_check.go @@ -17,13 +17,11 @@ limitations under the License. package checker import ( + "errors" "fmt" "os" "github.com/labring/sealos/pkg/template" - - "github.com/pkg/errors" - v2 "github.com/labring/sealos/pkg/types/v1beta1" "github.com/labring/sealos/pkg/utils/initsystem" "github.com/labring/sealos/pkg/utils/logger" @@ -56,7 +54,7 @@ func (n *InitSystemChecker) Check(cluster *v2.Cluster, phase string) error { }() initsystemvar, err := initsystem.GetInitSystem() if err != nil { - status.Error = errors.Wrap(err, "get initsystem error").Error() + status.Error = fmt.Errorf("get initsystem error: %w", err).Error() return nil } @@ -80,8 +78,8 @@ Systemd Service Status Error: {{ .Error }} {{ if .ServiceList -}} Init System List: - {{- range .ServiceList }} - Name: {{.Name}} Status: {{.Status}} + {{- range .ServiceList }} + Name: {{.Name}} Status: {{.Status}} {{- end }} {{ end }}`) if err != nil || !isOk { diff --git a/pkg/checker/registry_checker.go b/pkg/checker/registry_checker.go index d4e982d0f79..55f616d4cf7 100644 --- a/pkg/checker/registry_checker.go +++ b/pkg/checker/registry_checker.go @@ -17,20 +17,19 @@ limitations under the License. package checker import ( + "errors" "fmt" "os" - "github.com/labring/sealos/pkg/template" - "github.com/labring/sealos/pkg/utils/iputils" - - "github.com/pkg/errors" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "github.com/labring/sealos/pkg/bootstrap" "github.com/labring/sealos/pkg/constants" "github.com/labring/sealos/pkg/ssh" + "github.com/labring/sealos/pkg/template" v2 "github.com/labring/sealos/pkg/types/v1beta1" fileutil "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/registry" "github.com/labring/sealos/pkg/utils/yaml" @@ -70,7 +69,7 @@ func (n *RegistryChecker) Check(cluster *v2.Cluster, phase string) error { registryConfig := "/etc/registry/registry_config.yml" if cfg, err := fileutil.ReadAll(registryConfig); err != nil { - status.Error = errors.Wrap(err, "read registry config error").Error() + status.Error = fmt.Errorf("read registry config error: %w", err).Error() } else { cfgMap, _ := yaml.UnmarshalData(cfg) status.Port, _, _ = unstructured.NestedString(cfgMap, "http", "addr") @@ -86,7 +85,7 @@ func (n *RegistryChecker) Check(cluster *v2.Cluster, phase string) error { sshCtx, err := ssh.NewSSHByCluster(cluster, false) if err != nil { - status.Error = errors.Wrap(err, "get ssh interface error").Error() + status.Error = fmt.Errorf("get ssh interface error: %w", err).Error() return nil } root := constants.NewData(cluster.Name).RootFSPath() @@ -95,7 +94,7 @@ func (n *RegistryChecker) Check(cluster *v2.Cluster, phase string) error { status.RegistryDomain = fmt.Sprintf("%s:%s", regInfo.Domain, regInfo.Port) regInterface, err := registry.NewRegistryForDomain(status.RegistryDomain, regInfo.Username, regInfo.Password) if err != nil { - status.Error = errors.Wrap(err, "get registry interface error").Error() + status.Error = fmt.Errorf("get registry interface error: %w", err).Error() return nil } if err = regInterface.Ping(); err != nil { diff --git a/pkg/client-go/kubernetes/healthy.go b/pkg/client-go/kubernetes/healthy.go index 0f0ecaa693c..b3938ca078b 100644 --- a/pkg/client-go/kubernetes/healthy.go +++ b/pkg/client-go/kubernetes/healthy.go @@ -18,22 +18,20 @@ package kubernetes import ( "context" + "errors" "fmt" "io" "net/http" "net/url" "time" - "github.com/labring/sealos/pkg/utils/logger" - v1 "k8s.io/api/core/v1" - - "github.com/pkg/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" netutil "k8s.io/apimachinery/pkg/util/net" "k8s.io/apimachinery/pkg/util/wait" clientset "k8s.io/client-go/kubernetes" + + "github.com/labring/sealos/pkg/utils/logger" ) // Healthy is an interface for waiting for criteria in Kubernetes to happen diff --git a/pkg/client-go/kubernetes/idempotency.go b/pkg/client-go/kubernetes/idempotency.go index 43ae59a2ec8..22e1b3db3dc 100644 --- a/pkg/client-go/kubernetes/idempotency.go +++ b/pkg/client-go/kubernetes/idempotency.go @@ -19,12 +19,9 @@ package kubernetes import ( "context" "encoding/json" + "fmt" "time" - "github.com/labring/sealos/pkg/utils/logger" - - "github.com/pkg/errors" - apps "k8s.io/api/apps/v1" v1 "k8s.io/api/core/v1" rbac "k8s.io/api/rbac/v1" @@ -34,6 +31,8 @@ import ( "k8s.io/apimachinery/pkg/util/strategicpatch" "k8s.io/apimachinery/pkg/util/wait" clientset "k8s.io/client-go/kubernetes" + + "github.com/labring/sealos/pkg/utils/logger" ) const ( @@ -80,11 +79,11 @@ func NewKubeIdempotency(client clientset.Interface) Idempotency { func (ki *kubeIdempotency) CreateOrUpdateConfigMap(cm *v1.ConfigMap) error { if _, err := ki.client.CoreV1().ConfigMaps(cm.ObjectMeta.Namespace).Create(context.TODO(), cm, metav1.CreateOptions{}); err != nil { if !apierrors.IsAlreadyExists(err) { - return errors.Wrap(err, "unable to create ConfigMap") + return fmt.Errorf("unable to create ConfigMap: %w", err) } if _, err := ki.client.CoreV1().ConfigMaps(cm.ObjectMeta.Namespace).Update(context.TODO(), cm, metav1.UpdateOptions{}); err != nil { - return errors.Wrap(err, "unable to update ConfigMap") + return fmt.Errorf("unable to update ConfigMap: %w", err) } } return nil @@ -94,11 +93,11 @@ func (ki *kubeIdempotency) CreateOrUpdateConfigMap(cm *v1.ConfigMap) error { func (ki *kubeIdempotency) CreateOrUpdateSecret(secret *v1.Secret) error { if _, err := ki.client.CoreV1().Secrets(secret.ObjectMeta.Namespace).Create(context.TODO(), secret, metav1.CreateOptions{}); err != nil { if !apierrors.IsAlreadyExists(err) { - return errors.Wrap(err, "unable to create secret") + return fmt.Errorf("unable to create secret: %w", err) } if _, err := ki.client.CoreV1().Secrets(secret.ObjectMeta.Namespace).Update(context.TODO(), secret, metav1.UpdateOptions{}); err != nil { - return errors.Wrap(err, "unable to update secret") + return fmt.Errorf("unable to update secret: %w", err) } } return nil @@ -110,7 +109,7 @@ func (ki *kubeIdempotency) CreateOrUpdateServiceAccount(sa *v1.ServiceAccount) e // Note: We don't run .Update here afterwards as that's probably not required // Only thing that could be updated is annotations/labels in .metadata, but we don't use that currently if !apierrors.IsAlreadyExists(err) { - return errors.Wrap(err, "unable to create serviceaccount") + return fmt.Errorf("unable to create serviceaccount: %w", err) } } return nil @@ -120,11 +119,11 @@ func (ki *kubeIdempotency) CreateOrUpdateServiceAccount(sa *v1.ServiceAccount) e func (ki *kubeIdempotency) CreateOrUpdateDeployment(deploy *apps.Deployment) error { if _, err := ki.client.AppsV1().Deployments(deploy.ObjectMeta.Namespace).Create(context.TODO(), deploy, metav1.CreateOptions{}); err != nil { if !apierrors.IsAlreadyExists(err) { - return errors.Wrap(err, "unable to create deployment") + return fmt.Errorf("unable to create deployment: %w", err) } if _, err := ki.client.AppsV1().Deployments(deploy.ObjectMeta.Namespace).Update(context.TODO(), deploy, metav1.UpdateOptions{}); err != nil { - return errors.Wrap(err, "unable to update deployment") + return fmt.Errorf("unable to update deployment: %w", err) } } return nil @@ -134,11 +133,11 @@ func (ki *kubeIdempotency) CreateOrUpdateDeployment(deploy *apps.Deployment) err func (ki *kubeIdempotency) CreateOrUpdateDaemonSet(ds *apps.DaemonSet) error { if _, err := ki.client.AppsV1().DaemonSets(ds.ObjectMeta.Namespace).Create(context.TODO(), ds, metav1.CreateOptions{}); err != nil { if !apierrors.IsAlreadyExists(err) { - return errors.Wrap(err, "unable to create daemonset") + return fmt.Errorf("unable to create daemonset: %w", err) } if _, err := ki.client.AppsV1().DaemonSets(ds.ObjectMeta.Namespace).Update(context.TODO(), ds, metav1.UpdateOptions{}); err != nil { - return errors.Wrap(err, "unable to update daemonset") + return fmt.Errorf("unable to update daemonset: %w", err) } } return nil @@ -160,11 +159,11 @@ func (ki *kubeIdempotency) DeleteDeploymentForeground(namespace, name string) er func (ki *kubeIdempotency) CreateOrUpdateRole(role *rbac.Role) error { if _, err := ki.client.RbacV1().Roles(role.ObjectMeta.Namespace).Create(context.TODO(), role, metav1.CreateOptions{}); err != nil { if !apierrors.IsAlreadyExists(err) { - return errors.Wrap(err, "unable to create RBAC role") + return fmt.Errorf("unable to create RBAC role: %w", err) } if _, err := ki.client.RbacV1().Roles(role.ObjectMeta.Namespace).Update(context.TODO(), role, metav1.UpdateOptions{}); err != nil { - return errors.Wrap(err, "unable to update RBAC role") + return fmt.Errorf("unable to update RBAC role: %w", err) } } return nil @@ -174,11 +173,11 @@ func (ki *kubeIdempotency) CreateOrUpdateRole(role *rbac.Role) error { func (ki *kubeIdempotency) CreateOrUpdateRoleBinding(roleBinding *rbac.RoleBinding) error { if _, err := ki.client.RbacV1().RoleBindings(roleBinding.ObjectMeta.Namespace).Create(context.TODO(), roleBinding, metav1.CreateOptions{}); err != nil { if !apierrors.IsAlreadyExists(err) { - return errors.Wrap(err, "unable to create RBAC rolebinding") + return fmt.Errorf("unable to create RBAC rolebinding: %w", err) } if _, err := ki.client.RbacV1().RoleBindings(roleBinding.ObjectMeta.Namespace).Update(context.TODO(), roleBinding, metav1.UpdateOptions{}); err != nil { - return errors.Wrap(err, "unable to update RBAC rolebinding") + return fmt.Errorf("unable to update RBAC rolebinding: %w", err) } } return nil @@ -188,11 +187,11 @@ func (ki *kubeIdempotency) CreateOrUpdateRoleBinding(roleBinding *rbac.RoleBindi func (ki *kubeIdempotency) CreateOrUpdateClusterRole(clusterRole *rbac.ClusterRole) error { if _, err := ki.client.RbacV1().ClusterRoles().Create(context.TODO(), clusterRole, metav1.CreateOptions{}); err != nil { if !apierrors.IsAlreadyExists(err) { - return errors.Wrap(err, "unable to create RBAC clusterrole") + return fmt.Errorf("unable to create RBAC clusterrole: %w", err) } if _, err := ki.client.RbacV1().ClusterRoles().Update(context.TODO(), clusterRole, metav1.UpdateOptions{}); err != nil { - return errors.Wrap(err, "unable to update RBAC clusterrole") + return fmt.Errorf("unable to update RBAC clusterrole: %w", err) } } return nil @@ -202,11 +201,11 @@ func (ki *kubeIdempotency) CreateOrUpdateClusterRole(clusterRole *rbac.ClusterRo func (ki *kubeIdempotency) CreateOrUpdateClusterRoleBinding(clusterRoleBinding *rbac.ClusterRoleBinding) error { if _, err := ki.client.RbacV1().ClusterRoleBindings().Create(context.TODO(), clusterRoleBinding, metav1.CreateOptions{}); err != nil { if !apierrors.IsAlreadyExists(err) { - return errors.Wrap(err, "unable to create RBAC clusterrolebinding") + return fmt.Errorf("unable to create RBAC clusterrolebinding: %w", err) } if _, err := ki.client.RbacV1().ClusterRoleBindings().Update(context.TODO(), clusterRoleBinding, metav1.UpdateOptions{}); err != nil { - return errors.Wrap(err, "unable to update RBAC clusterrolebinding") + return fmt.Errorf("unable to update RBAC clusterrolebinding: %w", err) } } return nil @@ -232,7 +231,7 @@ func (ki *kubeIdempotency) patchNodeOnce(nodeName string, patchFn func(*v1.Node) oldData, err := json.Marshal(n) if err != nil { - return false, errors.Wrapf(err, "failed to marshal unmodified node %q into JSON", n.Name) + return false, fmt.Errorf("failed to marshal unmodified node %q into JSON: %w", n.Name, err) } // Execute the mutating function @@ -240,12 +239,12 @@ func (ki *kubeIdempotency) patchNodeOnce(nodeName string, patchFn func(*v1.Node) newData, err := json.Marshal(n) if err != nil { - return false, errors.Wrapf(err, "failed to marshal modified node %q into JSON", n.Name) + return false, fmt.Errorf("failed to marshal modified node %q into JSON: %w", n.Name, err) } patchBytes, err := strategicpatch.CreateTwoWayMergePatch(oldData, newData, v1.Node{}) if err != nil { - return false, errors.Wrap(err, "failed to create two way merge patch") + return false, fmt.Errorf("failed to create two way merge patch: %w", err) } if _, err := ki.client.CoreV1().Nodes().Patch(context.TODO(), n.Name, types.StrategicMergePatchType, patchBytes, metav1.PatchOptions{}); err != nil { @@ -253,7 +252,7 @@ func (ki *kubeIdempotency) patchNodeOnce(nodeName string, patchFn func(*v1.Node) logger.Debug("Temporarily unable to update node metadata due to conflict (will retry)") return false, nil } - return false, errors.Wrapf(err, "error patching node %q through apiserver", n.Name) + return false, fmt.Errorf("error patching node %q through apiserver: %w", n.Name, err) } return true, nil diff --git a/pkg/clusterfile/util.go b/pkg/clusterfile/util.go index dccc43c8e87..a376d0404d5 100644 --- a/pkg/clusterfile/util.go +++ b/pkg/clusterfile/util.go @@ -46,7 +46,7 @@ func GetDefaultClusterName() (string, error) { if len(clusters) == 1 { return clusters[0], nil } else if len(clusters) > 1 { - return "", fmt.Errorf("Select a cluster through the -c parameter: " + strings.Join(clusters, ",")) + return "", fmt.Errorf("select a cluster through the -c parameter: " + strings.Join(clusters, ",")) } return "", ErrClusterNotExist diff --git a/pkg/filesystem/rootfs/rootfs_default.go b/pkg/filesystem/rootfs/rootfs_default.go index ba33f3a708e..0615f541711 100644 --- a/pkg/filesystem/rootfs/rootfs_default.go +++ b/pkg/filesystem/rootfs/rootfs_default.go @@ -22,7 +22,6 @@ import ( "io/fs" "path" - "github.com/pkg/errors" "golang.org/x/sync/errgroup" "github.com/labring/sealos/pkg/constants" @@ -71,16 +70,16 @@ func (f *defaultRootfs) mountRootfs(cluster *v2.Cluster, ipList []string) error } err := renderENV(src.MountPoint, ipList, envProcessor) if err != nil { - return errors.Wrap(err, "failed to render env") + return fmt.Errorf("failed to render env: %w", err) } dirs, err := file.StatDir(src.MountPoint, true) if err != nil { - return errors.Wrap(err, "failed to stat files") + return fmt.Errorf("failed to stat files: %w", err) } if len(dirs) != 0 { _, err = exec.RunBashCmd(fmt.Sprintf(constants.DefaultChmodBash, src.MountPoint)) if err != nil { - return errors.Wrap(err, "run chmod to rootfs failed") + return fmt.Errorf("run chmod to rootfs failed: %w", err) } } return nil diff --git a/pkg/guest/guest.go b/pkg/guest/guest.go index 6f9b8a0d436..8e503b237b2 100644 --- a/pkg/guest/guest.go +++ b/pkg/guest/guest.go @@ -19,8 +19,6 @@ import ( "path/filepath" "strings" - "github.com/pkg/errors" - "github.com/labring/sealos/fork/golang/expansion" "github.com/labring/sealos/pkg/constants" "github.com/labring/sealos/pkg/env" @@ -54,7 +52,7 @@ func (d *Default) Apply(cluster *v2.Cluster, mounts []v2.MountImage) error { adminFile := runtime.GetConstantData(cluster.Name).AdminFile() data, err := fileutil.ReadAll(adminFile) if err != nil { - return errors.Wrap(err, "read admin.conf error in guest") + return fmt.Errorf("read admin.conf error in guest: %w", err) } master0IP := cluster.GetMaster0IP() outData := strings.ReplaceAll(string(data), runtime.DefaultAPIServerDomain, master0IP) diff --git a/pkg/ipvs/lvscare.go b/pkg/ipvs/lvscare.go index 99c2566c7eb..799a0859acd 100644 --- a/pkg/ipvs/lvscare.go +++ b/pkg/ipvs/lvscare.go @@ -17,14 +17,13 @@ package ipvs import ( "fmt" - "github.com/labring/sealos/pkg/constants" - "github.com/labring/sealos/pkg/utils/hosts" - - "github.com/pkg/errors" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/kubernetes/scheme" + + "github.com/labring/sealos/pkg/constants" + "github.com/labring/sealos/pkg/utils/hosts" ) const ( @@ -65,7 +64,7 @@ func podToYaml(pod v1.Pod) ([]byte, error) { const mediaType = runtime.ContentTypeYAML info, ok := runtime.SerializerInfoForMediaType(codecs.SupportedMediaTypes(), mediaType) if !ok { - return []byte{}, errors.Errorf("unsupported media type %q", mediaType) + return []byte{}, fmt.Errorf("unsupported media type %q", mediaType) } encoder := codecs.EncoderForVersion(info.Serializer, gv) diff --git a/pkg/registry/cmd/flags.go b/pkg/registry/cmd/flags.go index 2ea6710c024..e0821b84e8c 100644 --- a/pkg/registry/cmd/flags.go +++ b/pkg/registry/cmd/flags.go @@ -17,11 +17,10 @@ limitations under the License. package cmd import ( + "fmt" "os" "runtime" - "github.com/pkg/errors" - "github.com/docker/docker/api/types" "github.com/spf13/pflag" @@ -94,7 +93,7 @@ func (opts *registrySaveResults) CheckAuth() (map[string]types.AuthConfig, error } cfg, err := registry.GetAuthInfo() if err != nil { - return nil, errors.Wrap(err, "auth info is error") + return nil, fmt.Errorf("auth info is error: %w", err) } return cfg, nil } diff --git a/pkg/registry/cmd/rmi.go b/pkg/registry/cmd/rmi.go index d5b1b3ea3ea..5477466b9c6 100644 --- a/pkg/registry/cmd/rmi.go +++ b/pkg/registry/cmd/rmi.go @@ -17,16 +17,14 @@ limitations under the License. package cmd import ( + "errors" "fmt" "os" "strings" - "k8s.io/apimachinery/pkg/util/validation/field" - - "github.com/pkg/errors" - "github.com/docker/docker/api/types" "github.com/spf13/cobra" + "k8s.io/apimachinery/pkg/util/validation/field" "github.com/labring/sealos/pkg/registry" "github.com/labring/sealos/pkg/utils/logger" diff --git a/pkg/registry/cmd/save.go b/pkg/registry/cmd/save.go index 0bf4e0f5a4e..3fc07eb80fe 100644 --- a/pkg/registry/cmd/save.go +++ b/pkg/registry/cmd/save.go @@ -18,10 +18,9 @@ package cmd import ( "context" + "fmt" "os" - "github.com/pkg/errors" - "github.com/docker/docker/api/types" v1 "github.com/opencontainers/image-spec/specs-go/v1" "github.com/spf13/cobra" @@ -101,7 +100,7 @@ func saveRawCmd() *cobra.Command { is := registry.NewImageSaver(context.Background(), flagsResults.registryPullMaxPullProcs, auth) outImages, err := is.SaveImages(flagsResults.images, flagsResults.registryPullRegistryDir, v1.Platform{OS: "linux", Architecture: flagsResults.registryPullArch}) if err != nil { - return errors.Wrap(err, "pull registry images is error") + return fmt.Errorf("pull registry images is error: %w", err) } logger.Info("pull images list save to local : %+v", outImages) return nil diff --git a/pkg/registry/save.go b/pkg/registry/save.go index b93ab7ed6b4..f4799a42964 100644 --- a/pkg/registry/save.go +++ b/pkg/registry/save.go @@ -23,12 +23,6 @@ import ( "strings" "sync" - "k8s.io/apimachinery/pkg/util/sets" - - "github.com/labring/sealos/pkg/passwd" - "github.com/labring/sealos/pkg/utils/http" - "github.com/labring/sealos/pkg/utils/logger" - distribution "github.com/distribution/distribution/v3" "github.com/distribution/distribution/v3/configuration" "github.com/distribution/distribution/v3/reference" @@ -41,10 +35,13 @@ import ( "github.com/docker/docker/pkg/streamformatter" "github.com/opencontainers/go-digest" v1 "github.com/opencontainers/image-spec/specs-go/v1" - "github.com/pkg/errors" "golang.org/x/sync/errgroup" + "k8s.io/apimachinery/pkg/util/sets" + "github.com/labring/sealos/pkg/passwd" "github.com/labring/sealos/pkg/registry/distributionpkg/proxy" + "github.com/labring/sealos/pkg/utils/http" + "github.com/labring/sealos/pkg/utils/logger" ) const ( @@ -116,7 +113,7 @@ func (is *DefaultImage) SaveImages(images []string, dir string, platform v1.Plat err = is.save(tmpnameds, platform, registry) if err != nil { - return errors.WithMessagef(err, "save domain %s image %s", tmpnameds[0].domain, tmpnameds[0].FullName()) + return fmt.Errorf("save domain %s image %s: %w", tmpnameds[0].domain, tmpnameds[0].FullName(), err) } outImages = append(outImages, tmpnameds[0].FullName()) return nil diff --git a/pkg/runtime/kubeadm.go b/pkg/runtime/kubeadm.go index 3399faa9d53..848c8c98a91 100644 --- a/pkg/runtime/kubeadm.go +++ b/pkg/runtime/kubeadm.go @@ -28,7 +28,6 @@ import ( "github.com/labring/sealos/pkg/utils/versionutil" "github.com/labring/sealos/pkg/utils/yaml" - "github.com/pkg/errors" "k8s.io/apimachinery/pkg/util/json" kubeproxyconfigv1alpha1 "k8s.io/kube-proxy/config/v1alpha1" @@ -387,7 +386,7 @@ func (k *KubeadmRuntime) ConvertInitConfigConversion(fns ...func(*KubeadmRuntime k.IPVS.ExcludeCIDRs = strings2.RemoveDuplicate(k.IPVS.ExcludeCIDRs) if err := k.convertKubeadmVersion(); err != nil { - return errors.Wrap(err, "convert kubeadm version failed") + return fmt.Errorf("convert kubeadm version failed: %w", err) } return nil } @@ -480,7 +479,7 @@ func (k *KubeadmRuntime) generateJoinNodeConfigs(node string) ([]byte, error) { k.cleanJoinLocalAPIEndPoint() k.setAPIServerEndpoint(k.getVipAndPort()) if err := k.convertKubeadmVersion(); err != nil { - return nil, errors.Wrap(err, "convert kubeadm version failed") + return nil, fmt.Errorf("convert kubeadm version failed: %w", err) } return yaml.MarshalYamlConfigs( &k.conversion.KubeletConfiguration, @@ -497,7 +496,7 @@ func (k *KubeadmRuntime) generateJoinMasterConfigs(masterIP string) ([]byte, err k.setJoinAdvertiseAddress(iputils.GetHostIP(masterIP)) k.setAPIServerEndpoint(fmt.Sprintf("%s:%d", k.getMaster0IP(), k.getAPIServerPort())) if err := k.convertKubeadmVersion(); err != nil { - return nil, errors.Wrap(err, "convert kubeadm version failed") + return nil, fmt.Errorf("convert kubeadm version failed: %w", err) } return yaml.MarshalYamlConfigs(k.conversion.JoinConfiguration, k.conversion.KubeletConfiguration) } diff --git a/pkg/runtime/master.go b/pkg/runtime/master.go index d90f372585a..db68b6350a7 100644 --- a/pkg/runtime/master.go +++ b/pkg/runtime/master.go @@ -26,7 +26,6 @@ import ( "github.com/labring/sealos/pkg/utils/logger" "github.com/labring/sealos/pkg/utils/strings" - "github.com/pkg/errors" "golang.org/x/sync/errgroup" ) @@ -98,7 +97,7 @@ func (k *KubeadmRuntime) joinMasters(masters []string) error { logger.Info("start to init filesystem join masters...") var err error if err = ssh.WaitSSHReady(k.getSSHInterface(), 6, masters...); err != nil { - return errors.Wrap(err, "join masters wait for ssh ready time out") + return fmt.Errorf("join masters wait for ssh ready time out: %w", err) } if err = k.CopyStaticFiles(masters); err != nil { diff --git a/pkg/runtime/node.go b/pkg/runtime/node.go index 6744e6e5da4..e276eadd363 100644 --- a/pkg/runtime/node.go +++ b/pkg/runtime/node.go @@ -24,14 +24,13 @@ import ( "github.com/labring/sealos/pkg/utils/file" "github.com/labring/sealos/pkg/utils/logger" - "github.com/pkg/errors" "golang.org/x/sync/errgroup" ) func (k *KubeadmRuntime) joinNodes(newNodesIPList []string) error { var err error if err = ssh.WaitSSHReady(k.getSSHInterface(), 6, newNodesIPList...); err != nil { - return errors.Wrap(err, "join nodes wait for ssh ready time out") + return fmt.Errorf("join nodes wait for ssh ready time out: %w", err) } masters := k.getMasterIPListAndHTTPSPort() diff --git a/pkg/runtime/token.go b/pkg/runtime/token.go index 19811d5f71a..bc63584fbd9 100644 --- a/pkg/runtime/token.go +++ b/pkg/runtime/token.go @@ -22,23 +22,21 @@ import ( "crypto/x509" "encoding/hex" "encoding/json" + "errors" "fmt" "strings" "time" - "github.com/labring/sealos/pkg/utils/exec" - "github.com/labring/sealos/pkg/utils/file" - "github.com/labring/sealos/pkg/utils/yaml" - - "github.com/pkg/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/sets" "k8s.io/client-go/tools/clientcmd" clientcmdapi "k8s.io/client-go/tools/clientcmd/api" "k8s.io/client-go/util/cert" - v1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/bootstraptoken/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/util/sets" + "github.com/labring/sealos/pkg/utils/exec" + "github.com/labring/sealos/pkg/utils/file" + "github.com/labring/sealos/pkg/utils/yaml" ) type Token struct { @@ -142,12 +140,12 @@ func discoveryTokenCaCertHash(adminPath string) ([]string, error) { if clusterConfig.CertificateAuthorityData != nil { caCerts, err = cert.ParseCertsPEM(clusterConfig.CertificateAuthorityData) if err != nil { - return nil, errors.Wrap(err, "failed to parse CA certificate from kubeconfig") + return nil, fmt.Errorf("failed to parse CA certificate from kubeconfig: %w", err) } } else if clusterConfig.CertificateAuthority != "" { caCerts, err = cert.CertsFromFile(clusterConfig.CertificateAuthority) if err != nil { - return nil, errors.Wrap(err, "failed to load CA certificate referenced by kubeconfig") + return nil, fmt.Errorf("failed to load CA certificate referenced by kubeconfig: %w", err) } } else { return nil, errors.New("no CA certificates found in kubeconfig") diff --git a/pkg/runtime/update_cert.go b/pkg/runtime/update_cert.go index 4ff2c84e737..33fa79ad115 100644 --- a/pkg/runtime/update_cert.go +++ b/pkg/runtime/update_cert.go @@ -16,19 +16,17 @@ package runtime import ( "context" + "errors" "fmt" "path" "golang.org/x/sync/errgroup" - "k8s.io/apimachinery/pkg/util/json" - - "github.com/labring/sealos/pkg/utils/file" - - "github.com/pkg/errors" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/util/json" "github.com/labring/sealos/pkg/client-go/kubernetes" "github.com/labring/sealos/pkg/constants" + "github.com/labring/sealos/pkg/utils/file" "github.com/labring/sealos/pkg/utils/logger" "github.com/labring/sealos/pkg/utils/yaml" ) @@ -118,7 +116,7 @@ func (k *KubeadmRuntime) UpdateCertByInit() error { return err } if err := k.CreateKubeConfig(); err != nil { - return errors.Wrap(err, "failed to generate kubernetes conf") + return fmt.Errorf("failed to generate kubernetes conf: %w", err) } return k.SendJoinMasterKubeConfigs(k.getMasterIPAndPortList()[:1], AdminConf, ControllerConf, SchedulerConf, KubeletConf) } diff --git a/pkg/utils/controller/retry_create_or_update.go b/pkg/utils/controller/retry_create_or_update.go index 8a73b282789..be39b382b89 100644 --- a/pkg/utils/controller/retry_create_or_update.go +++ b/pkg/utils/controller/retry_create_or_update.go @@ -32,7 +32,7 @@ func mutate(f MutateFn, key client.ObjectKey, obj client.Object) error { return err } if newKey := client.ObjectKeyFromObject(obj); key != newKey { - return fmt.Errorf("MutateFn cannot mutate object name and/or object namespace") + return fmt.Errorf("mutateFn cannot mutate object name and/or object namespace") } return nil } diff --git a/pkg/utils/file/file_v2.go b/pkg/utils/file/file_v2.go index e98d92c843d..e599ac7eaf8 100644 --- a/pkg/utils/file/file_v2.go +++ b/pkg/utils/file/file_v2.go @@ -16,6 +16,7 @@ package file import ( "bufio" + "errors" "fmt" "io" "os" @@ -23,8 +24,6 @@ import ( "strings" "github.com/labring/sealos/pkg/utils/logger" - - "github.com/pkg/errors" ) // Filename returns the file name after the last "/". diff --git a/pkg/utils/http/http.go b/pkg/utils/http/http.go index c4be4885f80..791c6ed8b58 100644 --- a/pkg/utils/http/http.go +++ b/pkg/utils/http/http.go @@ -17,12 +17,12 @@ limitations under the License. package http import ( + "fmt" http2 "net/http" "net/url" "time" "github.com/labring/endpoints-operator/library/probe/http" - "github.com/pkg/errors" ) func Request(address string, header map[string]string) (string, error) { @@ -37,5 +37,5 @@ func Request(address string, header map[string]string) (string, error) { _, data, err := prob.Probe(url, head, timeout) return data, err } - return "", errors.Wrap(err, "convert url error") + return "", fmt.Errorf("convert url error: %w", err) } diff --git a/pkg/utils/images/images.go b/pkg/utils/images/images.go index 68af3308b9b..413eb505135 100644 --- a/pkg/utils/images/images.go +++ b/pkg/utils/images/images.go @@ -21,7 +21,6 @@ import ( "strings" "github.com/containers/image/v5/docker/reference" - "github.com/pkg/errors" "github.com/labring/sealos/pkg/types/v1beta1" "github.com/labring/sealos/pkg/utils/file" @@ -35,12 +34,12 @@ func LoadImages(imageDir string) ([]string, error) { paths, err := file.GetFiles(imageDir) logger.Info("get files path is %v", paths) if err != nil { - return nil, errors.Wrap(err, "load image list files error") + return nil, fmt.Errorf("load image list files error: %w", err) } for _, p := range paths { images, err := file.ReadLines(p) if err != nil { - return nil, errors.Wrap(err, "load image list error") + return nil, fmt.Errorf("load image list error: %w", err) } imageList = append(imageList, images...) } @@ -64,12 +63,12 @@ func NormalizeName(name string) (reference.Named, error) { // NOTE: this code is in symmetrie with containers/image/pkg/shortnames. ref, err := reference.Parse(name) if err != nil { - return nil, errors.Wrapf(err, "error normalizing name %q", name) + return nil, fmt.Errorf("error normalizing name %q: %w", name, err) } named, ok := ref.(reference.Named) if !ok { - return nil, errors.Errorf("%q is not a named reference", name) + return nil, fmt.Errorf("%q is not a named reference", name) } // Enforce "localhost" if needed. diff --git a/pkg/utils/json/json.go b/pkg/utils/json/json.go deleted file mode 100644 index ef3fbfe9084..00000000000 --- a/pkg/utils/json/json.go +++ /dev/null @@ -1,46 +0,0 @@ -/* -Copyright 2022 cuisongliu@qq.com. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package json - -import ( - "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) { - metadata, err := file.ReadAll(path) - if err != nil { - return nil, err - } - var data map[string]interface{} - err = json.Unmarshal(metadata, &data) - if err != nil { - return nil, err - } - return data, nil -} - -func Convert(from interface{}, to interface{}) error { - var data []byte - var err error - if data, err = json.Marshal(from); err != nil { - return errors.WithStack(err) - } - return errors.WithStack(json.Unmarshal(data, to)) -} diff --git a/pkg/utils/net/net.go b/pkg/utils/net/net.go index 21922fb84e1..a6e3efe5d70 100644 --- a/pkg/utils/net/net.go +++ b/pkg/utils/net/net.go @@ -41,11 +41,11 @@ func WaitForServer(socket string, timeout time.Duration, opts ...interface{}) er dialOpts = append(dialOpts, o...) case **grpc.ClientConn: if connp != nil { - return fmt.Errorf("WaitForServer: multiple net.Conn pointer options given") + return fmt.Errorf("waitForServer: multiple net.Conn pointer options given") } connp = o default: - return fmt.Errorf("WaitForServer: invalid option of type %T", o) + return fmt.Errorf("waitForServer: invalid option of type %T", o) } } diff --git a/staging/src/github.com/labring/image-cri-shim/go.mod b/staging/src/github.com/labring/image-cri-shim/go.mod index ca01ddaad47..2ca4298a9fd 100644 --- a/staging/src/github.com/labring/image-cri-shim/go.mod +++ b/staging/src/github.com/labring/image-cri-shim/go.mod @@ -3,12 +3,13 @@ module github.com/labring/image-cri-shim go 1.20 require ( + github.com/labring/sealos v0.0.0 github.com/pelletier/go-toml v1.9.5 - github.com/pkg/errors v0.9.1 google.golang.org/grpc v1.50.1 k8s.io/apimachinery v0.25.6 k8s.io/cri-api v0.25.6 k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed + sigs.k8s.io/yaml v1.3.0 ) require ( @@ -48,9 +49,4 @@ require ( sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect ) -require ( - github.com/labring/sealos v0.0.0-00010101000000-000000000000 - sigs.k8s.io/yaml v1.3.0 -) - replace github.com/labring/sealos => ../../../../../ diff --git a/staging/src/github.com/labring/image-cri-shim/pkg/cri/cri.go b/staging/src/github.com/labring/image-cri-shim/pkg/cri/cri.go index c473235d8f3..7abacb20982 100644 --- a/staging/src/github.com/labring/image-cri-shim/pkg/cri/cri.go +++ b/staging/src/github.com/labring/image-cri-shim/pkg/cri/cri.go @@ -17,19 +17,18 @@ limitations under the License. package cri import ( + "fmt" "os" "path/filepath" goruntime "runtime" "strings" - "github.com/labring/sealos/pkg/utils/logger" - - "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" + "github.com/labring/sealos/pkg/utils/logger" ) // defaultKnownCRISockets holds the set of known CRI endpoints @@ -89,7 +88,7 @@ func NewContainerRuntime(execer utilsexec.Interface, criSocket string, config st } if _, err := execer.LookPath(toolName); err != nil { - return nil, errors.Wrapf(err, "%s is required for container runtime", toolName) + return nil, fmt.Errorf("%s is required for container runtime: %w", toolName, err) } return runtime, nil @@ -109,7 +108,7 @@ func (runtime *DockerRuntime) IsDocker() bool { func (runtime *ContainerdRuntime) IsRunning() error { // nosemgrep: trailofbits.go.invalid-usage-of-modified-variable.invalid-usage-of-modified-variable if out, err := runtime.exec.Command("crictl", "-r", runtime.criSocket, "info").CombinedOutput(); err != nil { - return errors.Wrapf(err, "container runtime is not running: output: %s, error", string(out)) + return fmt.Errorf("container runtime is not running: output: %s, error: %w", string(out), err) } return nil } @@ -118,7 +117,7 @@ func (runtime *ContainerdRuntime) IsRunning() error { func (runtime *DockerRuntime) IsRunning() error { // nosemgrep: trailofbits.go.invalid-usage-of-modified-variable.invalid-usage-of-modified-variable if out, err := runtime.exec.Command("docker", "info").CombinedOutput(); err != nil { - return errors.Wrapf(err, "container runtime is not running: output: %s, error", string(out)) + return fmt.Errorf("container runtime is not running: output: %s, error: %w", string(out), err) } return nil } @@ -131,7 +130,7 @@ func (runtime *DockerRuntime) CGroupDriver() (string, error) { var out []byte // nosemgrep: trailofbits.go.invalid-usage-of-modified-variable.invalid-usage-of-modified-variable if out, err = runtime.exec.Command("docker", "info", "--format", "{{.CgroupDriver}}").CombinedOutput(); err != nil { - return "", errors.Wrapf(err, "container runtime is not running: output: %s, error", string(out)) + return "", fmt.Errorf("container runtime is not running: output: %s, error: %w", string(out), err) } return string(out), nil } @@ -200,7 +199,7 @@ func (runtime *ContainerdRuntime) ListKubeContainers() ([]string, error) { // nosemgrep: trailofbits.go.invalid-usage-of-modified-variable.invalid-usage-of-modified-variable out, err := runtime.exec.Command("crictl", "-r", runtime.criSocket, "pods", "-q").CombinedOutput() if err != nil { - return nil, errors.Wrapf(err, "output: %s, error", string(out)) + return nil, fmt.Errorf("output: %s, error: %w", string(out), err) } pods := []string{} pods = append(pods, strings.Fields(string(out))...) @@ -221,12 +220,12 @@ func (runtime *ContainerdRuntime) RemoveContainers(containers []string) error { out, err := runtime.exec.Command("crictl", "-r", runtime.criSocket, "stopp", container).CombinedOutput() if err != nil { // don't stop on errors, try to remove as many containers as possible - errs = append(errs, errors.Wrapf(err, "failed to stop running pod %s: output: %s, error", container, string(out))) + errs = append(errs, fmt.Errorf("failed to stop running pod %s: output: %s, error: %w", container, string(out), err)) } else { // nosemgrep: trailofbits.go.invalid-usage-of-modified-variable.invalid-usage-of-modified-variable out, err = runtime.exec.Command("crictl", "-r", runtime.criSocket, "rmp", container).CombinedOutput() if err != nil { - errs = append(errs, errors.Wrapf(err, "failed to remove running container %s: output: %s, error", container, string(out))) + errs = append(errs, fmt.Errorf("failed to remove running container %s: output: %s, error: %w", container, string(out), err)) } } } @@ -241,12 +240,12 @@ func (runtime *DockerRuntime) RemoveContainers(containers []string) error { out, err := runtime.exec.Command("docker", "stop", container).CombinedOutput() if err != nil { // don't stop on errors, try to remove as many containers as possible - errs = append(errs, errors.Wrapf(err, "failed to stop running container %s: output: %s, error", container, string(out))) + errs = append(errs, fmt.Errorf("failed to stop running container %s: output: %s, error", container, string(out)), err) } else { // nosemgrep: trailofbits.go.invalid-usage-of-modified-variable.invalid-usage-of-modified-variable out, err = runtime.exec.Command("docker", "rm", "--volumes", container).CombinedOutput() if err != nil { - errs = append(errs, errors.Wrapf(err, "failed to remove running container %s: output: %s, error", container, string(out))) + errs = append(errs, fmt.Errorf("failed to remove running container %s: output: %s, error", container, string(out)), err) } } } @@ -263,7 +262,7 @@ func (runtime *ContainerdRuntime) PullImage(image string) error { return nil } } - return errors.Wrapf(err, "output: %s, error", out) + return fmt.Errorf("output: %s, error: %w", out, err) } // PullImage pulls the image @@ -276,7 +275,7 @@ func (runtime *DockerRuntime) PullImage(image string) error { return nil } } - return errors.Wrapf(err, "output: %s, error", out) + return fmt.Errorf("output: %s, error: %w", out, err) } // ImageExists checks to see if the image exists on the system @@ -310,7 +309,7 @@ func detectCRISocketImpl(isSocket func(string) bool, knownCRISockets []string) ( return foundCRISockets[0], nil default: // Multiple CRIs installed? - return "", errors.Errorf("Found multiple CRI sockets, please use --cri-socket to select one: %s", strings.Join(foundCRISockets, ", ")) + return "", fmt.Errorf("found multiple CRI sockets, please use --cri-socket to select one: %s", strings.Join(foundCRISockets, ", ")) } } diff --git a/staging/src/github.com/labring/image-cri-shim/pkg/types/config.go b/staging/src/github.com/labring/image-cri-shim/pkg/types/config.go index fd2515901e4..c6fdd8e4144 100644 --- a/staging/src/github.com/labring/image-cri-shim/pkg/types/config.go +++ b/staging/src/github.com/labring/image-cri-shim/pkg/types/config.go @@ -17,12 +17,12 @@ limitations under the License. package types import ( + "errors" "net/url" "strings" "time" "github.com/labring/image-cri-shim/pkg/cri" - "github.com/pkg/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "sigs.k8s.io/yaml" diff --git a/staging/src/github.com/labring/lvscare/go.mod b/staging/src/github.com/labring/lvscare/go.mod index 3152f9804b1..7672287b232 100644 --- a/staging/src/github.com/labring/lvscare/go.mod +++ b/staging/src/github.com/labring/lvscare/go.mod @@ -3,6 +3,7 @@ module github.com/labring/lvscare go 1.20 require ( + github.com/labring/sealos v0.0.0 github.com/spf13/cobra v1.6.1 github.com/spf13/pflag v1.0.5 github.com/vishvananda/netlink v1.1.1-0.20210330154013-f5de75959ad5 @@ -76,7 +77,6 @@ require ( github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/opencontainers/runc v1.1.4 // indirect github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417 // indirect - github.com/pkg/errors v0.9.1 // indirect github.com/prometheus/client_golang v1.14.0 // indirect github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.37.0 // indirect @@ -109,6 +109,4 @@ require ( sigs.k8s.io/yaml v1.3.0 // indirect ) -require github.com/labring/sealos v0.0.0-00010101000000-000000000000 - replace github.com/labring/sealos => ../../../../../ diff --git a/test/testdata/api/kubernetes.go b/test/testdata/api/kubernetes.go index c9c8069aad2..5c7877b96d4 100644 --- a/test/testdata/api/kubernetes.go +++ b/test/testdata/api/kubernetes.go @@ -17,13 +17,13 @@ package api import ( "bytes" "context" + "errors" "fmt" "os" "os/exec" "path/filepath" "time" - "github.com/pkg/errors" "k8s.io/apimachinery/pkg/runtime" "gopkg.in/yaml.v3"