Documentation ¶
Index ¶
- Constants
- func CheckResourceStatus(obj unstructured.Unstructured) (*types.HealthStatus, error)
- func GetProviders() map[string]cuexruntime.ProviderFn
- func GetTemplate() string
- type AppCollector
- func (c *AppCollector) CollectResourceFromApp(ctx context.Context) ([]Resource, error)
- func (c *AppCollector) FindResourceFromAppliedResourcesField(ctx context.Context, app *v1beta1.Application) ([]Resource, error)
- func (c *AppCollector) FindResourceFromResourceTrackerSpec(ctx context.Context, app *v1beta1.Application) ([]Resource, error)
- func (c *AppCollector) ListApplicationResources(ctx context.Context, app *v1beta1.Application) ([]types.AppliedResource, error)
- type ChildrenResourcesRule
- type CustomSelector
- type FilterOption
- type GroupResourceType
- type ListParams
- type ListResult
- func CollectResources(ctx context.Context, params *ListParams) (*ListResult[querytypes.ResourceItem], error)
- func CollectServiceEndpoints(ctx context.Context, params *ListParams) (*ListResult[querytypes.ServiceEndpoint], error)
- func ListAppliedResources(ctx context.Context, params *ListParams) (*ListResult[querytypes.AppliedResource], error)
- func ListResourcesInApp(ctx context.Context, params *ListParams) (*ListResult[Resource], error)
- func SearchEvents(ctx context.Context, params *SearchParams) (*ListResult[corev1.Event], error)
- type ListVars
- type LogParams
- type LogResult
- type LogVars
- type Option
- type Resource
- type ResourceType
- type RuleList
- type SearchParams
- type SearchVars
- type SubResourceSelector
- type SubResources
- type WorkloadUnstructured
Constants ¶
const ( // ProviderName is provider name for install. ProviderName = "query" // HelmReleaseKind is the kind of HelmRelease HelmReleaseKind = "HelmRelease" )
const ( // DefaultMaxDepth is the default max depth for query iterator // check maxDepth function to get the customized val for max depth DefaultMaxDepth = 5 )
Variables ¶
This section is empty.
Functions ¶
func CheckResourceStatus ¶
func CheckResourceStatus(obj unstructured.Unstructured) (*types.HealthStatus, error)
CheckResourceStatus return object status data
func GetProviders ¶
func GetProviders() map[string]cuexruntime.ProviderFn
GetProviders returns the cue providers.
Types ¶
type AppCollector ¶
type AppCollector struct {
// contains filtered or unexported fields
}
AppCollector collect resource created by application
func NewAppCollector ¶
func NewAppCollector(cli client.Client, opt Option) *AppCollector
NewAppCollector create a app collector
func (*AppCollector) CollectResourceFromApp ¶
func (c *AppCollector) CollectResourceFromApp(ctx context.Context) ([]Resource, error)
CollectResourceFromApp collect resources created by application
func (*AppCollector) FindResourceFromAppliedResourcesField ¶
func (c *AppCollector) FindResourceFromAppliedResourcesField(ctx context.Context, app *v1beta1.Application) ([]Resource, error)
FindResourceFromAppliedResourcesField find resources from AppliedResources field
func (*AppCollector) FindResourceFromResourceTrackerSpec ¶
func (c *AppCollector) FindResourceFromResourceTrackerSpec(ctx context.Context, app *v1beta1.Application) ([]Resource, error)
FindResourceFromResourceTrackerSpec find resources from ResourceTracker spec
func (*AppCollector) ListApplicationResources ¶
func (c *AppCollector) ListApplicationResources(ctx context.Context, app *v1beta1.Application) ([]types.AppliedResource, error)
ListApplicationResources list application applied resources from tracker
type ChildrenResourcesRule ¶
type ChildrenResourcesRule struct { // GroupResourceType the root resource type GroupResourceType GroupResourceType // every subResourceType can have a specified genListOptionFunc. SubResources *SubResources // if specified genListOptionFunc is nil will use use default genListOptionFunc to generate listOption. DefaultGenListOptionFunc genListOptionFunc // DisableFilterByOwnerReference means don't use parent resource's UID filter the result. DisableFilterByOwnerReference bool }
ChildrenResourcesRule define the relationShip between parentObject and children resource
type CustomSelector ¶
type CustomSelector struct { ResourceType `json:",inline"` // defaultLabelSelector means read the label selector condition from the spec.selector. DefaultLabelSelector bool `json:"defaultLabelSelector"` }
CustomSelector the custom resource selector configuration in configmap. support set the default label selector policy
type FilterOption ¶
type FilterOption struct { Cluster string `json:"cluster,omitempty"` ClusterNamespace string `json:"clusterNamespace,omitempty"` Components []string `json:"components,omitempty"` APIVersion string `json:"apiVersion,omitempty"` Kind string `json:"kind,omitempty"` QueryNewest bool `json:"queryNewest,omitempty"` }
FilterOption filter resource created by component
type GroupResourceType ¶
GroupResourceType define the parent resource type
type ListParams ¶
type ListParams = oamprovidertypes.OAMParams[ListVars]
ListParams is the params for list
type ListResult ¶
ListResult is the result for list
func CollectResources ¶
func CollectResources(ctx context.Context, params *ListParams) (*ListResult[querytypes.ResourceItem], error)
CollectResources collects resources from the cluster
func CollectServiceEndpoints ¶
func CollectServiceEndpoints(ctx context.Context, params *ListParams) (*ListResult[querytypes.ServiceEndpoint], error)
CollectServiceEndpoints generator service endpoints is available for common component type, such as webservice or helm it can not support the cloud service component currently
func ListAppliedResources ¶
func ListAppliedResources(ctx context.Context, params *ListParams) (*ListResult[querytypes.AppliedResource], error)
ListAppliedResources list applied resource from tracker, this provider only queries the metadata.
func ListResourcesInApp ¶
func ListResourcesInApp(ctx context.Context, params *ListParams) (*ListResult[Resource], error)
ListResourcesInApp lists CRs created by Application, this provider queries the object data.
func SearchEvents ¶
func SearchEvents(ctx context.Context, params *SearchParams) (*ListResult[corev1.Event], error)
SearchEvents searches events
type LogParams ¶
type LogParams = oamprovidertypes.OAMParams[LogVars]
LogParams is the params for log
type LogResult ¶
type LogResult struct {
Outputs map[string]interface{} `json:"outputs"`
}
LogResult is the result for log
type LogVars ¶
type LogVars struct { Cluster string `json:"cluster"` Namespace string `json:"namespace"` Pod string `json:"pod"` Options *corev1.PodLogOptions `json:"options,omitempty"` }
LogVars is the vars for log
type Option ¶
type Option struct { Name string `json:"name"` Namespace string `json:"namespace"` Filter FilterOption `json:"filter,omitempty"` // WithStatus means query the object from the cluster and get the latest status // This field only suitable for ListResourcesInApp WithStatus bool `json:"withStatus,omitempty"` // WithTree means recursively query the resource tree. WithTree bool `json:"withTree,omitempty"` }
Option is the query option
type Resource ¶
type Resource struct { Cluster string `json:"cluster"` Component string `json:"component"` Revision string `json:"revision"` Object *unstructured.Unstructured `json:"object"` }
Resource refer to an object with cluster info
type ResourceType ¶
type ResourceType struct { APIVersion string `json:"apiVersion,omitempty"` Kind string `json:"kind,omitempty"` }
ResourceType define the children resource type
type RuleList ¶
type RuleList []ChildrenResourcesRule
RuleList the rule list
func (*RuleList) GetRule ¶
func (rl *RuleList) GetRule(grt GroupResourceType) (*ChildrenResourcesRule, bool)
GetRule get the rule by the resource type
type SearchParams ¶
type SearchParams = oamprovidertypes.OAMParams[SearchVars]
SearchParams is the params for search
type SearchVars ¶
type SearchVars struct { Value *unstructured.Unstructured `json:"value"` Cluster string `json:"cluster"` }
SearchVars is the vars for search
type SubResourceSelector ¶
type SubResourceSelector struct { ResourceType // contains filtered or unexported fields }
SubResourceSelector the sub resource selector configuration
type SubResources ¶
type SubResources []*SubResourceSelector
SubResources the sub resource definitions
func (*SubResources) Get ¶
func (c *SubResources) Get(rt ResourceType) *SubResourceSelector
Get get the sub resource by the resource type
func (*SubResources) Put ¶
func (c *SubResources) Put(cr *SubResourceSelector)
Put add a sub resource to the list
type WorkloadUnstructured ¶
type WorkloadUnstructured struct {
unstructured.Unstructured
}
WorkloadUnstructured the workload unstructured, such as Deployment、Job、StatefulSet、ReplicaSet and DaemonSet
func (*WorkloadUnstructured) GetSelector ¶
func (w *WorkloadUnstructured) GetSelector(fields ...string) (labels.Selector, error)
GetSelector get the selector from the field path