Skip to content

Commit

Permalink
use in-repo gitops-engine and kubectl modules
Browse files Browse the repository at this point in the history
Signed-off-by: Mmadu Manasseh <[email protected]>
  • Loading branch information
MeNsaaH committed Jan 13, 2025
1 parent d5e4dc6 commit 5886703
Show file tree
Hide file tree
Showing 17 changed files with 4,933 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/checks/diff/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ import (
"context"
"encoding/json"
"fmt"
"io"
"strings"
"time"

cmdutil "github.com/argoproj/argo-cd/v2/cmd/util"
"github.com/argoproj/argo-cd/v2/controller"
"github.com/argoproj/argo-cd/v2/pkg/apiclient/application"
Expand All @@ -15,21 +19,18 @@ import (
"github.com/argoproj/gitops-engine/pkg/diff"
"github.com/argoproj/gitops-engine/pkg/sync/hook"
"github.com/argoproj/gitops-engine/pkg/sync/ignore"
"github.com/argoproj/gitops-engine/pkg/utils/kube"
"github.com/argoproj/gitops-engine/pkg/utils/tracing"
"github.com/ghodss/yaml"
"github.com/go-logr/zerologr"
"github.com/pmezard/go-difflib/difflib"
"github.com/rs/zerolog/log"
"io"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/client-go/rest"
"k8s.io/klog/v2/textlogger"
"strings"
"time"

"github.com/zapier/kubechecks/pkg/checks"
"github.com/zapier/kubechecks/pkg/gitops-engine/pkg/utils/kube"
"github.com/zapier/kubechecks/pkg/msg"
"github.com/zapier/kubechecks/telemetry"
)
Expand Down
26 changes: 26 additions & 0 deletions pkg/gitops-engine/pkg/utils/kube/convert.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package kube

import (
"github.com/argoproj/gitops-engine/pkg/utils/kube/scheme"

"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
)

func convertToVersionWithScheme(obj *unstructured.Unstructured, group string, version string) (*unstructured.Unstructured, error) {
s := scheme.Scheme
object, err := s.ConvertToVersion(obj, runtime.InternalGroupVersioner)
if err != nil {
return nil, err
}
unmarshalledObj, err := s.ConvertToVersion(object, schema.GroupVersion{Group: group, Version: version})
if err != nil {
return nil, err
}
unstrBody, err := runtime.DefaultUnstructuredConverter.ToUnstructured(unmarshalledObj)
if err != nil {
return nil, err
}
return &unstructured.Unstructured{Object: unstrBody}, nil
}
Loading

0 comments on commit 5886703

Please sign in to comment.