Documentation ¶
Index ¶
- func NewCustomResourceReader(reader engine.ClusterReader, mapper meta.RESTMapper, ...) engine.StatusReader
- type CachingClusterReader
- func (c *CachingClusterReader) Get(ctx context.Context, key client.ObjectKey, obj *unstructured.Unstructured) error
- func (c *CachingClusterReader) ListClusterScoped(ctx context.Context, list *unstructured.UnstructuredList, ...) error
- func (c *CachingClusterReader) ListNamespaceScoped(ctx context.Context, list *unstructured.UnstructuredList, namespace string, ...) error
- func (c *CachingClusterReader) Sync(ctx context.Context) error
- type CustomResourceReader
- type Expression
- type StatusPoller
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCustomResourceReader ¶
func NewCustomResourceReader(reader engine.ClusterReader, mapper meta.RESTMapper, conditions ...types.Condition) engine.StatusReader
NewCustomResourceReader implements custom logic to retrieve resource's status
Types ¶
type CachingClusterReader ¶
type CachingClusterReader struct { Cr *clusterreader.CachingClusterReader // contains filtered or unexported fields }
CachingClusterReader is wrapper for kstatus.CachingClusterReader implementation
func (*CachingClusterReader) Get ¶
func (c *CachingClusterReader) Get(ctx context.Context, key client.ObjectKey, obj *unstructured.Unstructured) error
Get is a wrapper for kstatus.CachingClusterReader Get method
func (*CachingClusterReader) ListClusterScoped ¶
func (c *CachingClusterReader) ListClusterScoped( ctx context.Context, list *unstructured.UnstructuredList, selector labels.Selector) error
ListClusterScoped is a wrapper for kstatus.CachingClusterReader ListClusterScoped method
func (*CachingClusterReader) ListNamespaceScoped ¶
func (c *CachingClusterReader) ListNamespaceScoped( ctx context.Context, list *unstructured.UnstructuredList, namespace string, selector labels.Selector) error
ListNamespaceScoped is a wrapper for kstatus.CachingClusterReader ListNamespaceScoped method
type CustomResourceReader ¶
type CustomResourceReader struct { // Reader is an implementation of the ClusterReader interface. It provides a // way for the StatusReader to fetch resources from the cluster. Reader engine.ClusterReader // Mapper provides a way to look up the resource types that are available // in the cluster. Mapper meta.RESTMapper // StatusFunc is a function for computing status of object StatusFunc func(u *unstructured.Unstructured) (*status.Result, error) // CondMap is a map with stored jsonpath expressions per GK to compute custom status CondMap map[schema.GroupKind]Expression }
CustomResourceReader is a wrapper for clu-utils genericClusterReader struct
func (*CustomResourceReader) ReadStatus ¶
func (c *CustomResourceReader) ReadStatus(ctx context.Context, identifier object.ObjMetadata) *event.ResourceStatus
ReadStatus will fetch the resource identified by the given identifier from the cluster and return an ResourceStatus that will contain information about the latest state of the resource, its computed status and information about any generated resources.
func (*CustomResourceReader) ReadStatusForObject ¶
func (c *CustomResourceReader) ReadStatusForObject(_ context.Context, obj *unstructured.Unstructured) *event.ResourceStatus
ReadStatusForObject is similar to ReadStatus, but instead of looking up the resource based on an identifier, it will use the passed-in resource.
type Expression ¶
type Expression struct { // A Condition describes a JSONPath filter which is matched against an // array containing a single resource. Condition string Value string // contains filtered or unexported fields }
An Expression is used to find information about a kubernetes resource. It evaluates to a boolean when matched against a resource.
func (*Expression) Match ¶
func (e *Expression) Match(obj map[string]interface{}) (bool, error)
Match returns true if the given object matches the parsed jsonpath object. An error is returned if the Expression's condition is not a valid JSONPath as defined here: https://goessner.net/articles/JsonPath.
type StatusPoller ¶
type StatusPoller struct { ClusterReaderFactoryFunc engine.ClusterReaderFactoryFunc StatusReadersFactoryFunc engine.StatusReadersFactoryFunc Engine *engine.PollerEngine // contains filtered or unexported fields }
StatusPoller provides functionality for polling a cluster for status for a set of resources.
func NewStatusPoller ¶
NewStatusPoller creates a new StatusPoller using the given clusterreader and mapper. The StatusPoller will use the client for all calls to the cluster.
func (*StatusPoller) Poll ¶
func (s *StatusPoller) Poll( ctx context.Context, identifiers object.ObjMetadataSet, options polling.Options) <-chan event.Event
Poll will create a new statusPollerRunner that will poll all the resources provided and report their status back on the event channel returned. The statusPollerRunner can be canceled at any time by canceling the context passed in.