Skip to content

Commit 0b27f63

Browse files
committed
Revert [api] Fix representation of dynamic list kinds
Signed-off-by: Andrei Kvapil <[email protected]>
1 parent 9d1fb4c commit 0b27f63

2 files changed

Lines changed: 3 additions & 14 deletions

File tree

‎hack/e2e-test-openapi.bats‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,11 @@
2121
}
2222

2323
@test "Test kinds" {
24-
val=$(kubectl get --raw /apis/apps.cozystack.io/v1alpha1/tenants | jq -r '.kind')
25-
if [ "$val" != "TenantList" ]; then
26-
echo "Expected kind to be TenantList, got $val"
27-
exit 1
28-
fi
2924
val=$(kubectl get --raw /apis/apps.cozystack.io/v1alpha1/tenants | jq -r '.items[0].kind')
3025
if [ "$val" != "Tenant" ]; then
3126
echo "Expected kind to be Tenant, got $val"
3227
exit 1
3328
fi
34-
val=$(kubectl get --raw /apis/apps.cozystack.io/v1alpha1/ingresses | jq -r '.kind')
35-
if [ "$val" != "IngressList" ]; then
36-
echo "Expected kind to be IngressList, got $val"
37-
exit 1
38-
fi
3929
val=$(kubectl get --raw /apis/apps.cozystack.io/v1alpha1/ingresses | jq -r '.items[0].kind')
4030
if [ "$val" != "Ingress" ]; then
4131
echo "Expected kind to be Ingress, got $val"

‎pkg/registry/apps/application/rest.go‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -397,9 +397,9 @@ func (r *REST) List(ctx context.Context, options *metainternalversion.ListOption
397397
}
398398

399399
// Explicitly set apiVersion and kind in unstructured object
400-
appList := r.NewList().(*unstructured.Unstructured)
400+
appList := r.NewList().(*unstructured.UnstructuredList)
401401
appList.SetResourceVersion(hrList.GetResourceVersion())
402-
appList.Object["items"] = items
402+
appList.Items = items
403403

404404
klog.V(6).Infof("Successfully listed %d Application resources in namespace %s", len(items), namespace)
405405
return appList, nil
@@ -1244,9 +1244,8 @@ func (r *REST) New() runtime.Object {
12441244

12451245
// NewList returns an empty list of Application objects
12461246
func (r *REST) NewList() runtime.Object {
1247-
obj := &unstructured.Unstructured{}
1247+
obj := &unstructured.UnstructuredList{}
12481248
obj.SetGroupVersionKind(r.gvk.GroupVersion().WithKind(r.kindName + "List"))
1249-
obj.Object["items"] = make([]interface{}, 0)
12501249
return obj
12511250
}
12521251

0 commit comments

Comments
 (0)