Skip to content

Commit aba6768

Browse files
committed
chore: added integration test cases for GetChildObjects func
1 parent 6a67ff4 commit aba6768

2 files changed

Lines changed: 518 additions & 0 deletions

File tree

kubelink/pkg/service/commonHelmService/k8sService.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,20 @@ type ClusterConfig struct {
5151
type K8sService interface {
5252
CanHaveChild(gvk schema.GroupVersionKind) bool
5353
GetLiveManifest(restConfig *rest.Config, namespace string, gvk *schema.GroupVersionKind, name string) (*unstructured.Unstructured, *schema.GroupVersionResource, error)
54+
55+
// GetChildObjectsV1 is the old implementation for getting children resource manifests for a parent GVK.
56+
// It doesn't support paginated listing,
57+
// which can cause high memory consumption if the child GVK are present in a large number.
58+
// But as it fetches all the data in a single call, it saves up multiple round trips cost.
59+
// This is the deprecated way to get child resources.
60+
// Use GetChildObjectsV2 instead.
5461
GetChildObjectsV1(restConfig *rest.Config, namespace string, parentGvk schema.GroupVersionKind, parentName string, parentApiVersion string) ([]*unstructured.Unstructured, error)
62+
63+
// GetChildObjectsV2 is the new implementation for getting children resource manifests for a parent GVK.
64+
// It supports paginated listing,
65+
// which will optimize memory consumption if the child GVK are present in a large number.
66+
// But as it fetches all the data in multiple calls, it will cost multiple round trips.
67+
// This is the recommended way to get child resources.
5568
GetChildObjectsV2(restConfig *rest.Config, namespace string, parentGvk schema.GroupVersionKind, parentName string) ([]*unstructured.Unstructured, error)
5669
PatchResource(ctx context.Context, restConfig *rest.Config, r *bean.KubernetesResourcePatchRequest) error
5770
}

0 commit comments

Comments
 (0)