K8s: Make v0alpha1 opt-in (#107056)

This commit is contained in:
Stephanie Hingtgen
2025-06-20 16:37:17 -05:00
committed by GitHub
parent 0e35c8bdb4
commit ef6e28b955
21 changed files with 117 additions and 541 deletions
@@ -29,6 +29,10 @@ type AppBuilderConfig struct {
OpenAPIDefGetter common.GetOpenAPIDefinitions
ManagedKinds map[schema.GroupVersion][]resource.Kind
CustomConfig any
// Do not set anything here unless you have special circumstances! This is a list of resources that are allowed to be accessed in v0alpha1,
// to prevent accidental exposure of experimental APIs. While developing, use the feature flag `grafanaAPIServerWithExperimentalAPIs`.
// And then, when you're ready to expose this to the end user, go to v1beta1 instead.
AllowedV0Alpha1Resources []string
groupVersion schema.GroupVersion
}
@@ -109,6 +113,11 @@ func (b *appBuilder) InstallSchema(scheme *runtime.Scheme) error {
return scheme.SetVersionPriority(gv)
}
// AllowedV0Alpha1Resources returns the list of resources that are allowed to be accessed in v0alpha1
func (b *appBuilder) AllowedV0Alpha1Resources() []string {
return b.config.AllowedV0Alpha1Resources
}
// UpdateAPIGroupInfo implements APIGroupBuilder.UpdateAPIGroupInfo
func (b *appBuilder) UpdateAPIGroupInfo(apiGroupInfo *genericapiserver.APIGroupInfo, opts builder.APIGroupOptions) error {
for _, kinds := range b.config.ManagedKinds {