Documentation ¶
Index ¶
- Variables
- func AutoDiscoverAccess(ctx context.Context, client *Client, namespace string, ...) error
- func AutoDiscoverNamespaces(ctx context.Context, client *Client) error
- func AutoDiscoverResources(ctx context.Context, client *Client) error
- func CheckRestConfig(ctx context.Context, config *rest.Config, logger *zap.Logger) error
- func NewClientset(ctx context.Context, config *rest.Config) (kubernetes.Interface, error)
- func NewDynamicClient(ctx context.Context, config *rest.Config) (dynamic.Interface, error)
- func NewServerResources(ctx context.Context, clientset kubernetes.Interface) (discovery.ServerResourcesInterface, error)
- func NewSubjectAccess(ctx context.Context, clientset kubernetes.Interface) (typedAuthv1.SelfSubjectAccessReviewInterface, error)
- func NewWatcher(ctx context.Context, logger *zap.Logger, d dynamic.Interface) (*cache.Watcher, error)
- func ResourceList(ctx context.Context, client *Client, namespaced bool) ([]resource.Resource, error)
- func UpdateResourceAccess(ctx context.Context, client *Client, res resource.Resource, ...) error
- func WatchAllResources(ctx context.Context, client *Client, queueEvents bool, namespaces []string)
- func WatchResource(ctx context.Context, client *Client, res resource.Resource, queueEvents bool, ...) ([]cache.ResourceLister, error)
- type Client
- type ClientOption
- func WithClientsetFn(fn func(context.Context, *rest.Config) (kubernetes.Interface, error)) ClientOption
- func WithDynamicClientFn(fn func(context.Context, *rest.Config) (dynamic.Interface, error)) ClientOption
- func WithLogger(logger *zap.Logger) ClientOption
- func WithNamespaceMode(mode ModeType) ClientOption
- func WithRESTConfig(config *rest.Config) ClientOption
- func WithResourceMode(mode ModeType) ClientOption
- func WithServerResourcesFn(...) ClientOption
- func WithSkipSubjectAccessChecks(skip bool) ClientOption
- func WithSubjectAccessFn(...) ClientOption
- func WithWatcherFn(...) ClientOption
- type ModeType
Constants ¶
This section is empty.
Variables ¶
var AutoAccessVerbs = metav1.Verbs{"list", "watch"}
Functions ¶
func AutoDiscoverAccess ¶
func AutoDiscoverNamespaces ¶
AutoDiscoverNamespaces makes a best-effort attempt using the dynamic client to list all the namespaces in the cluster and update the cache.Namespaces list with the results. This is commonly used as a startup routine.
func AutoDiscoverResources ¶
AutoDiscoverResources makes a best-effort attempt using the discover client to list all the resources for all of the namespaces that were provided and update the cache.ResourceMap. This operation is expensive on large clusters and should be considered part of a startup routine and a long-duration periodic task.
func CheckRestConfig ¶
func NewClientset ¶
func NewDynamicClient ¶
func NewServerResources ¶
func NewServerResources(ctx context.Context, clientset kubernetes.Interface) (discovery.ServerResourcesInterface, error)
func NewSubjectAccess ¶
func NewSubjectAccess(ctx context.Context, clientset kubernetes.Interface) (typedAuthv1.SelfSubjectAccessReviewInterface, error)
func NewWatcher ¶
func ResourceList ¶
func ResourceList(ctx context.Context, client *Client, namespaced bool) ([]resource.Resource, error)
ResourceListForNamespace uses a Discovery Client and attempts to list all of the known resources for the given namespace. This method can be used to populate initial resource lists as well as refresh existing caches.
func UpdateResourceAccess ¶
func WatchAllResources ¶
func WatchResource ¶
func WatchResource(ctx context.Context, client *Client, res resource.Resource, queueEvents bool, namespaces []string) ([]cache.ResourceLister, error)
WatchResource creates a watch for the Resource in the provided namespaces. To watch across all namespaces you can pass in metav1.NamespaceAll.
Types ¶
type Client ¶
type Client struct { ResourceMode ModeType NamespaceMode ModeType SkipSubjectAccessChecks bool RESTConfig *rest.Config Logger *zap.Logger WatcherFn func(context.Context, *zap.Logger, dynamic.Interface) (*cache.Watcher, error) ClientsetFn func(context.Context, *rest.Config) (kubernetes.Interface, error) DynamicClientFn func(context.Context, *rest.Config) (dynamic.Interface, error) ServerResourcesFn func(context.Context, kubernetes.Interface) (discovery.ServerResourcesInterface, error) SubjectAccessFn func(context.Context, kubernetes.Interface) (typedAuthv1.SelfSubjectAccessReviewInterface, error) // contains filtered or unexported fields }
type ClientOption ¶
type ClientOption func(*Client)
func WithClientsetFn ¶
func WithClientsetFn(fn func(context.Context, *rest.Config) (kubernetes.Interface, error)) ClientOption
func WithDynamicClientFn ¶
func WithLogger ¶
func WithLogger(logger *zap.Logger) ClientOption
func WithNamespaceMode ¶
func WithNamespaceMode(mode ModeType) ClientOption
func WithRESTConfig ¶
func WithRESTConfig(config *rest.Config) ClientOption
func WithResourceMode ¶
func WithResourceMode(mode ModeType) ClientOption
func WithServerResourcesFn ¶
func WithServerResourcesFn(fn func(context.Context, kubernetes.Interface) (discovery.ServerResourcesInterface, error)) ClientOption
func WithSkipSubjectAccessChecks ¶
func WithSkipSubjectAccessChecks(skip bool) ClientOption
func WithSubjectAccessFn ¶
func WithSubjectAccessFn(fn func(context.Context, kubernetes.Interface) (typedAuthv1.SelfSubjectAccessReviewInterface, error)) ClientOption