Documentation
¶
Index ¶
- Constants
- type ArcAttrs
- type ArcSet
- type ArcSetWithData
- type ArcToID
- type ArcType
- type ArcTypeSet
- type Error
- type ErrorCode
- type GraphInspector
- type Namespaces
- type ObjectGraph
- func (g *ObjectGraph[VID, AT, VD, AD]) DeleteVertex(ctx context.Context, vid VID) bool
- func (g *ObjectGraph[VID, AT, VD, AD]) InboundArcsFor(vid VID) ArcSet[VID, AT]
- func (g *ObjectGraph[VID, AT, VD, AD]) OutboundArcsFor(vid VID) ArcSetWithData[VID, AT, AD]
- func (g *ObjectGraph[VID, AT, VD, AD]) SetVertex(ctx context.Context, vid VID, vd VD, arcs ArcSetWithData[VID, AT, AD]) SetVertexResult
- func (g *ObjectGraph[VID, AT, VD, AD]) VertexData(vid VID) (VD, bool)
- type ObjectGraphObserver
- type ObjectGraphOpts
- type Opts
- type QueryExclude
- type QueryInclude
- type QueryIncludeObject
- type SetVertexResult
- type VertexData
- type VertexID
- type Warning
- type WarningAttrs
- type WatchGraph
Constants ¶
const ( InfSyncFailedWarnType = "INFORMER_SYNC_FAILED" DiscoFailedWarnType = "DISCOVERY_FAILED" NamespaceListFailedWarnType = "NAMESPACE_LIST_FAILED" ObjectProcessingFailedWarnType = "OBJECT_PROCESSING_FAILED" InternalErrorWarnType = "INTERNAL_ERROR" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArcAttrs ¶ added in v18.2.0
type ArcSet ¶ added in v18.2.0
type ArcSet[VID, AT comparable] map[ArcToID[VID, AT]]struct{}
ArcSet is a set of arcs.
type ArcSetWithData ¶ added in v18.2.0
type ArcSetWithData[VID, AT comparable, AD any] map[ArcToID[VID, AT]]AD
ArcSetWithData is a set of arcs with data.
type ArcToID ¶
type ArcToID[VID, AT comparable] struct { To VID ArcType AT }
type ArcType ¶
type ArcType byte // enough bits to represent each arc type as an individual bit.
func ParseArcTypeStr ¶ added in v18.3.0
type ArcTypeSet ¶ added in v18.3.0
type ArcTypeSet ArcType
ArcTypeSet is a set of arc types.
func (*ArcTypeSet) Add ¶ added in v18.3.0
func (s *ArcTypeSet) Add(v ArcType)
func (*ArcTypeSet) Contains ¶ added in v18.3.0
func (s *ArcTypeSet) Contains(v ArcType) bool
func (*ArcTypeSet) IsEmpty ¶ added in v18.3.0
func (s *ArcTypeSet) IsEmpty() bool
func (*ArcTypeSet) Remove ¶ added in v18.3.0
func (s *ArcTypeSet) Remove(v ArcType)
type GraphInspector ¶ added in v18.2.0
type GraphInspector[VID, AT comparable, VD, AD any] interface { InboundArcsFor(VID) ArcSet[VID, AT] OutboundArcsFor(VID) ArcSetWithData[VID, AT, AD] VertexData(VID) (VD, bool) }
type Namespaces ¶
type Namespaces struct { Names sets.Set[string] LabelSelector string FieldSelector string ObjectSelectorExpression cel.Program // can be nil }
func (*Namespaces) All ¶
func (n *Namespaces) All() bool
All checks if all namespaces should be watched.
type ObjectGraph ¶
type ObjectGraph[VID, AT comparable, VD, AD any] struct { // contains filtered or unexported fields }
func NewObjectGraph ¶
func NewObjectGraph[VID, AT comparable, VD, AD any](opts ObjectGraphOpts[VID, AT, VD, AD]) *ObjectGraph[VID, AT, VD, AD]
func (*ObjectGraph[VID, AT, VD, AD]) DeleteVertex ¶
func (g *ObjectGraph[VID, AT, VD, AD]) DeleteVertex(ctx context.Context, vid VID) bool
DeleteVertex deletes the vertex with the specified VID. All outbound arcs are also deleted.
func (*ObjectGraph[VID, AT, VD, AD]) InboundArcsFor ¶ added in v18.2.0
func (g *ObjectGraph[VID, AT, VD, AD]) InboundArcsFor(vid VID) ArcSet[VID, AT]
InboundArcsFor returns the set of arcs that have vid as their destination.
func (*ObjectGraph[VID, AT, VD, AD]) OutboundArcsFor ¶ added in v18.2.0
func (g *ObjectGraph[VID, AT, VD, AD]) OutboundArcsFor(vid VID) ArcSetWithData[VID, AT, AD]
func (*ObjectGraph[VID, AT, VD, AD]) SetVertex ¶
func (g *ObjectGraph[VID, AT, VD, AD]) SetVertex(ctx context.Context, vid VID, vd VD, arcs ArcSetWithData[VID, AT, AD]) SetVertexResult
SetVertex sets a vertex in the graph declaratively: - replaces the existing vertex or adds a new one with the specified VID. - replaces all outbound arcs of that vertex with the provided arcs. arcs may be nil. NOTE: this function takes ownership of the arcs object. Do not use it after passing to this function.
func (*ObjectGraph[VID, AT, VD, AD]) VertexData ¶ added in v18.2.0
func (g *ObjectGraph[VID, AT, VD, AD]) VertexData(vid VID) (VD, bool)
type ObjectGraphObserver ¶ added in v18.2.0
type ObjectGraphObserver[VID, AT comparable, VD, AD any] interface { OnSetVertex(context.Context, GraphInspector[VID, AT, VD, AD], VID, VD) OnDeleteVertex(context.Context, GraphInspector[VID, AT, VD, AD], VID) OnSetArc(ctx context.Context, insp GraphInspector[VID, AT, VD, AD], from VID, to ArcToID[VID, AT], data AD) OnDeleteArc(ctx context.Context, insp GraphInspector[VID, AT, VD, AD], from VID, to ArcToID[VID, AT]) }
type ObjectGraphOpts ¶
type ObjectGraphOpts[VID, AT comparable, VD, AD any] struct { IsVertexDataEqual func(a, b VD) bool IsArcDataEqual func(a, b AD) bool Observer ObjectGraphObserver[VID, AT, VD, AD] }
type Opts ¶
type Opts struct { Log *slog.Logger Queries []any // Elements are QueryInclude or QueryExclude Namespaces Namespaces DiscoClient discovery.AggregatedDiscoveryInterface Client dynamic.Interface OnWarning func(Warning) ObjectToEvalVars func(*unstructured.Unstructured, schema.GroupVersionResource) map[string]any Graph *ObjectGraph[VertexID, ArcType, VertexData, ArcAttrs] }
type QueryExclude ¶
type QueryInclude ¶
type QueryInclude struct { ResourceSelectorExpression cel.Program // never nil Object QueryIncludeObject }
type QueryIncludeObject ¶
type QueryIncludeObject struct { LabelSelector string FieldSelector string ObjectSelectorExpression cel.Program // can be nil JSONPath *jsonpath.JSONPath // can be nil }
QueryIncludeObject holds config for object filtering.
type SetVertexResult ¶ added in v18.2.0
type SetVertexResult byte
const ( // VertexNoop - no action was taken. Vertex exists and the data is the same. VertexNoop SetVertexResult = iota // VertexAdded - a new vertex was added. VertexAdded // VertexUpdated - vertex exists but data was updated. VertexUpdated )
type VertexData ¶
type Warning ¶
type Warning struct { Type string Message string Attributes WarningAttrs }
func NewNamespaceListFailedWarning ¶ added in v18.2.0
func NewObjectProcessingWarning ¶
func NewObjectProcessingWarning(gvr schema.GroupVersionResource, namespace, name, message string) Warning
type WarningAttrs ¶ added in v18.2.0
type WarningAttrs struct { Group string `json:"g,omitempty"` Version string `json:"v,omitempty"` Resource string `json:"r,omitempty"` Namespace string `json:"ns,omitempty"` Name string `json:"n,omitempty"` }
WarningAttrs holds attributes for all warning types. All fields must be marked omitempty because different warnings have different fields set.
func (WarningAttrs) IsZero ¶ added in v18.2.0
func (a WarningAttrs) IsZero() bool
type WatchGraph ¶
type WatchGraph struct {
// contains filtered or unexported fields
}
func New ¶
func New(opts Opts) *WatchGraph
Source Files
¶
- discovery.go
- error.go
- namespaces.go
- obj2vertex.go
- obj2vertex_arc.go
- obj2vertex_arc_cluster_role_binding.go
- obj2vertex_arc_container.go
- obj2vertex_arc_cron_job.go
- obj2vertex_arc_csi_storage_capacity.go
- obj2vertex_arc_daemon_set.go
- obj2vertex_arc_deployment.go
- obj2vertex_arc_env_from_source.go
- obj2vertex_arc_env_var.go
- obj2vertex_arc_ephemeral_container.go
- obj2vertex_arc_event.go
- obj2vertex_arc_fluxcd_kustomize_controller_kustomization.go
- obj2vertex_arc_fluxcd_source_controller_bucket.go
- obj2vertex_arc_fluxcd_source_controller_git_repository.go
- obj2vertex_arc_fluxcd_source_controller_helm_chart.go
- obj2vertex_arc_fluxcd_source_controller_helm_repository.go
- obj2vertex_arc_fluxcd_source_controller_oci_repository.go
- obj2vertex_arc_gateway.go
- obj2vertex_arc_gateway_grpc_route.go
- obj2vertex_arc_gateway_http_route.go
- obj2vertex_arc_gateway_parent_ref.go
- obj2vertex_arc_horizontal_pod_autoscaler.go
- obj2vertex_arc_ingress.go
- obj2vertex_arc_job.go
- obj2vertex_arc_owner_ref.go
- obj2vertex_arc_persistent_volume.go
- obj2vertex_arc_persistent_volume_claim.go
- obj2vertex_arc_pod.go
- obj2vertex_arc_pod_spec.go
- obj2vertex_arc_replica_set.go
- obj2vertex_arc_replication_controller.go
- obj2vertex_arc_role_binding.go
- obj2vertex_arc_service_account.go
- obj2vertex_arc_stateful_set.go
- obj2vertex_arc_volume.go
- obj2vertex_arc_volume_attachment.go
- obj2vertex_data.go
- object_graph.go
- resource_event_handler.go
- warning.go
- watch_graph.go