Skip to content

Commit 48d9a7b

Browse files
authored
Merge pull request #2647 from fxierh/fix-client-comments
📖 Fix Client Read/Write Functionality Comments
2 parents 7679253 + f29ed4e commit 48d9a7b

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

pkg/client/client.go

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,18 @@ type CacheOptions struct {
9090
type NewClientFunc func(config *rest.Config, options Options) (Client, error)
9191

9292
// New returns a new Client using the provided config and Options.
93-
// The returned client reads *and* writes directly from the server
94-
// (it doesn't use object caches). It understands how to work with
95-
// normal types (both custom resources and aggregated/built-in resources),
96-
// as well as unstructured types.
9793
//
94+
// The client's read behavior is determined by Options.Cache.
95+
// If either Options.Cache or Options.Cache.Reader is nil,
96+
// the client reads directly from the API server.
97+
// If both Options.Cache and Options.Cache.Reader are non-nil,
98+
// the client reads from a local cache. However, specific
99+
// resources can still be configured to bypass the cache based
100+
// on Options.Cache.Unstructured and Options.Cache.DisableFor.
101+
// Write operations are always performed directly on the API server.
102+
//
103+
// The client understands how to work with normal types (both custom resources
104+
// and aggregated/built-in resources), as well as unstructured types.
98105
// In the case of normal types, the scheme will be used to look up the
99106
// corresponding group, version, and kind for the given type. In the
100107
// case of unstructured types, the group, version, and kind will be extracted
@@ -210,7 +217,8 @@ func newClient(config *rest.Config, options Options) (*client, error) {
210217

211218
var _ Client = &client{}
212219

213-
// client is a client.Client that reads and writes directly from/to an API server.
220+
// client is a client.Client configured to either read from a local cache or directly from the API server.
221+
// Write operations are always performed directly on the API server.
214222
// It lazily initializes new clients at the time they are used.
215223
type client struct {
216224
typedClient typedClient

0 commit comments

Comments
 (0)