ShortURL: Graduate api v1alpha1 to v1beta1 (#113597)

This commit is contained in:
Ezequiel Victorero
2025-11-10 07:29:33 -03:00
committed by GitHub
parent 834ff1be3c
commit cd91f858e6
34 changed files with 158 additions and 213 deletions
+3 -3
View File
@@ -16,7 +16,7 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/dynamic"
"github.com/grafana/grafana/apps/shorturl/pkg/apis/shorturl/v1alpha1"
"github.com/grafana/grafana/apps/shorturl/pkg/apis/shorturl/v1beta1"
"github.com/grafana/grafana/pkg/apimachinery/identity"
"github.com/grafana/grafana/pkg/infra/db"
"github.com/grafana/grafana/pkg/infra/log"
@@ -325,7 +325,7 @@ func (srv *CleanUpService) deleteStaleKubernetesShortURLs(ctx context.Context) {
}
// Set up the GroupVersionResource for shortURLs
gvr := v1alpha1.ShortURLKind().GroupVersionResource()
gvr := v1beta1.ShortURLKind().GroupVersionResource()
// Calculate the expiration time
expirationTime := time.Now().Add(-time.Duration(srv.Cfg.ShortLinkExpiration*24) * time.Hour)
@@ -350,7 +350,7 @@ func (srv *CleanUpService) deleteStaleKubernetesShortURLs(ctx context.Context) {
// Check each shortURL for expiration
for _, item := range shortURLs.Items {
// Convert unstructured object to ShortURL struct
var shortURL v1alpha1.ShortURL
var shortURL v1beta1.ShortURL
err := runtime.DefaultUnstructuredConverter.FromUnstructured(item.Object, &shortURL)
if err != nil {
logger.Error("Failed to convert unstructured object to ShortURL", "name", item.GetName(), "namespace", item.GetNamespace(), "error", err.Error())