-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use in-repo gitops-engine and kubectl modules
Signed-off-by: Mmadu Manasseh <[email protected]>
- Loading branch information
Showing
17 changed files
with
4,933 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
Oops, something went wrong.