K8s: use +enum tag in playlist and unstructured dummy (#82022)

This commit is contained in:
Ryan McKinley
2024-02-06 16:10:32 -08:00
committed by GitHub
parent 83ea51f241
commit 40a08a7720
10 changed files with 27 additions and 16 deletions
+3 -2
View File
@@ -2,6 +2,8 @@ package v0alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
common "github.com/grafana/grafana/pkg/apis/common/v0alpha1"
)
// Mirrors the info exposed in "github.com/grafana/grafana/pkg/setting"
@@ -26,13 +28,12 @@ type DummyResource struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec string `json:"spec,omitempty"`
Spec common.Unstructured `json:"spec,omitempty"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type DummyResourceList struct {
metav1.TypeMeta `json:",inline"`
// +optional
metav1.ListMeta `json:"metadata,omitempty"`
Items []DummyResource `json:"items,omitempty"`
@@ -16,6 +16,7 @@ func (in *DummyResource) DeepCopyInto(out *DummyResource) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
return
}
@@ -51,15 +51,14 @@ func schema_pkg_apis_example_v0alpha1_DummyResource(ref common.ReferenceCallback
},
"spec": {
SchemaProps: spec.SchemaProps{
Type: []string{"string"},
Format: "",
Ref: ref("github.com/grafana/grafana/pkg/apis/common/v0alpha1.Unstructured"),
},
},
},
},
},
Dependencies: []string{
"k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
"github.com/grafana/grafana/pkg/apis/common/v0alpha1.Unstructured", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
}
}