-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
Hi, I have a case that I need to use client.Get()
immediately after running client.Status().Update()
.
The client.Get()
will get the object from cache, this is not what I want.
The implementation:
controller-runtime/pkg/client/split.go
Lines 45 to 52 in ab6131a
// Get retrieves an obj for a given object key from the Kubernetes Cluster. | |
func (d *DelegatingReader) Get(ctx context.Context, key ObjectKey, obj runtime.Object) error { | |
_, isUnstructured := obj.(*unstructured.Unstructured) | |
if isUnstructured { | |
return d.ClientReader.Get(ctx, key, obj) | |
} | |
return d.CacheReader.Get(ctx, key, obj) | |
} |
I don't want to use CacheReader
and I also can't use unstructured Object.
Is there a way to make sure client.Get()
to get the realtime result? Maybe wait for cache to sync? I don't know how.
My code is something like: https://github.com/operator-framework/operator-sdk/blob/d6903be02d4e8541e777b25af0498fe31e2e41e8/internal/pkg/scaffold/controller_kind.go#L213-L219
guettli and Jeffwan
Metadata
Metadata
Assignees
Labels
No labels