K8s: Move shared apis to a common folder with shared openapi spec (#80484)

This commit is contained in:
Ryan McKinley
2024-01-12 12:05:30 -08:00
committed by GitHub
parent 81c45bfe44
commit bb05a6f58f
25 changed files with 2700 additions and 269 deletions

View File

@@ -6,12 +6,15 @@ import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
common "k8s.io/kube-openapi/pkg/common"
spec "k8s.io/kube-openapi/pkg/validation/spec"
"github.com/grafana/grafana/pkg/apis/common/v0alpha1"
)
// This should eventually live in grafana-app-sdk
func GetOpenAPIDefinitions(builders []APIGroupBuilder) common.GetOpenAPIDefinitions {
return func(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition {
defs := getStandardOpenAPIDefinitions(ref)
maps.Copy(defs, v0alpha1.GetOpenAPIDefinitions(ref)) // common grafana apis
for _, builder := range builders {
g := builder.GetOpenAPIDefinitions()
if g != nil {