Documentation ¶
Index ¶
- func Create(object Object) (err error)
- func Delete(object Object, opts ...DeleteOption) (err error)
- func ExposeMetricsPort()
- func Get(into Object, opts ...GetOption) error
- func Handle(handler Handler)
- func List(namespace string, into Object, opts ...ListOption) error
- func Patch(object Object, pt types.PatchType, patch []byte) (err error)
- func Run(ctx context.Context)
- func Update(object Object) (err error)
- func Watch(apiVersion, kind, namespace string, resyncPeriod time.Duration, ...)
- func WithLabelSelector(labelSelector string) watchOption
- func WithNumWorkers(numWorkers int) watchOption
- type DeleteOp
- type DeleteOption
- type Event
- type GetOp
- type GetOption
- type Handler
- type Informer
- type ListOp
- type ListOption
- type Object
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Create ¶ added in v0.0.6
Create creates the provided object on the server and updates the arg "object" with the result from the server(UID, resourceVersion, etc). Returns an error if the object’s TypeMeta(Kind, APIVersion) or ObjectMeta(Name/GenerateName, Namespace) is missing or incorrect. Can also return an api error from the server e.g AlreadyExists https://github.com/kubernetes/apimachinery/blob/master/pkg/api/errors/errors.go#L423
func Delete ¶ added in v0.0.6
func Delete(object Object, opts ...DeleteOption) (err error)
Delete deletes the specified object Returns an error if the object’s TypeMeta(Kind, APIVersion) or ObjectMeta(Name, Namespace) is missing or incorrect. e.g NotFound https://github.com/kubernetes/apimachinery/blob/master/pkg/api/errors/errors.go#L418 “opts” configures the DeleteOptions When passed WithDeleteOptions(o), the specified metav1.DeleteOptions are set.
func ExposeMetricsPort ¶ added in v0.0.6
func ExposeMetricsPort()
ExposeMetricsPort generate a Kubernetes Service to expose metrics port
func Get ¶ added in v0.0.6
Get gets the specified object and unmarshals the retrieved data into the "into" object. "into" is a Object that must have "Kind" and "APIVersion" specified in its "TypeMeta" field and "Name" and "Namespace" specified in its "ObjectMeta" field. "opts" configures the Get operation.
When passed With WithGetOptions(o), the specified metav1.GetOptions is set.
func Handle ¶
func Handle(handler Handler)
Handle registers the handler for all events. In the future, we would have a mux-pattern to dispatch events to matched handlers.
func List ¶ added in v0.0.6
func List(namespace string, into Object, opts ...ListOption) error
List retrieves the specified object list and unmarshals the retrieved data into the "into" object. "namespace" indicates which kubernetes namespace to look for the list of kubernetes objects. "into" is a sdkType.Object that must have "Kind" and "APIVersion" specified in its "TypeMeta" field "opts" configures the List operation.
When passed With WithListOptions(o), the specified metav1.ListOptions is set.
func Patch ¶ added in v0.0.6
Patch patches provided "object" on the server with given "patch" and updates the arg "object" with the result from the server(UID, resourceVersion, etc). Returns an error if the object’s TypeMeta(Kind, APIVersion) or ObjectMeta(Name, Namespace) is missing or incorrect. Returns an error if patch couldn't be json serialized into bytes. Can also return an api error from the server e.g Conflict https://github.com/kubernetes/apimachinery/blob/master/pkg/api/errors/errors.go#L428
func Update ¶ added in v0.0.6
Update updates the provided object on the server and updates the arg "object" with the result from the server(UID, resourceVersion, etc). Returns an error if the object’s TypeMeta(Kind, APIVersion) or ObjectMeta(Name, Namespace) is missing or incorrect. Can also return an api error from the server e.g Conflict https://github.com/kubernetes/apimachinery/blob/master/pkg/api/errors/errors.go#L428
func Watch ¶
Watch watches for changes on the given resource. apiVersion for a resource is of the format "Group/Version" except for the "Core" group whose APIVersion is just "v1". For e.g:
- Deployments have Group "apps" and Version "v1beta2" giving the APIVersion "apps/v1beta2"
- Pods have Group "Core" and Version "v1" giving the APIVersion "v1"
- The custom resource Memcached might have Group "cache.example.com" and Version "v1alpha1" giving the APIVersion "cache.example.com/v1alpha1"
kind is the Kind of the resource, e.g "Pod" for pods resyncPeriod is the time period for how often an event with the latest resource version will be sent to the handler, even if there is no change.
- 0 means no periodic events will be sent
Consult the API reference for the Group, Version and Kind of a resource: https://kubernetes.io/docs/reference/ namespace is the Namespace to watch for the resource TODO: support opts for specifying label selector
func WithLabelSelector ¶ added in v0.0.6
func WithLabelSelector(labelSelector string) watchOption
func WithNumWorkers ¶ added in v0.0.6
func WithNumWorkers(numWorkers int) watchOption
WithNumWorkers sets the number of workers for the Watch() operation.
Types ¶
type DeleteOp ¶ added in v0.0.6
type DeleteOp struct {
// contains filtered or unexported fields
}
DeleteOp wraps all the options for Delete().
func NewDeleteOp ¶ added in v0.0.6
func NewDeleteOp() *DeleteOp
type DeleteOption ¶ added in v0.0.6
type DeleteOption func(*DeleteOp)
DeleteOption configures DeleteOp.
func WithDeleteOptions ¶ added in v0.0.6
func WithDeleteOptions(metaDeleteOptions *metav1.DeleteOptions) DeleteOption
WithDeleteOptions sets the metav1.DeleteOptions for the Delete() operation.
type Event ¶ added in v0.0.6
Event is triggered when some change has happened on the watched resources. If created or updated, Object would be the current state and Deleted=false. If deleted, Object would be the last known state and Deleted=true.
type GetOp ¶ added in v0.0.6
type GetOp struct {
// contains filtered or unexported fields
}
GetOp wraps all the options for Get().
type GetOption ¶ added in v0.0.6
type GetOption func(*GetOp)
GetOption configures GetOp.
func WithGetOptions ¶ added in v0.0.6
func WithGetOptions(metaGetOptions *metav1.GetOptions) GetOption
WithGetOptions sets the metav1.GetOptions for the Get() operation.
type Handler ¶ added in v0.0.6
Handler reacts to events and outputs actions. If any intended action failed, the event would be re-triggered. For actions done before the failed action, there is no rollback.
var ( // RegisteredHandler is the user registered handler set by sdk.Handle() RegisteredHandler Handler )
type ListOp ¶ added in v0.0.6
type ListOp struct {
// contains filtered or unexported fields
}
ListOp wraps all the options for List.
type ListOption ¶ added in v0.0.6
type ListOption func(*ListOp)
ListOption configures ListOp.
func WithListOptions ¶ added in v0.0.6
func WithListOptions(metaListOptions *metav1.ListOptions) ListOption
WithListOptions sets the metav1.ListOptions for the List() operation.