Documentation ¶
Overview ¶
Package kit for Kubernetes operators
Package kit for Kubernetes operators ¶
Package kit for Kubernetes operators
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrVersionOutdated indicates that the custom resource is outdated and needs to be refreshed ErrVersionOutdated = errors.New("requested version is outdated in apiserver") )
Functions ¶
func CreateCustomResources ¶
func CreateCustomResources(context Context, resources []CustomResource) error
CreateCustomResources creates the given custom resources and waits for them to initialize The resource is of kind CRD if the Kubernetes server is 1.7.0 and above. The resource is of kind TPR if the Kubernetes server is below 1.7.0.
func NewHTTPClient ¶
func NewHTTPClient(group, version string, schemeBuilder runtime.SchemeBuilder) (rest.Interface, *runtime.Scheme, error)
NewHTTPClient creates a Kubernetes client to interact with API extensions for Custom Resources
Types ¶
type Context ¶
type Context struct { Clientset kubernetes.Interface APIExtensionClientset apiextensionsclient.Interface Interval time.Duration Timeout time.Duration }
Context hold the clientsets used for creating and watching custom resources
type CustomResource ¶
type CustomResource struct { // Name of the custom resource Name string // Plural of the custom resource in plural Plural string // Group the custom resource belongs to Group string // Version which should be defined in a const above Version string // Scope of the CRD. Namespaced or cluster Scope apiextensionsv1beta1.ResourceScope // Kind is the serialized interface of the resource. Kind string }
CustomResource is for creating a Kubernetes TPR/CRD
type ResourceWatcher ¶
type ResourceWatcher struct {
// contains filtered or unexported fields
}
ResourceWatcher watches a custom resource for desired state
func NewWatcher ¶
func NewWatcher(resource CustomResource, namespace string, handlers cache.ResourceEventHandlerFuncs, client rest.Interface) *ResourceWatcher
NewWatcher creates an instance of a custom resource watcher for the given resource
func (*ResourceWatcher) Watch ¶
func (w *ResourceWatcher) Watch(objType runtime.Object, done chan struct{}) error
Watch begins watching the custom resource (TPR/CRD). The call will block until a Done signal is raised during in the context. When the watch has detected a create, update, or delete event, it will handled by the functions in the resourceEventHandlers. After the callback returns, the watch loop will continue for the next event. If the callback returns an error, the error will be logged.
Directories ¶
Path | Synopsis |
---|---|
Package main for a sample operator Package main for a sample operator Package main to manage a sample operator.
|
Package main for a sample operator Package main for a sample operator Package main to manage a sample operator. |