query

package
v1.8.0-alpha.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 22, 2023 License: Apache-2.0 Imports: 51 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ProviderName is provider name for install.
	ProviderName = "query"
	// HelmReleaseKind is the kind of HelmRelease
	HelmReleaseKind = "HelmRelease"
)

Variables

This section is empty.

Functions

func CheckResourceStatus added in v1.6.0

func CheckResourceStatus(obj unstructured.Unstructured) (*types.HealthStatus, error)

CheckResourceStatus return object status data

func Install

func Install(p types.Providers, cli client.Client, cfg *rest.Config)

Install register handlers to provider discover.

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 added in v1.3.0

func (c *AppCollector) ListApplicationResources(ctx context.Context, app *v1beta1.Application) ([]*types.AppliedResource, error)

ListApplicationResources list application applied resources from tracker

type ChildrenResourcesRule added in v1.4.0

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 added in v1.5.0

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"`
}

FilterOption filter resource created by component

type GroupResourceType added in v1.4.0

type GroupResourceType struct {
	Group string `json:"group"`
	Kind  string `json:"kind"`
}

GroupResourceType define the parent resource type

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 added in v1.4.0

type ResourceType struct {
	APIVersion string `json:"apiVersion,omitempty"`
	Kind       string `json:"kind,omitempty"`
}

ResourceType define the children resource type

type RuleList added in v1.5.0

type RuleList []ChildrenResourcesRule

RuleList the rule list

func (*RuleList) GetRule added in v1.5.0

GetRule get the rule by the resource type

type SubResourceSelector added in v1.5.0

type SubResourceSelector struct {
	ResourceType
	// contains filtered or unexported fields
}

SubResourceSelector the sub resource selector configuration

type SubResources added in v1.5.0

type SubResources []*SubResourceSelector

SubResources the sub resource definitions

func (*SubResources) Get added in v1.5.0

Get get the sub resource by the resource type

func (*SubResources) Put added in v1.5.0

func (c *SubResources) Put(cr *SubResourceSelector)

Put add a sub resource to the list

type WorkloadUnstructured added in v1.5.0

type WorkloadUnstructured struct {
	unstructured.Unstructured
}

WorkloadUnstructured the workload unstructured, such as Deployment、Job、StatefulSet、ReplicaSet and DaemonSet

func (*WorkloadUnstructured) GetSelector added in v1.5.0

func (w *WorkloadUnstructured) GetSelector(fields ...string) (labels.Selector, error)

GetSelector get the selector from the field path

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL