Documentation ¶
Index ¶
- type Resource
- type ResourceConditionReadyRequirements
- type ResourceCounter
- type ResourceCounterQuery
- type ResourceCounterResults
- type ResourceFigures
- type ResourceList
- func (r *ResourceList) AddReadyRequirementsFromSlice(reqsList []ResourceConditionReadyRequirements)
- func (r *ResourceList) Count() int
- func (r *ResourceList) CountReady() int
- func (r *ResourceList) FilterByOwnerUID(ownerUID string) ResourceList
- func (r *ResourceList) GetByGVKAndNamespace(pClient client.Client, ctx context.Context, namespace string, ...) error
- func (r *ResourceList) GetResourceStatusBuckets() ResourceStatusBuckets
- func (r *ResourceList) SetListAndParse(uList unstructured.UnstructuredList)
- type ResourceMetadata
- type ResourceStatus
- type ResourceStatusBuckets
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Resource ¶
type Resource struct { Status ResourceStatus Metadata ResourceMetadata Conditions []map[string]string ReadyRequirements []ResourceConditionReadyRequirements }
Represents a k8s resource in a type-neutral way We used to have lots of repeated code because we needed to perform the same operations on different resources, which are represented by the go k8s sdk as different types. This type provides a single type that can represent any kind of resource and perform common actions
func MakeResource ¶
func MakeResource(source unstructured.Unstructured) Resource
Make a resource from an unstructured, parse it, and return it
func (*Resource) AddReadyRequirements ¶
func (r *Resource) AddReadyRequirements(requirements ResourceConditionReadyRequirements)
Adds a resource ready requirement
type ResourceConditionReadyRequirements ¶
In order to status check resources we check their status conditions for a condition with a specific type and status. This type lets us define and pass those values around
type ResourceCounter ¶
type ResourceCounter struct { CountManaged int CountReady int BrokenLog []string Query ResourceCounterQuery ReadyRequirements []ResourceConditionReadyRequirements }
Provides a simple API for getting common figures on Resources and ResourceLists The Count method returns a ResourceCounterResults instance
func (*ResourceCounter) Count ¶
func (r *ResourceCounter) Count(ctx context.Context, pClient client.Client) ResourceCounterResults
Counts the resources
func (*ResourceCounter) GetResourceList ¶
func (r *ResourceCounter) GetResourceList(pClient client.Client, ctx context.Context, namespace string) ResourceList
type ResourceCounterQuery ¶
Represents a resource query for a count We count resources of a given GVK (which derive from OfType ), in a given set of namespaces, owned by a given guid
type ResourceCounterResults ¶
Results that a resource counter provides back when its count method is called
type ResourceFigures ¶
An operator is interested in how many of a resource it manages and how many are ready
type ResourceList ¶
type ResourceList struct { Resources []Resource // contains filtered or unexported fields }
The pattern other k8s SDKs follow is that resources are queried by some criteria resulting in a list object that then can be iterated over or acted on. ResourceList can query k8s for a list of resources by GVK and namespace which it then parses into Resource instances.
func (*ResourceList) AddReadyRequirementsFromSlice ¶
func (r *ResourceList) AddReadyRequirementsFromSlice(reqsList []ResourceConditionReadyRequirements)
Add resource ready requirements for all of the resources in the list
func (*ResourceList) CountReady ¶
func (r *ResourceList) CountReady() int
Get a count of the ready resources
func (*ResourceList) FilterByOwnerUID ¶
func (r *ResourceList) FilterByOwnerUID(ownerUID string) ResourceList
Get a new list filtered by a specific owner UID
func (*ResourceList) GetByGVKAndNamespace ¶
func (r *ResourceList) GetByGVKAndNamespace(pClient client.Client, ctx context.Context, namespace string, gvk schema.GroupVersionKind) error
Gets a ResourceList by a provided GVK and Namespace
func (*ResourceList) GetResourceStatusBuckets ¶
func (r *ResourceList) GetResourceStatusBuckets() ResourceStatusBuckets
Get a lists of resources bucketed by status
func (*ResourceList) SetListAndParse ¶
func (r *ResourceList) SetListAndParse(uList unstructured.UnstructuredList)
Set the source unstructured list and then parse it
type ResourceMetadata ¶
type ResourceMetadata struct { Generation int64 Namespace string Name string UID string ResourceVersion string OwnerUIDs []string }
Represents the metadata we pull off the unstructured resource
type ResourceStatus ¶
type ResourceStatus struct {
ObservedGeneration int64
}
Represents the status we pull off the unstructured resource I only parse what I need to reduce the oppurtunity for bugs