Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContextHandler ¶
type ContextHandler interface { // GetClientSet gets the kubernetes client set for the defined config file and context. GetClientSet() (kubernetes.Interface, error) // GetDynamicClient gets the kubernetes dynamic client to access unknown custom resources. GetDynamicClient() (dynamic.Interface, error) // GetConfigFile gets the path to the configuration file. GetConfigFile() string // GetContextName get the name of the context to use. GetContextName() string // Kubectl executes the given command with the given arguments in the configured cluster. Kubectl(command string, args ...string) (string, error) // IsMinikube returns true if the target of this context is a minikube instance. Otherwise false. IsMinikube() (bool, error) }
ContextHandler is a small interface to encapsulate everything related with retrieving the kubernetes configuration and context.
func NewContextHandler ¶
func NewContextHandler(configFile *string, contextName *string) ContextHandler
NewContextHandler creates a new ContextHandler instance for the given config file and context name.
type WatchHandler ¶
type WatchHandler interface { // PreWatch is executed before the watch loop starts and must return the // watch.Interface instance to watch for the events. PreWatch(options metav1.ListOptions) (watch.Interface, error) // AddedEvent handles the event when a new resource was added. AddedEvent(obj runtime.Object) error // UpdatedEvent handles the event when a resource was updated. UpdatedEvent(obj runtime.Object) error // DeletedEvent handles the event when a resource was deleted. DeletedEvent(obj runtime.Object) error // PostEvent is executed after every event if the event handling were executed // without an error. PostEvent() error }
WatchHandler is the interface that must be implemented by the application code which requires watching on kubernetes resources.
type Watcher ¶
type Watcher struct { // Resource Version is the minimum version to start the watch on. ResourceVersion string // contains filtered or unexported fields }
Watcher is a small helper to handle to watch changes on kubernetes objects. It reduces the need of error handling in the actual implementation.
func NewWatcher ¶
func NewWatcher(handler WatchHandler, options *metav1.ListOptions, resourceVersion string) (*Watcher, error)
NewWatcher initializes a new Watcher instance and ensures the consistency of the given parameters.
Click to show internal directories.
Click to hide internal directories.