Documentation ¶
Index ¶
- Variables
- type GVKs
- 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 ¶
var CommonGVKs = GVKs{ Deployment: schema.GroupVersionKind{ Group: "apps", Version: "v1", Kind: "Deployment", }, Kafka: schema.GroupVersionKind{ Group: "kafka.strimzi.io", Version: "v1beta2", Kind: "Kafka", }, KafkaConnect: schema.GroupVersionKind{ Group: "kafka.strimzi.io", Version: "v1beta2", Kind: "KafkaConnect", }, KafkaTopic: schema.GroupVersionKind{ Group: "kafka.strimzi.io", Version: "v1beta2", Kind: "KafkaTopic", }, }
Functions ¶
This section is empty.
Types ¶
type GVKs ¶ added in v0.5.1
type GVKs struct { Deployment schema.GroupVersionKind Kafka schema.GroupVersionKind KafkaTopic schema.GroupVersionKind KafkaConnect schema.GroupVersionKind }
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 MakeResourceCounterForType ¶ added in v0.5.1
func MakeResourceCounterForType(typeSpecimen client.Object, scheme runtime.Scheme, namespaces []string, uid types.UID, readyRequirements []ResourceConditionReadyRequirements) (ResourceCounter, error)
Encapsulates the logic for making a query and returning a resource counter in one method call
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 ¶
type ResourceCounterQuery struct { GVK schema.GroupVersionKind Namespaces []string OwnerGUID string }
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