Chore: Use Kind().GroupVersionResource() (#113133)

This commit is contained in:
Ryan McKinley
2025-10-28 14:54:10 -07:00
committed by GitHub
parent 329d6a11fa
commit d72e048bfe
11 changed files with 27 additions and 102 deletions
+1 -5
View File
@@ -10,7 +10,6 @@ import (
"k8s.io/apimachinery/pkg/apis/meta/internalversion"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apiserver/pkg/registry/rest"
playlist "github.com/grafana/grafana/apps/playlist/pkg/apis/playlist/v0alpha1"
@@ -87,10 +86,7 @@ func (s *legacyStorage) Get(ctx context.Context, name string, options *metav1.Ge
})
if err != nil || dto == nil {
if errors.Is(err, playlistsvc.ErrPlaylistNotFound) || err == nil {
err = k8serrors.NewNotFound(schema.GroupResource{
Group: playlist.PlaylistKind().Group(),
Resource: playlist.PlaylistKind().Plural(),
}, name)
err = k8serrors.NewNotFound(playlist.PlaylistKind().GroupVersionResource().GroupResource(), name)
}
return nil, err
}
+1 -5
View File
@@ -65,11 +65,7 @@ func RegisterAppInstaller(
// GetLegacyStorage returns the legacy storage for the playlist app.
func (p *PlaylistAppInstaller) GetLegacyStorage(requested schema.GroupVersionResource) grafanarest.Storage {
gvr := schema.GroupVersionResource{
Group: playlistv0alpha1.PlaylistKind().Group(),
Version: playlistv0alpha1.PlaylistKind().Version(),
Resource: playlistv0alpha1.PlaylistKind().Plural(),
}
gvr := playlistv0alpha1.PlaylistKind().GroupVersionResource()
if requested.String() != gvr.String() {
return nil
}