Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Hierarchical ¶
func Hierarchical(objs []ast.FileObject, opts Options) ([]ast.FileObject, status.MultiError)
Hierarchical validates and hydrates the given FileObjects from a structured, hierarchical repo.
func Unstructured ¶
func Unstructured(objs []ast.FileObject, opts Options) ([]ast.FileObject, status.MultiError)
Unstructured validates and hydrates the given FileObjects from an unstructured repo.
Types ¶
type Options ¶
type Options struct { // ClusterName is the spec.clusterName of the cluster's ConfigManagement. This // is used when hydrating cluster selectors. ClusterName string // PolicyDir is the relative path of the root policy directory within the // repo. PolicyDir cmpath.Relative // PreviousCRDs is a list of the CRDs that were declared in the previous set // of FileObjects that were validated. This is used to validate that we only // remove a CRD if all of its CRs are gone as well. PreviousCRDs []*v1beta1.CustomResourceDefinition // BuildScoper is a function that builds a Scoper to identify which objects // are cluster-scoped or namespace-scoped. BuildScoper discovery.BuildScoperFunc // Converter is used to encode the declared fields of each object into an // annotation on that object so that the validating admission webhook can // prevent those fields from being changed. Converter *declared.ValueConverter // AllowUnknownKinds is a flag to determine if we should throw an error or // proceed when the Scoper is unable to determine the scope of an object // kind. We only set this to true if a tool is running in offline mode (eg we // are running nomos vet without contacting the API server). AllowUnknownKinds bool // DefaultNamespace is the namespace to assign to namespace-scoped objects // which do not specify a namespace in an unstructured repo. Objects in a // hierarchical repo are assigned to the namespace that matches their // directory. DefaultNamespace string // IsNamespaceReconciler is a flag to indicate if the caller is a namespace // reconciler which adds some additional validation logic. IsNamespaceReconciler bool // Visitors is a list of optional visitor functions which can be used to // inject additional validation or hydration steps on the final objects. Visitors []VisitorFunc }
Options contains the various pieces of information needed by different steps in the validation and hydration process.
type VisitorFunc ¶
type VisitorFunc func(objs []ast.FileObject) ([]ast.FileObject, status.MultiError)
VisitorFunc is a function that validates and/or hydrates the given set of FileObjects. It enables callers to inject extra validation and hydration steps as needed.
Click to show internal directories.
Click to hide internal directories.