K8s: Add resource type helper to avoid so many hardcoded names (#79344)

This commit is contained in:
Ryan McKinley
2023-12-11 12:03:48 -08:00
committed by GitHub
parent 5147bdeb4b
commit f69516bf47
11 changed files with 190 additions and 71 deletions
+20
View File
@@ -2,6 +2,26 @@ package v0alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
"github.com/grafana/grafana/pkg/apis"
)
const (
GROUP = "example.grafana.app"
VERSION = "v0alpha1"
APIVERSION = GROUP + "/" + VERSION
)
var RuntimeResourceInfo = apis.NewResourceInfo(GROUP, VERSION,
"runtime", "runtime", "RuntimeInfo",
func() runtime.Object { return &RuntimeInfo{} },
func() runtime.Object { return &RuntimeInfo{} },
)
var DummyResourceInfo = apis.NewResourceInfo(GROUP, VERSION,
"dummy", "dummy", "DummyResource",
func() runtime.Object { return &DummyResource{} },
func() runtime.Object { return &DummyResourceList{} },
)
// Mirrors the info exposed in "github.com/grafana/grafana/pkg/setting"