Skip to content

Commit

Permalink
(chore) fix imported utils package
Browse files Browse the repository at this point in the history
  • Loading branch information
mgianluc committed Dec 1, 2024
1 parent 1ade3c3 commit 3fa7fb0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
8 changes: 4 additions & 4 deletions internal/commands/show/admin_rbacs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down
7 changes: 3 additions & 4 deletions internal/commands/show/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit 3fa7fb0

Please sign in to comment.