unstructured.UnstructuredList caused lots of reflect.go trace

3/27/2020

I'm trying to use the unstructured.UnstructuredList to reuse come logic for configmap and secret.

However, after adding the ListAndDeployReferredObject, I started to see tons of trace as Starting reflector *unstructured.Unstructured was added to my log file.

Am I doing something odd or I'm missing some setting for using the unstructured.Unstructured?

Thanks in advance.

func (r *ReconcileSubscription) ListAndDeployReferredObject(instance *appv1alpha1.Subscription, gvk schema.GroupVersionKind, refObj referredObject) error {
    insName := instance.GetName()
    insNs := instance.GetNamespace()
    uObjList := &unstructured.UnstructuredList{}

    uObjList.SetGroupVersionKind(gvk)

    opts := &client.ListOptions{Namespace: insNs}
    err := r.Client.List(context.TODO(), uObjList, opts)

    if err != nil && !errors.IsNotFound(err) {
        klog.Errorf("Failed to list referred objects with error %v ", err)
        return err
    }
    // other logics... 
}
I0326 23:05:58.955589   95169 reflector.go:120] Starting reflector *unstructured.Unstructured (10m0s) from pkg/mod/k8s.io/client-go@v0.0.0-20191016111102-bec269661e48/tools/cache/reflector.go:96
...
I0326 23:15:18.718932   95169 reflector.go:158] Listing and watching *unstructured.Unstructured from pkg/mod/k8s.io/client-go@v0.0.0-20191016111102-bec269661e48/tools/cache/reflector.go:96
-- Ian Zhang
client-go
go
kubernetes

1 Answer

4/1/2020

I figured out these prints are normal, since we are using the dynamic client on our controller for caches

-- Ian Zhang
Source: StackOverflow