Skip to content

Commit

Permalink
Merge pull request #1789 from rzetelskik/override-resource-helpers-sc…
Browse files Browse the repository at this point in the history
…heme

Make resource helpers scheme configurable through exported variable
  • Loading branch information
scylla-operator-bot[bot] authored Mar 4, 2024
2 parents 0308d14 + b4bec43 commit 596b9c8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 29 deletions.
6 changes: 4 additions & 2 deletions pkg/resource/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
"k8s.io/apimachinery/pkg/runtime/schema"
)

var Scheme = scheme.Scheme

func newUnknownGVK() *schema.GroupVersionKind {
return &schema.GroupVersionKind{
Group: "unknown",
Expand All @@ -23,7 +25,7 @@ func GetObjectGVK(object runtime.Object) (*schema.GroupVersionKind, error) {
return &gvk, nil
}

kinds, _, err := scheme.Scheme.ObjectKinds(object)
kinds, _, err := Scheme.ObjectKinds(object)
if err != nil {
return nil, err
}
Expand All @@ -40,7 +42,7 @@ func GetObjectGVKOrUnknown(obj runtime.Object) *schema.GroupVersionKind {
return &gvk
}

kinds, _, err := scheme.Scheme.ObjectKinds(obj)
kinds, _, err := Scheme.ObjectKinds(obj)
if err != nil || len(kinds) == 0 {
t := reflect.TypeOf(obj)
if t.Kind() == reflect.Ptr {
Expand Down
27 changes: 0 additions & 27 deletions pkg/util/resource/helpers.go

This file was deleted.

0 comments on commit 596b9c8

Please sign in to comment.