Help us shape the future of Go! Take the 2026 Go Developer Survey

fileobjects

package
v1.24.2 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GroupMatcher added in v1.24.0

type GroupMatcher struct {
	Groups []string
}

GroupMatcher matches objects based on their group.

func (*GroupMatcher) Matches added in v1.24.0

func (gm *GroupMatcher) Matches(gvk schema.GroupVersionKind) bool

Matches returns true if the object's group is one of the allowed groups.

type MatchAll added in v1.24.0

type MatchAll struct{}

MatchAll matches all objects.

func (*MatchAll) Matches added in v1.24.0

func (m *MatchAll) Matches(_ schema.GroupVersionKind) bool

Matches returns true for all objects.

type ObjectMatcher added in v1.24.0

type ObjectMatcher interface {
	Matches(schema.GroupVersionKind) bool
}

ObjectMatcher matches objects based on their GroupVersionKind.

type ObjectVisitor

type ObjectVisitor func(obj ast.FileObject) status.Error

ObjectVisitor is a function that validates a single FileObject at a time.

type Raw

type Raw struct {
	ClusterName  string
	Scope        declared.Scope
	SyncName     string
	PolicyDir    cmpath.Relative
	Objects      []ast.FileObject
	PreviousCRDs []*apiextensionsv1.CustomResourceDefinition
	BuildScoper  utildiscovery.BuildScoperFunc
	Converter    *declared.ValueConverter
	Scheme       *runtime.Scheme
	// AllowAPICall indicates whether the hydration process can send k8s API
	// calls. Currently, only dynamic NamespaceSelector requires talking to
	// k8s-api-server.
	AllowAPICall bool
	// DynamicNSSelectorEnabled indicates whether the dynamic mode of
	// NamespaceSelector is enabled.
	DynamicNSSelectorEnabled bool
	// NSControllerState caches the NamespaceSelectors and selected Namespaces
	// in the namespace controller.
	NSControllerState *namespacecontroller.State
	// WebhookEnabled indicates whether Webhook configuration is enabled
	WebhookEnabled bool
	// AllowUnknownKindMatcher indicates which object kinds should ignore
	// scoper errors for when getting the object scope from the API server.
	AllowUnknownKindMatcher ObjectMatcher
}

Raw contains a collection of FileObjects that have just been parsed from a Git repo for a cluster.

func (*Raw) Scoped

func (r *Raw) Scoped() (*Scoped, status.MultiError)

Scoped builds a Scoped collection of objects from the Raw objects.

type RawVisitor

type RawVisitor func(r *Raw) status.MultiError

RawVisitor is a function that validates or hydrates Raw objects.

func VisitAllRaw

func VisitAllRaw(visit ObjectVisitor) RawVisitor

VisitAllRaw returns a RawVisitor which will call the given ObjectVisitor on every FileObject in the Raw objects.

type Scoped

type Scoped struct {
	Cluster   []ast.FileObject
	Namespace []ast.FileObject
	Unknown   []ast.FileObject
	Scope     declared.Scope
	SyncName  string
	// AllowAPICall indicates whether the hydration process can send k8s API
	// calls. Currently, only dynamic NamespaceSelector requires talking to
	// k8s-api-server.
	AllowAPICall bool
	// DynamicNSSelectorEnabled indicates whether the dynamic mode of
	// NamespaceSelector is enabled.
	DynamicNSSelectorEnabled bool
	// NSControllerState caches the NamespaceSelectors and selected Namespaces
	// in the namespace controller.
	NSControllerState *namespacecontroller.State
}

Scoped contains a collection of FileObjects that are organized based upon if they are cluster-scoped or namespace-scoped.

func (*Scoped) Objects

func (s *Scoped) Objects() []ast.FileObject

Objects returns all FileObjects in the Scoped collection.

type ScopedVisitor

type ScopedVisitor func(s *Scoped) status.MultiError

ScopedVisitor is a function that validates or hydrates Scoped objects.

func VisitClusterScoped

func VisitClusterScoped(validate ObjectVisitor) ScopedVisitor

VisitClusterScoped returns a ScopedVisitor which will call the given ObjectVisitor on all cluster-scoped FileObjects in the Scoped objects.

func VisitNamespaceScoped

func VisitNamespaceScoped(validate ObjectVisitor) ScopedVisitor

VisitNamespaceScoped returns a ScopedVisitor which will call the given ObjectVisitor on all namespace-scoped FileObjects in the Scoped objects.

type Tree

type Tree struct {
	Repo               ast.FileObject
	HierarchyConfigs   []ast.FileObject
	NamespaceSelectors map[string]ast.FileObject
	Cluster            []ast.FileObject
	Tree               *ast.TreeNode
}

Tree contains a collection of FileObjects that are organized based upon the structure of a hierarchical repo. This includes system-level objects like HierarchyConfigs as well as a hierarchical tree of namespaces and namespace- scoped objects.

func BuildTree

func BuildTree(scoped *Scoped) (*Tree, status.MultiError)

BuildTree builds a Tree collection of objects from the given Scoped objects.

func (*Tree) Objects

func (t *Tree) Objects() []ast.FileObject

Objects returns all FileObjects in the Tree collection.

type TreeVisitor

type TreeVisitor func(t *Tree) status.MultiError

TreeVisitor is a function that validates or hydrates Raw objects.

Jump to

Keyboard shortcuts

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