Version: v0.0.0-...-ec175e0 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Jul 25, 2021 License: Apache-2.0 Imports: 15 Imported by: 0




This section is empty.


View Source
var AutoAccessVerbs = metav1.Verbs{"list", "watch"}


func AutoDiscoverAccess

func AutoDiscoverAccess(ctx context.Context, client *Client, namespace string, resources ...resource.Resource) error

func AutoDiscoverNamespaces

func AutoDiscoverNamespaces(ctx context.Context, client *Client) error

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

func AutoDiscoverResources(ctx context.Context, client *Client) error

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 CheckRestConfig(ctx context.Context, config *rest.Config, logger *zap.Logger) error

func NewClientset

func NewClientset(ctx context.Context, config *rest.Config) (kubernetes.Interface, error)

func NewDynamicClient

func NewDynamicClient(ctx context.Context, config *rest.Config) (dynamic.Interface, error)

func NewWatcher

func NewWatcher(ctx context.Context, logger *zap.Logger, d dynamic.Interface) (*cache.Watcher, error)

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 UpdateResourceAccess(ctx context.Context, client *Client, res resource.Resource, namespaces []string) error

func WatchAllResources

func WatchAllResources(ctx context.Context, client *Client, queueEvents bool, namespaces []string)

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.


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

func NewClient

func NewClient(ctx context.Context, options ...ClientOption) (*Client, error)

func (*Client) UpdateRESTConfig

func (c *Client) UpdateRESTConfig(ctx context.Context, config *rest.Config) error

type ClientOption

type ClientOption func(*Client)

func WithClientsetFn

func WithClientsetFn(fn func(context.Context, *rest.Config) (kubernetes.Interface, error)) ClientOption

func WithDynamicClientFn

func WithDynamicClientFn(fn func(context.Context, *rest.Config) (dynamic.Interface, error)) ClientOption

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 WithSkipSubjectAccessChecks

func WithSkipSubjectAccessChecks(skip bool) ClientOption

type ModeType

type ModeType uint
const (
	Auto ModeType = iota


Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL