Revert [api] Fix representation of dynamic list kinds
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
This commit is contained in:
parent
9d1fb4ccf2
commit
0b27f634c0
2 changed files with 3 additions and 14 deletions
|
|
@ -21,21 +21,11 @@
|
|||
}
|
||||
|
||||
@test "Test kinds" {
|
||||
val=$(kubectl get --raw /apis/apps.cozystack.io/v1alpha1/tenants | jq -r '.kind')
|
||||
if [ "$val" != "TenantList" ]; then
|
||||
echo "Expected kind to be TenantList, got $val"
|
||||
exit 1
|
||||
fi
|
||||
val=$(kubectl get --raw /apis/apps.cozystack.io/v1alpha1/tenants | jq -r '.items[0].kind')
|
||||
if [ "$val" != "Tenant" ]; then
|
||||
echo "Expected kind to be Tenant, got $val"
|
||||
exit 1
|
||||
fi
|
||||
val=$(kubectl get --raw /apis/apps.cozystack.io/v1alpha1/ingresses | jq -r '.kind')
|
||||
if [ "$val" != "IngressList" ]; then
|
||||
echo "Expected kind to be IngressList, got $val"
|
||||
exit 1
|
||||
fi
|
||||
val=$(kubectl get --raw /apis/apps.cozystack.io/v1alpha1/ingresses | jq -r '.items[0].kind')
|
||||
if [ "$val" != "Ingress" ]; then
|
||||
echo "Expected kind to be Ingress, got $val"
|
||||
|
|
|
|||
|
|
@ -397,9 +397,9 @@ func (r *REST) List(ctx context.Context, options *metainternalversion.ListOption
|
|||
}
|
||||
|
||||
// Explicitly set apiVersion and kind in unstructured object
|
||||
appList := r.NewList().(*unstructured.Unstructured)
|
||||
appList := r.NewList().(*unstructured.UnstructuredList)
|
||||
appList.SetResourceVersion(hrList.GetResourceVersion())
|
||||
appList.Object["items"] = items
|
||||
appList.Items = items
|
||||
|
||||
klog.V(6).Infof("Successfully listed %d Application resources in namespace %s", len(items), namespace)
|
||||
return appList, nil
|
||||
|
|
@ -1244,9 +1244,8 @@ func (r *REST) New() runtime.Object {
|
|||
|
||||
// NewList returns an empty list of Application objects
|
||||
func (r *REST) NewList() runtime.Object {
|
||||
obj := &unstructured.Unstructured{}
|
||||
obj := &unstructured.UnstructuredList{}
|
||||
obj.SetGroupVersionKind(r.gvk.GroupVersion().WithKind(r.kindName + "List"))
|
||||
obj.Object["items"] = make([]interface{}, 0)
|
||||
return obj
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue