validate

package
v1.23.1-rc.2 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const OldAllowedRepoVersion = "0.1.0"

OldAllowedRepoVersion is the old (but still supported) Repo.Spec.Version.

Variables

View Source
var SelfReconcileErrorCode = "1069"

SelfReconcileErrorCode is the code for an RootSync/RepoSync that reconciles itself.

Functions

func Annotations

func Annotations(obj ast.FileObject) status.Error

Annotations verifies that the given object does not have any invalid annotations.

func CRDName

func CRDName(obj ast.FileObject) status.Error

CRDName returns an error if the CRD's name does not match the Kubernetes specification: https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/

func ClusterSelectorsForHierarchical

func ClusterSelectorsForHierarchical(objs *fileobjects.Raw) status.MultiError

ClusterSelectorsForHierarchical verifies that all ClusterSelectors have a unique name and are under the correct top-level directory. It also verifies that no invalid FileObjects are cluster-selected.

func ClusterSelectorsForUnstructured

func ClusterSelectorsForUnstructured(objs *fileobjects.Raw) status.MultiError

ClusterSelectorsForUnstructured verifies that all ClusterSelectors have a unique name. It also verifies that no invalid FileObjects are cluster-selected.

func DeprecatedKinds

func DeprecatedKinds(obj ast.FileObject) status.Error

DeprecatedKinds verifies that the given FileObject is not deprecated.

func Directory

func Directory(obj ast.FileObject) status.Error

Directory verifies that the given FileObject is placed in a valid directory according to the following rules: - if the object is a Namespace, the directory must match its name - if the object has a metadata namespace, the directory must match it

func DisallowedFields

func DisallowedFields(objs *fileobjects.Raw) status.MultiError

DisallowedFields verifies if the given Raw objects contain any fields which are not allowed to be declared in Git.

func HNCLabels

func HNCLabels(obj ast.FileObject) status.Error

HNCLabels verifies that the given object does not have any HNC depth labels.

func HasDepthSuffix

func HasDepthSuffix(s string) bool

HasDepthSuffix returns true if the string ends with ".tree.hnc.x-k8s.io/depth".

func IllegalCRD

func IllegalCRD(obj ast.FileObject) status.Error

IllegalCRD returns an error if the given FileObject is a CRD of a Config Sync type.

func IllegalKindsForHierarchical

func IllegalKindsForHierarchical(obj ast.FileObject) status.Error

IllegalKindsForHierarchical verifies that the given FileObject is legal for a structured hierarchical repo.

func IllegalKindsForUnstructured

func IllegalKindsForUnstructured(obj ast.FileObject) status.Error

IllegalKindsForUnstructured verifies that the given FileObject is legal for an unstructured repo.

func IsInvalidAnnotation

func IsInvalidAnnotation(k string) bool

IsInvalidAnnotation returns true if the annotation cannot be declared by users.

func IsInvalidLabel

func IsInvalidLabel(k string) bool

IsInvalidLabel returns true if the label cannot be declared by users.

func Labels

func Labels(obj ast.FileObject) status.Error

Labels verifies that the given object does not have any invalid labels.

func ManagementAnnotation

func ManagementAnnotation(obj ast.FileObject) status.Error

ManagementAnnotation returns an Error if the user-specified management annotation is invalid. The only valid value in the source is `disabled`.

func Name

func Name(obj ast.FileObject) status.Error

Name verifies that the given FileObject has a valid name according to the following rules: - the object can not have an empty name - if the object is related to RBAC, its name must be a valid path segment - otherwise the object's name must be a valid DNS1123 subdomain

func Namespace

func Namespace(obj ast.FileObject) status.Error

Namespace verifies that the given FileObject has a valid namespace according to the following rules: - if the object is a Namespace, it must not be `config-management-system` - if the object has a metadata namespace, it must be a valid k8s namespace

func RemovedCRDs

func RemovedCRDs(objs *fileobjects.Raw) status.MultiError

RemovedCRDs verifies that the Raw objects do not remove any CRDs that still have CRs using them.

func Repo

func Repo(objs *fileobjects.Raw) status.MultiError

Repo verifies that there is exactly one Repo object and that it has the correct version.

func SelfReconcile

func SelfReconcile(reconcilerName string) fileobjects.ObjectVisitor

SelfReconcile checks if the given RootSync or RepoSync is the one that configures the reconciler.

func SelfReconcileError

func SelfReconcileError(o client.Object) status.Error

SelfReconcileError reports that a RootSync/RepoSync reconciles itself.

Types

This section is empty.

Jump to

Keyboard shortcuts

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