K8s: Add example api service (#75911)

This commit is contained in:
Ryan McKinley
2023-10-06 11:55:22 -07:00
committed by GitHub
parent 0a50ca7231
commit 717a9dd616
19 changed files with 702 additions and 11 deletions

View File

@@ -9,7 +9,6 @@ import (
"k8s.io/apiserver/pkg/registry/rest"
genericapiserver "k8s.io/apiserver/pkg/server"
common "k8s.io/kube-openapi/pkg/common"
"k8s.io/kube-openapi/pkg/spec3"
grafanaapiserver "github.com/grafana/grafana/pkg/services/grafana-apiserver"
grafanarest "github.com/grafana/grafana/pkg/services/grafana-apiserver/rest"
@@ -36,6 +35,10 @@ func RegisterAPIService(p playlist.Service, apiregistration grafanaapiserver.API
return builder
}
func (b *PlaylistAPIBuilder) GetGroupVersion() schema.GroupVersion {
return SchemeGroupVersion
}
func (b *PlaylistAPIBuilder) InstallSchema(scheme *runtime.Scheme) error {
err := AddToScheme(scheme)
if err != nil {
@@ -72,9 +75,8 @@ func (b *PlaylistAPIBuilder) GetOpenAPIDefinitions() common.GetOpenAPIDefinition
return getOpenAPIDefinitions
}
// Register additional routes with the server
func (b *PlaylistAPIBuilder) GetOpenAPIPostProcessor() func(*spec3.OpenAPI) (*spec3.OpenAPI, error) {
return nil
func (b *PlaylistAPIBuilder) GetAPIRoutes() *grafanaapiserver.APIRoutes {
return nil // no custom API routes
}
// SchemeGroupVersion is group version used to register these objects