@@ -322,16 +322,8 @@ func (r *REST) List(ctx context.Context, options *metainternalversion.ListOption
322322 }
323323
324324 // Initialize empty Application list
325- appList := & appsv1alpha1.ApplicationList {
326- TypeMeta : metav1.TypeMeta {
327- APIVersion : "apps.cozystack.io/v1alpha1" ,
328- Kind : "ApplicationList" ,
329- },
330- ListMeta : metav1.ListMeta {
331- ResourceVersion : hrList .GetResourceVersion (),
332- },
333- Items : []appsv1alpha1.Application {},
334- }
325+
326+ items := make ([]appsv1alpha1.Application , 0 )
335327
336328 // Iterate over HelmReleases and convert to Applications
337329 for _ , hr := range hrList .Items {
@@ -379,11 +371,21 @@ func (r *REST) List(ctx context.Context, options *metainternalversion.ListOption
379371 }
380372 }
381373
382- appList .Items = append (appList .Items , app )
374+ items = append (items , app )
375+ }
376+
377+ // Explicitly set apiVersion and kind in unstructured object
378+ appList := map [string ]interface {}{
379+ "apiVersion" : "apps.cozystack.io/v1alpha1" ,
380+ "kind" : r .kindName + "List" ,
381+ "metadata" : metav1.ListMeta {
382+ ResourceVersion : hrList .GetResourceVersion (),
383+ },
384+ "items" : items ,
383385 }
384386
385- klog .V (6 ).Infof ("Successfully listed %d Application resources in namespace %s" , len (appList . Items ), namespace )
386- return appList , nil
387+ klog .V (6 ).Infof ("Successfully listed %d Application resources in namespace %s" , len (items ), namespace )
388+ return & unstructured. Unstructured { Object : appList } , nil
387389}
388390
389391// Update updates an existing Application by converting it to a HelmRelease
0 commit comments