Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( DefaultNewCacheFn NewCacheFn = cache.New DefaultNewClientFn NewClientFn = client.New )
The default new cache and new controller functions.
Functions ¶
func Anonymize ¶
Anonymize the supplied config by returning a copy with all authentication details and credentials removed.
func RESTMapper ¶
func RESTMapper(cfg *rest.Config) (meta.RESTMapper, error)
RESTMapper returns a 'REST mapper' that discovers an API server's available REST API endpoints. The returned REST mapper is intended to be shared by many clients. It is 'dynamic' in that it will attempt to rediscover API endpoints any time a client asks for a kind of resource that is unknown to it. Each discovery process may burst up to 100 API server requests per second, and average 20 requests per second. Rediscovery may not happen more frequently than once every 20 seconds.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
A Cache of Kubernetes clients. Each client is associated with a particular bearer token, which is used to authenticate to an API server. Each client is backed by its own cache, which is populated by automatically watching any type the client is asked to get or list. Clients (and their caches) expire and are garbage collected if they are unused for five minutes.
type CacheOption ¶
type CacheOption func(c *Cache)
A CacheOption configures the client cache.
func DoNotCache ¶
func DoNotCache(o []client.Object) CacheOption
DoNotCache configures clients not to cache objects of the supplied types. Note that the cache machinery extracts a GVK from these objects, so they can either be types known to the scheme or *unstructured.Unstructured with their APIVersion and Kind set.
func WithExpiry ¶
func WithExpiry(d time.Duration) CacheOption
WithExpiry configures the duration until each client expires. Each time any of a client's methods are called the expiry time is reset to this value. When a client expires its cache will be garbage collected.
func WithLogger ¶
func WithLogger(l logging.Logger) CacheOption
WithLogger configures the logger used by the client cache. A no-op logger is used by default.
func WithRESTMapper ¶
func WithRESTMapper(m meta.RESTMapper) CacheOption
WithRESTMapper configures the REST mapper used by cached clients. A mapper is created for each new client by default, which can take ~10 seconds.
type GetOption ¶
type GetOption func(o *getOptions)
A GetOption modifies the kind of client returned.
func ForNamespace ¶
ForNamespace returns a client backed by a cache scoped to the supplied namespace.
type NewCacheFn ¶
A NewCacheFn creates a new controller-runtime cache.