From 3fa7fb07d3d1d33c36af18e4b9aef7422d451b8b Mon Sep 17 00:00:00 2001 From: mgianluc Date: Sun, 1 Dec 2024 12:09:45 +0100 Subject: [PATCH] (chore) fix imported utils package --- go.mod | 2 +- go.sum | 4 ++-- internal/commands/show/admin_rbacs.go | 8 ++++---- internal/commands/show/resources.go | 7 +++---- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/go.mod b/go.mod index d08ef5b..d0a7c73 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( github.com/pkg/errors v0.9.1 github.com/projectsveltos/addon-controller v0.42.2-0.20241201084653-9a781f268755 github.com/projectsveltos/event-manager v0.42.2-0.20241201093428-dfa4dee4f53f - github.com/projectsveltos/libsveltos v0.42.1 + github.com/projectsveltos/libsveltos v0.42.2-0.20241201085419-c94a994b898c github.com/robfig/cron/v3 v3.0.1 gopkg.in/yaml.v3 v3.0.1 k8s.io/api v0.31.3 diff --git a/go.sum b/go.sum index 6f434a2..fd46d35 100644 --- a/go.sum +++ b/go.sum @@ -106,8 +106,8 @@ github.com/projectsveltos/addon-controller v0.42.2-0.20241201084653-9a781f268755 github.com/projectsveltos/addon-controller v0.42.2-0.20241201084653-9a781f268755/go.mod h1:ZQbV1ZNWwNGXA7c54rMczp7hNsrcFI2MJOTeWElLZw4= github.com/projectsveltos/event-manager v0.42.2-0.20241201093428-dfa4dee4f53f h1:eD2eXfCAdGy+ruK2G6TcEkld78MWTdvsWjC8qERO6go= github.com/projectsveltos/event-manager v0.42.2-0.20241201093428-dfa4dee4f53f/go.mod h1:WQl9cgnNGzdwYfkuojxEpdva0OZ24Jf9STU7/p8sRsA= -github.com/projectsveltos/libsveltos v0.42.1 h1:B7c8cF+vhR5AZJT8D4h19PSJfZqWUCR3CKEDUf032JI= -github.com/projectsveltos/libsveltos v0.42.1/go.mod h1:XPev2TKsMxVG5LwhbbMkcCs/U0730ZMmOXIvu2HEtWo= +github.com/projectsveltos/libsveltos v0.42.2-0.20241201085419-c94a994b898c h1:x/Kg8+bSipfGhw9jpRVd05laNgRnHJofwd1qdiCqVwU= +github.com/projectsveltos/libsveltos v0.42.2-0.20241201085419-c94a994b898c/go.mod h1:4hqQRjwZ/DZ6u0haL3zhdARZ3lpspLv57rkhpXIzbsg= github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= diff --git a/internal/commands/show/admin_rbacs.go b/internal/commands/show/admin_rbacs.go index 461cd50..f788529 100644 --- a/internal/commands/show/admin_rbacs.go +++ b/internal/commands/show/admin_rbacs.go @@ -33,8 +33,8 @@ import ( "k8s.io/apimachinery/pkg/types" libsveltosv1beta1 "github.com/projectsveltos/libsveltos/api/v1beta1" + libsveltosutils "github.com/projectsveltos/libsveltos/lib/k8s_utils" logs "github.com/projectsveltos/libsveltos/lib/logsettings" - libsveltosutils "github.com/projectsveltos/libsveltos/lib/utils" "github.com/projectsveltos/sveltosctl/internal/utils" ) @@ -62,7 +62,7 @@ func displayAdminRbacs(ctx context.Context, logger logr.Logger) error { // Collect all RoleRequest - instance := utils.GetAccessInstance() + instance := k8s_utils.GetAccessInstance() logger.V(logs.LogDebug).Info("collect all rolerequests") roleRequests, err := instance.ListRoleRequests(ctx, logger) @@ -270,7 +270,7 @@ func collectResourceContent(ctx context.Context, resource libsveltosv1beta1.Poli logger = logger.WithValues("kind", resource.Kind, "resource", fmt.Sprintf("%s/%s", resource.Namespace, resource.Name)) logger.V(logs.LogDebug).Info("collect resource") - instance := utils.GetAccessInstance() + instance := k8s_utils.GetAccessInstance() if resource.Kind == string(libsveltosv1beta1.ConfigMapReferencedResourceKind) { configMap := &corev1.ConfigMap{} err := instance.GetResource(ctx, @@ -305,7 +305,7 @@ func collectContent(data map[string]string, logger logr.Logger) ([]*unstructured continue } - policy, err := libsveltosutils.GetUnstructured([]byte(elements[i])) + policy, err := k8s_utils.GetUnstructured([]byte(elements[i])) if err != nil { logger.Error(err, fmt.Sprintf("failed to get policy from Data %.100s", elements[i])) return nil, err diff --git a/internal/commands/show/resources.go b/internal/commands/show/resources.go index 3860756..d5ee7c3 100644 --- a/internal/commands/show/resources.go +++ b/internal/commands/show/resources.go @@ -30,9 +30,8 @@ import ( "gopkg.in/yaml.v3" libsveltosv1beta1 "github.com/projectsveltos/libsveltos/api/v1beta1" + "github.com/projectsveltos/libsveltos/lib/k8s_utils" logs "github.com/projectsveltos/libsveltos/lib/logsettings" - libsveltosutils "github.com/projectsveltos/libsveltos/lib/utils" - "github.com/projectsveltos/sveltosctl/internal/utils" ) var ( @@ -83,7 +82,7 @@ func displayResourcesInNamespaces(ctx context.Context, passedClusterNamespace, passedCluster, passedGroup, passedKind, passedNamespace string, full bool, table *tablewriter.Table, logger logr.Logger) error { - instance := utils.GetAccessInstance() + instance := k8s_utils.GetAccessInstance() healthCheckReports, err := instance.ListHealthCheckReports(ctx, passedClusterNamespace, logger) if err != nil { @@ -167,7 +166,7 @@ func printResource(resourceStatus *libsveltosv1beta1.ResourceStatus, return nil } - resource, err := libsveltosutils.GetUnstructured(resourceStatus.Resource) + resource, err := k8s_utils.GetUnstructured(resourceStatus.Resource) if err != nil { logger.V(logs.LogDebug).Info(fmt.Sprintf("failed to get resource %s:%s/%s", gvk, resourceNamespace, resourceName))