Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CachedDiscoveryClient

type CachedDiscoveryClient struct {
	// contains filtered or unexported fields
}

CachedDiscoveryClient implements the functions that discovery server-supported API groups, versions and resources.

func NewCachedDiscoveryClientForConfig

func NewCachedDiscoveryClientForConfig(config *restclient.Config, discoveryCacheDir, httpCacheDir string, ttl time.Duration) (*CachedDiscoveryClient, error)

NewCachedDiscoveryClientForConfig creates a new DiscoveryClient for the given config, and wraps the created client in a CachedDiscoveryClient. The provided configuration is updated with a custom transport that understands cache responses. We receive two distinct cache directories for now, in order to preserve old behavior which makes use of the --cache-dir flag value for storing cache data from the CacheRoundTripper, and makes use of the hardcoded destination (~/.kube/cache/discovery/...) for storing CachedDiscoveryClient cache data. If httpCacheDir is empty, the restconfig's transport will not be updated with a roundtripper that understands cache responses. If discoveryCacheDir is empty, cached server resource data will be looked up in the current directory. TODO(juanvallejo): the value of "--cache-dir" should be honored. Consolidate discoveryCacheDir with httpCacheDir so that server resources and http-cache data are stored in the same location, provided via config flags.

func (*CachedDiscoveryClient) Fresh

func (d *CachedDiscoveryClient) Fresh() bool

Fresh is supposed to tell the caller whether or not to retry if the cache fails to find something (false = retry, true = no need to retry).

func (*CachedDiscoveryClient) Invalidate

func (d *CachedDiscoveryClient) Invalidate()

Invalidate enforces that no cached data is used in the future that is older than the current time.

func (*CachedDiscoveryClient) OpenAPISchema

func (d *CachedDiscoveryClient) OpenAPISchema() (*openapi_v2.Document, error)

OpenAPISchema retrieves and parses the swagger API schema the server supports.

func (*CachedDiscoveryClient) RESTClient

func (d *CachedDiscoveryClient) RESTClient() restclient.Interface

RESTClient returns a RESTClient that is used to communicate with API server by this client implementation.

func (*CachedDiscoveryClient) ServerGroups

func (d *CachedDiscoveryClient) ServerGroups() (*metav1.APIGroupList, error)

ServerGroups returns the supported groups, with information like supported versions and the preferred version.

func (*CachedDiscoveryClient) ServerGroupsAndResources

func (d *CachedDiscoveryClient) ServerGroupsAndResources() ([]*metav1.APIGroup, []*metav1.APIResourceList, error)

ServerGroupsAndResources returns the supported groups and resources for all groups and versions.

func (*CachedDiscoveryClient) ServerPreferredNamespacedResources

func (d *CachedDiscoveryClient) ServerPreferredNamespacedResources() ([]*metav1.APIResourceList, error)

ServerPreferredNamespacedResources returns the supported namespaced resources with the version preferred by the server.

func (*CachedDiscoveryClient) ServerPreferredResources

func (d *CachedDiscoveryClient) ServerPreferredResources() ([]*metav1.APIResourceList, error)

ServerPreferredResources returns the supported resources with the version preferred by the server.

func (*CachedDiscoveryClient) ServerResources

func (d *CachedDiscoveryClient) ServerResources() ([]*metav1.APIResourceList, error)

ServerResources returns the supported resources for all groups and versions. Deprecated: use ServerGroupsAndResources instead.

func (*CachedDiscoveryClient) ServerResourcesForGroupVersion

func (d *CachedDiscoveryClient) ServerResourcesForGroupVersion(groupVersion string) (*metav1.APIResourceList, error)

ServerResourcesForGroupVersion returns the supported resources for a group and version.

func (*CachedDiscoveryClient) ServerVersion

func (d *CachedDiscoveryClient) ServerVersion() (*version.Info, error)

ServerVersion retrieves and parses the server's version (git version).