validate

package
v1.17.1-rc.2 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const HelmValuesFileDefaultDataKey = "values.yaml"

HelmValuesFileDefaultDataKey is the default data key to use when spec.helm.valuesFileRefs.dataKey is not specified.

View Source
const OldAllowedRepoVersion = "0.1.0"

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

Variables

View Source
var InvalidSyncCode = "1061"

InvalidSyncCode is the code for an invalid declared RootSync/RepoSync.

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 *objects.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 *objects.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 *objects.Raw) status.MultiError

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

func GitSpec

func GitSpec(git *v1beta1.Git, rs client.Object) status.Error

GitSpec validates the git specification for any obvious problems.

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 HelmNSAndDeployNS added in v1.15.1

func HelmNSAndDeployNS(o client.Object) status.Error

HelmNSAndDeployNS reports that a RootSync has both spec.helm.namespace and spec.helm.deployNamespace set, even though they are mutually exclusive

func HelmSpec

func HelmSpec(helm *v1beta1.HelmBase, rs client.Object) status.Error

HelmSpec validates the Helm specification for any obvious problems.

func HelmValuesConfigMapMustBeImmutable added in v1.16.0

func HelmValuesConfigMapMustBeImmutable(o client.Object, name string) status.Error

HelmValuesConfigMapMustBeImmutable reports that a referenced ConfigMap from RSync spec.helm.valuesFileRefs is not immutable.

func HelmValuesFileDataKeyOrDefault added in v1.16.1

func HelmValuesFileDataKeyOrDefault(key string) string

HelmValuesFileDataKeyOrDefault returns the key or the default if the key is empty.

func HelmValuesMissingConfigMap added in v1.16.0

func HelmValuesMissingConfigMap(o client.Object, err error) status.Error

HelmValuesMissingConfigMap reports that an RSync is referencing a ConfigMap that doesn't exist.

func HelmValuesMissingConfigMapKey added in v1.16.0

func HelmValuesMissingConfigMapKey(o client.Object, name, key string) status.Error

HelmValuesMissingConfigMapKey reports that an RSync is missing spec.helm.valuesFileRefs.valuesFile

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 IllegalSecretRef

func IllegalSecretRef(o client.Object) status.Error

IllegalSecretRef reports that a RootSync/RepoSync declares an auth mode that doesn't allow SecretRefs does declare a SecretRef.

func InvalidAuthType

func InvalidAuthType(o client.Object) status.Error

InvalidAuthType reports that a RootSync/RepoSync doesn't use one of the known auth methods.

func InvalidGCPSAEmail

func InvalidGCPSAEmail(o client.Object) status.Error

InvalidGCPSAEmail reports that a RepoSync/RootSync Resource doesn't have the

correct gcp service account suffix.

func InvalidHelmAuthType

func InvalidHelmAuthType(o client.Object) status.Error

InvalidHelmAuthType reports that a RootSync/RepoSync doesn't use one of the known auth methods for Helm.

func InvalidOciAuthType

func InvalidOciAuthType(o client.Object) status.Error

InvalidOciAuthType reports that a RootSync/RepoSync doesn't use one of the known auth methods for OCI image.

func InvalidSourceType

func InvalidSourceType(o client.Object) status.Error

InvalidSourceType reports that a RootSync/RepoSync doesn't use one of the supported source types.

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.

func MissingGCPSAEmail

func MissingGCPSAEmail(o client.Object) status.Error

MissingGCPSAEmail reports that a RepoSync/RootSync resource declares an auth mode that requires a GCPServiceAccountEmail, but does not do so.

func MissingGitRepo

func MissingGitRepo(o client.Object) status.Error

MissingGitRepo reports that a RootSync/RepoSync doesn't declare the git repo it is supposed to connect to.

func MissingGitSpec

func MissingGitSpec(o client.Object) status.Error

MissingGitSpec reports that a RootSync/RepoSync doesn't declare the git spec when spec.sourceType is set to `git`.

func MissingHelmChart

func MissingHelmChart(o client.Object) status.Error

MissingHelmChart reports that a RootSync/RepoSync doesn't declare the Helm chart name it is supposed to rendering.

func MissingHelmRepo

func MissingHelmRepo(o client.Object) status.Error

MissingHelmRepo reports that a RootSync/RepoSync doesn't declare the Helm repository it is supposed to download chart from.

func MissingHelmSpec

func MissingHelmSpec(o client.Object) status.Error

MissingHelmSpec reports that a RootSync/RepoSync doesn't declare the Helm spec when spec.sourceType is set to `helm`.

func MissingHelmValuesFileRefsName added in v1.16.0

func MissingHelmValuesFileRefsName(o client.Object) status.Error

MissingHelmValuesFileRefsName reports that an RSync is missing spec.helm.valuesFileRefs.name

func MissingOciImage

func MissingOciImage(o client.Object) status.Error

MissingOciImage reports that a RootSync/RepoSync doesn't declare the OCI image it is supposed to connect to.

func MissingOciSpec

func MissingOciSpec(o client.Object) status.Error

MissingOciSpec reports that a RootSync/RepoSync doesn't declare the OCI spec when spec.sourceType is set to `oci`.

func MissingSecretRef

func MissingSecretRef(o client.Object) status.Error

MissingSecretRef reports that a RootSync/RepoSync declares an auth mode that requires a SecretRef, but does not do so.

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 NoOpProxy

func NoOpProxy(o client.Object) status.Error

NoOpProxy reports that a RootSync/RepoSync declares a proxy, but the declaration would do nothing.

func OciSpec

func OciSpec(oci *v1beta1.Oci, rs client.Object) status.Error

OciSpec validates the OCI specification for any obvious problems.

func RemovedCRDs

func RemovedCRDs(objs *objects.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 *objects.Raw) status.MultiError

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

func RepoSync

func RepoSync(obj ast.FileObject) status.Error

RepoSync checks if the given FileObject is a RepoSync and if so, verifies that its fields are valid.

func RepoSyncSpec added in v1.15.1

func RepoSyncSpec(sourceType string, git *v1beta1.Git, oci *v1beta1.Oci, helm *v1beta1.HelmRepoSync, rs client.Object) status.Error

RepoSyncSpec validates the Repo Sync source specification for any obvious problems.

func RootSync

func RootSync(obj ast.FileObject) status.Error

RootSync checks if the given FileObject is a RootSync and if so, verifies that its fields are valid.

func RootSyncSpec added in v1.15.1

func RootSyncSpec(sourceType string, git *v1beta1.Git, oci *v1beta1.Oci, helm *v1beta1.HelmRootSync, rs client.Object) status.Error

RootSyncSpec validates the Root Sync source specification for any obvious problems.

func SelfReconcile added in v1.15.1

func SelfReconcile(reconcilerName string) objects.ObjectVisitor

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

func SelfReconcileError added in v1.15.1

func SelfReconcileError(o client.Object) status.Error

SelfReconcileError reports that a RootSync/RepoSync reconciles itself.

func ValuesFileRefs added in v1.16.0

func ValuesFileRefs(ctx context.Context, cl client.Client, rs client.Object, valuesFileRefs []v1beta1.ValuesFileRef) status.Error

ValuesFileRefs checks that the ConfigMaps specified by valuesFileRefs exist, are immutable, and have the provided data key.

Types

This section is empty.

Jump to

Keyboard shortcuts

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