Documentation
¶
Index ¶
Constants ¶
View Source
const (
// CreateVerb represents create access on a resource.
CreateVerb = "create"
// UpdateVerb represents an update access on a resource.
UpdateVerb = "update"
// PatchVerb represents a patch access on a resource.
PatchVerb = "patch"
// DeleteVerb represents a delete access on a resource.
DeleteVerb = "delete"
// GetVerb represents a get access on a resource.
GetVerb = "get"
// ListVerb represents a list access on a resource.
ListVerb = "list"
// WatchVerb represents a watch access on a resource.
WatchVerb = "watch"
)
Variables ¶
View Source
var (
// GetAccess reads a resource.
GetAccess = []string{GetVerb}
// ListAccess list resources.
ListAccess = []string{ListVerb}
// MonitorAccess monitors a collection of resources.
MonitorAccess = []string{ListVerb, WatchVerb}
// ReadAllAccess represents an all read access to a resource.
ReadAllAccess = []string{GetVerb, ListVerb, WatchVerb}
)
Functions ¶
This section is empty.
Types ¶
type Authorizer ¶
type Authorizer interface {
// CanI returns true if the user can use these actions for a given resource.
CanI(ns, gvr string, verbs []string) (bool, error)
}
Authorizer checks what a user can or cannot do to a resource.
type Config ¶
type Config interface {
CurrentNamespaceName() (string, error)
CurrentClusterName() (string, error)
Flags() *genericclioptions.ConfigFlags
RESTConfig() (*restclient.Config, error)
}
Config represents an api server configuration.
type Connection ¶
type Connection interface {
Authorizer
// Config returns current config.
Config() Config
// DialOrDie connects to api server.
DialOrDie() kubernetes.Interface
// CachedDiscoveryOrDie connects to discovery client.
CachedDiscoveryOrDie() *disk.CachedDiscoveryClient
// RestConfigOrDie connects to rest client.
RestConfigOrDie() *restclient.Config
// MXDial connects to metrics server.
MXDial() (*versioned.Clientset, error)
// DynDialOrDie connects to dynamic client.
DynDialOrDie() dynamic.Interface
// HasMetrics checks if metrics server is available.
HasMetrics() bool
// ServerVersion returns current server version.
ServerVersion() (*version.Info, error)
// ActiveCluster returns the current cluster name.
ActiveCluster() string
// ActiveNamespace returns the current namespace.
ActiveNamespace() string
// IsActiveNamespace checks if given ns is active.
IsActiveNamespace(string) bool
}
Connection represents a Kubenetes apiserver connection.
type Factory ¶
type Factory interface {
// Client retrieves an api client.
Client() Connection
// Get fetch a given resource.
Get(gvr, path string, wait bool, sel labels.Selector) (runtime.Object, error)
// List fetch a collection of resources.
List(gvr, ns string, wait bool, sel labels.Selector) ([]runtime.Object, error)
// ForResource fetch an informer for a given resource.
ForResource(ns, gvr string) informers.GenericInformer
// CanForResource fetch an informer for a given resource if authorized
CanForResource(ns, gvr string, verbs []string) (informers.GenericInformer, error)
// WaitForCacheSync synchronize the cache.
WaitForCacheSync()
}
Factory represents a resource factory.
Click to show internal directories.
Click to hide internal directories.