graph

package
v0.0.0-...-6dacf26 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2022 License: AGPL-3.0 Imports: 49 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CostFactorOfInAppFiltering = 4 means, we assume that the cost of listing all resources and
	// filtering them in the app (instead of using kube-apiserver) is 5x of that via label based selection
	CostFactorOfInAppFiltering = 4

	MetadataNamespace      = "metadata.namespace"
	MetadataNamespaceQuery = "{." + MetadataNamespace + "}"
	MetadataLabels         = "metadata.labels"
	MetadataNameQuery      = "{.metadata.name}"
)

Variables

View Source
var Schema = getGraphQLSchema()

Functions

func ExecGraphQLQuery

func ExecGraphQLQuery(c client.Client, query string, vars map[string]interface{}) ([]unstructured.Unstructured, error)

func Extract

func Extract(u *unstructured.Unstructured, fieldPath string, v interface{}) (bool, error)

func ExtractName

func ExtractName(name, selector string) (string, bool)

func ExtractSelector

func ExtractSelector(u *unstructured.Unstructured, fieldPath string) (labels.Selector, error)

func IsOwnedBy

func IsOwnedBy(obj metav1.Object, owner metav1.Object) bool

func Namespaces

func Namespaces(ref *unstructured.Unstructured, nsSelector string) ([]string, error)

len([]string) == 0 && err == nil => all namespaces

func PollNewResourceTypes

func PollNewResourceTypes(cfg *restclient.Config) func(ctx context.Context) error

func RenderLayout

func RenderLayout(
	kc client.Client,
	src apiv1.ObjectInfo,
	layoutName string,
	pageName string,
	convertToTable bool,
	renderBlocks sets.String,
) (*v1alpha1.ResourceView, error)

func RenderPageBlock

func RenderPageBlock(kc client.Client, src apiv1.ObjectInfo, block *v1alpha1.PageBlockLayout, convertToTable bool) (*v1alpha1.PageBlockView, error)

func ResourceGraph

func ResourceGraph(mapper meta.RESTMapper, src apiv1.ObjectID) (*v1alpha1.ResourceGraphResponse, error)

func SetupGraphReconciler

func SetupGraphReconciler(mgr manager.Manager) func(ctx context.Context) error

Types

type AdjacencyMap

type AdjacencyMap map[schema.GroupVersionKind]*Edge

type Edge

type Edge struct {
	Src        schema.GroupVersionKind
	Dst        schema.GroupVersionKind
	W          uint64
	Connection v1alpha1.ResourceConnectionSpec
	Forward    bool
}

type NamespaceSelector

type NamespaceSelector struct {
	// Boolean describing whether all namespaces are selected in contrast to a
	// list restricting them.
	Any bool `json:"any,omitempty"`
	// List of namespace names.
	MatchNames []string `json:"matchNames,omitempty"`
}

ref: https://github.com/coreos/prometheus-operator/blob/cc584ecfa08d2eb95ba9401f116e3a20bf71be8b/pkg/apis/monitoring/v1/types.go#L578 NamespaceSelector is a selector for selecting either all namespaces or a list of namespaces. +k8s:openapi-gen=true

type ObjectFinder

type ObjectFinder struct {
	Client client.Client
}

func (ObjectFinder) Get

func (ObjectFinder) List

func (finder ObjectFinder) List(src *unstructured.Unstructured, path []*Edge) ([]*unstructured.Unstructured, error)

func (ObjectFinder) ListConnectedObjectIDs

func (finder ObjectFinder) ListConnectedObjectIDs(src *unstructured.Unstructured, connections []v1alpha1.ResourceConnection) (map[apiv1.EdgeLabel]ksets.OID, error)

func (ObjectFinder) ListConnectedPartials

func (finder ObjectFinder) ListConnectedPartials(src *unstructured.Unstructured, edges AdjacencyMap) (map[schema.GroupVersionKind][]*metav1.PartialObjectMetadata, error)

func (ObjectFinder) ListConnectedResources

func (finder ObjectFinder) ListConnectedResources(src *unstructured.Unstructured, edges AdjacencyMap) (map[schema.GroupVersionKind][]*unstructured.Unstructured, error)

func (ObjectFinder) Locate

func (finder ObjectFinder) Locate(locator *v1alpha1.ObjectLocator, edgeList []v1alpha1.NamedEdge) (*unstructured.Unstructured, error)

func (ObjectFinder) ResourcesFor

func (finder ObjectFinder) ResourcesFor(src *unstructured.Unstructured, e *Edge) ([]*unstructured.Unstructured, error)

type ObjectGraph

type ObjectGraph struct {
	// contains filtered or unexported fields
}
func (g *ObjectGraph) Links(oid *apiv1.ObjectID, edgeLabel apiv1.EdgeLabel) (map[metav1.GroupKind][]apiv1.ObjectID, error)

func (*ObjectGraph) Update

func (g *ObjectGraph) Update(src apiv1.OID, connsPerLabel map[apiv1.EdgeLabel]ksets.OID)

type Reconciler

type Reconciler struct {
	client.Client
	R      apiv1.ResourceID
	Scheme *runtime.Scheme
}

Reconciler reconciles a Release object

func (*Reconciler) Reconcile

func (r *Reconciler) Reconcile(ctx context.Context, req reconcile.Request) (reconcile.Result, error)

func (*Reconciler) SetupWithManager

func (r *Reconciler) SetupWithManager(mgr manager.Manager) error

SetupWithManager sets up the controller with the Manager.

type ResourceRef

type ResourceRef struct {
	// Name is the name of resource being referenced
	Name string `json:"name"`
	// Namespace is the namespace of resource being referenced
	Namespace string `json:"namespace,omitempty"`
	// Kind is the type of resource being referenced
	Kind string `json:"kind,omitempty"`
	// APIGroup is the group for the resource being referenced
	APIGroup string `json:"apiGroup,omitempty"`
}

ResourceRef contains information that points to the resource being used

func ParseResourceRefs

func ParseResourceRefs(records [][]string) ([]ResourceRef, error)

Jump to

Keyboard shortcuts

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