Documentation ¶
Index ¶
- Variables
- func ClusterRoleBindingSubjectNamesEqual(subjects ...string) func(o client.Object) error
- func ContainerByName(obj *appsv1.Deployment, containerName string) *corev1.Container
- func EvaluatePredicates(obj client.Object, predicates []Predicate) []error
- func HasDeletionTimestamp(o client.Object) error
- func MissingDeletionTimestamp(o client.Object) error
- func NotPendingDeletion(o client.Object) error
- func ObjectFoundPredicate(o client.Object) error
- func ValidateError(errs []v1beta1.ConfigSyncError, code, message string, ...) error
- func WrongTypeErr(got, want interface{}) error
- type Predicate
- func AllResourcesAreCurrent() Predicate
- func DeploymentContainerArgsContains(containerName, args string) Predicate
- func DeploymentContainerImageEquals(containerName, image string) Predicate
- func DeploymentContainerPullPolicyEquals(containerName string, policy corev1.PullPolicy) Predicate
- func DeploymentContainerResourcesAllEqual(scheme *runtime.Scheme, logger *testlogger.TestLogger, ...) Predicate
- func DeploymentContainerResourcesEqual(expectedSpec v1beta1.ContainerResourcesSpec) Predicate
- func DeploymentHasContainer(containerName string) Predicate
- func DeploymentHasEnvVar(containerName, key, value string) Predicate
- func DeploymentMissingContainer(containerName string) Predicate
- func DeploymentMissingEnvVar(containerName, key string) Predicate
- func GenerationEquals(generation int64) Predicate
- func GenerationNotEquals(generation int64) Predicate
- func HasAllAnnotationKeys(keys ...string) Predicate
- func HasAllNomosMetadata() Predicate
- func HasAnnotation(key, value string) Predicate
- func HasAnnotationKey(key string) Predicate
- func HasBeenManagedBy(scheme *runtime.Scheme, logger *testlogger.TestLogger, managers ...string) Predicate
- func HasConditionStatus(scheme *runtime.Scheme, conditionType string, ...) Predicate
- func HasExactlyAnnotationKeys(wantKeys ...string) Predicate
- func HasExactlyImage(containerName, expectImageName, expectImageTag, expectImageDigest string) Predicate
- func HasExactlyLabelKeys(wantKeys ...string) Predicate
- func HasFinalizer(name string) Predicate
- func HasGenerationAtLeast(minGeneration int64) Predicate
- func HasLabel(key, value string) Predicate
- func HasObservedLatestGeneration(scheme *runtime.Scheme) Predicate
- func IsManagedBy(scheme *runtime.Scheme, scope declared.Scope, syncName string) Predicate
- func IsNotManaged(scheme *runtime.Scheme) Predicate
- func MissingAnnotation(key string) Predicate
- func MissingFinalizer(name string) Predicate
- func MissingLabel(key string) Predicate
- func NoConfigSyncMetadata() Predicate
- func ObjectNotFoundPredicate(scheme *runtime.Scheme) Predicate
- func Or(logger *testlogger.TestLogger, predicates ...Predicate) Predicate
- func RepoSyncHasCondition(expected *v1beta1.RepoSyncCondition) Predicate
- func RepoSyncHasRenderingError(errCode, errMessage string) Predicate
- func RepoSyncHasSourceError(errCode, errMessage string) Predicate
- func RepoSyncHasSyncError(errCode, errMessage string) Predicate
- func ResourceGroupHasObjects(objects []client.Object) Predicate
- func ResourceGroupMissingObjects(objects []client.Object) Predicate
- func ResourceGroupStatusEquals(expected v1alpha1.ResourceGroupStatus) Predicate
- func ResourceVersionEquals(scheme *runtime.Scheme, expected string) Predicate
- func ResourceVersionNotEquals(scheme *runtime.Scheme, unexpected string) Predicate
- func RoleBindingHasName(expectedName string) Predicate
- func RootSyncHasCondition(expected *v1beta1.RootSyncCondition) Predicate
- func RootSyncHasNomosStatus(expectedCommit, expectedStatus string) Predicate
- func RootSyncHasObservedGenerationNoLessThan(generation int64) Predicate
- func RootSyncHasRenderingError(errCode, errMessage string) Predicate
- func RootSyncHasSourceError(errCode, errMessage string) Predicate
- func RootSyncHasSyncError(errCode, errMessage string) Predicate
- func RootSyncSpecEquals(expected v1beta1.RootSyncSpec) Predicate
- func RootSyncSpecOverrideEquals(expected *v1beta1.RootSyncOverrideSpec) Predicate
- func SecretHasKey(key, value string) Predicate
- func SecretMissingKey(key string) Predicate
- func StatusEquals(scheme *runtime.Scheme, expected status.Status) Predicate
- func WatchSyncPredicate() (Predicate, <-chan struct{})
Constants ¶
This section is empty.
Variables ¶
var ErrFailedPredicate = errors.New("failed predicate")
ErrFailedPredicate indicates the the object on the API server does not match the Predicate.
var ErrObjectNotFound = errors.New("object not found")
ErrObjectNotFound indicates that the caller passed a nil object, indicating the object was deleted or never existed.
var ErrWrongType = errors.New("wrong type")
ErrWrongType indicates that the caller passed an object of the incorrect type to the Predicate.
Functions ¶
func ClusterRoleBindingSubjectNamesEqual ¶ added in v1.17.0
ClusterRoleBindingSubjectNamesEqual checks that the ClusterRoleBinding has a list of subjects whose names match the specified list of names.
func ContainerByName ¶ added in v1.16.0
func ContainerByName(obj *appsv1.Deployment, containerName string) *corev1.Container
ContainerByName returns a copy of the container with the specified name, found in the specified Deployment.
func EvaluatePredicates ¶
EvaluatePredicates evaluates a list of predicates and returns any errors
func HasDeletionTimestamp ¶
HasDeletionTimestamp is a predicate that tests that an Object has a DeletionTimestamp.
func MissingDeletionTimestamp ¶
MissingDeletionTimestamp is a predicate that tests that an Object does NOT have a DeletionTimestamp.
func NotPendingDeletion ¶
NotPendingDeletion ensures o is not pending deletion.
Check this when the object could be scheduled for deletion, to avoid flaky behavior when we're ensuring we don't want something to be deleted.
func ObjectFoundPredicate ¶
ObjectFoundPredicate returns ErrObjectNotFound if the object is nil (not found).
func ValidateError ¶ added in v1.17.2
func ValidateError(errs []v1beta1.ConfigSyncError, code, message string, resources []v1beta1.ResourceRef) error
ValidateError returns true if the specified errors contain an error with the specified error code, (partial) message, and resources.
func WrongTypeErr ¶
func WrongTypeErr(got, want interface{}) error
WrongTypeErr reports that the passed type was not equivalent to the wanted type.
Types ¶
type Predicate ¶
Predicate evaluates a client.Object, returning an error if it fails validation. The object will be nil if the object was deleted or never existed.
func AllResourcesAreCurrent ¶
func AllResourcesAreCurrent() Predicate
AllResourcesAreCurrent ensures that the managed resources are all Current in the ResourceGroup CR.
func DeploymentContainerArgsContains ¶ added in v1.17.0
DeploymentContainerArgsContains verifies a container in reconciler deployment has the expected arg
func DeploymentContainerImageEquals ¶ added in v1.16.0
DeploymentContainerImageEquals returns a predicate that errors if the deployment does not have a container with the specified name and image.
func DeploymentContainerPullPolicyEquals ¶ added in v1.16.0
func DeploymentContainerPullPolicyEquals(containerName string, policy corev1.PullPolicy) Predicate
DeploymentContainerPullPolicyEquals returns a predicate that errors if the deployment does not have a container with the specified name and imagePullPolicy.
func DeploymentContainerResourcesAllEqual ¶ added in v1.17.0
func DeploymentContainerResourcesAllEqual(scheme *runtime.Scheme, logger *testlogger.TestLogger, expectedByName map[string]v1beta1.ContainerResourcesSpec) Predicate
DeploymentContainerResourcesAllEqual verifies all reconciler deployment containers have the expected resource requests and limits.
func DeploymentContainerResourcesEqual ¶ added in v1.17.0
func DeploymentContainerResourcesEqual(expectedSpec v1beta1.ContainerResourcesSpec) Predicate
DeploymentContainerResourcesEqual verifies a reconciler deployment container has the expected resource requests and limits.
func DeploymentHasContainer ¶ added in v1.16.0
DeploymentHasContainer check whether the deployment has the container with the specified name.
func DeploymentHasEnvVar ¶
DeploymentHasEnvVar check whether the deployment contains environment variable with specified name and value
func DeploymentMissingContainer ¶ added in v1.16.0
DeploymentMissingContainer check whether the deployment does not have the container with the specified name.
func DeploymentMissingEnvVar ¶
DeploymentMissingEnvVar check whether the deployment does not contain environment variable with specified name and value
func GenerationEquals ¶ added in v1.17.0
GenerationEquals checks that the object's generation equals the specified value.
func GenerationNotEquals ¶ added in v1.17.0
GenerationNotEquals checks that the object's Generation does not equal the specified value.
func HasAllAnnotationKeys ¶
HasAllAnnotationKeys returns a predicate that tests if an Object has the specified annotation keys.
func HasAllNomosMetadata ¶
func HasAllNomosMetadata() Predicate
HasAllNomosMetadata ensures that the object contains the expected nomos labels and annotations.
func HasAnnotation ¶
HasAnnotation returns a predicate that tests if an Object has the specified annotation key/value pair.
func HasAnnotationKey ¶
HasAnnotationKey returns a predicate that tests if an Object has the specified annotation key.
func HasBeenManagedBy ¶ added in v1.19.0
func HasBeenManagedBy(scheme *runtime.Scheme, logger *testlogger.TestLogger, managers ...string) Predicate
HasBeenManagedBy validates that an object has been managed by all of the specified managers, one at a time.
func HasConditionStatus ¶ added in v1.19.0
func HasConditionStatus(scheme *runtime.Scheme, conditionType string, expectedStatus corev1.ConditionStatus) Predicate
HasConditionStatus returns a Predicate that errors if the object does not have the specified condition or does but the status does not match the expected status.
func HasExactlyAnnotationKeys ¶
HasExactlyAnnotationKeys ensures the Object has exactly the passed set of annotations, ignoring values.
func HasExactlyImage ¶
func HasExactlyImage(containerName, expectImageName, expectImageTag, expectImageDigest string) Predicate
HasExactlyImage ensures a container has the expected image.
func HasExactlyLabelKeys ¶
HasExactlyLabelKeys ensures the Object has exactly the passed set of labels, ignoring values.
func HasFinalizer ¶
HasFinalizer returns a predicate that tests that an Object has the specified finalizer.
func HasGenerationAtLeast ¶
HasGenerationAtLeast checks that the object's Generation is greater than or equal to the specified value.
func HasLabel ¶
HasLabel returns a predicate that tests if an Object has the specified label key/value pair.
func HasObservedLatestGeneration ¶ added in v1.16.0
HasObservedLatestGeneration returns an error if the object status.observedGeneration does not equal the metadata.generation.
func IsManagedBy ¶
IsManagedBy checks that the object is managed by configsync, has the expected resource manager, and has a valid resource-id. Use diff.IsManager if you just need a boolean without errors.
func IsNotManaged ¶
IsNotManaged checks that the object is NOT managed by configsync. Use differ.ManagedByConfigSync if you just need a boolean without errors.
func MissingAnnotation ¶
MissingAnnotation returns a predicate that tests that an object does not have a specified annotation.
func MissingFinalizer ¶
MissingFinalizer returns a predicate that tests that an Object does NOT have the specified finalizer.
func MissingLabel ¶
MissingLabel returns a predicate that tests that an object does not have a specified label.
func NoConfigSyncMetadata ¶
func NoConfigSyncMetadata() Predicate
NoConfigSyncMetadata ensures that the object doesn't contain configsync labels and annotations.
func ObjectNotFoundPredicate ¶
ObjectNotFoundPredicate returns an error unless the object is nil (not found).
func Or ¶ added in v1.19.0
func Or(logger *testlogger.TestLogger, predicates ...Predicate) Predicate
Or returns a Predicate that errors only if all of the Predicates errored. If any one of the specified Predicates succeeds, the Or Predicate succeeds. Logs the index of the first successful predicates.
func RepoSyncHasCondition ¶ added in v1.17.0
func RepoSyncHasCondition(expected *v1beta1.RepoSyncCondition) Predicate
RepoSyncHasCondition returns a Predicate that errors if the RepoSync does not have the specified RepoSyncCondition. Fields such as timestamps are ignored.
func RepoSyncHasRenderingError ¶
RepoSyncHasRenderingError returns an error if the RootSync does not have the specified Rendering error code and (optional, partial) message.
func RepoSyncHasSourceError ¶
RepoSyncHasSourceError returns an error if the RootSync does not have the specified Source error code and (optional, partial) message.
func RepoSyncHasSyncError ¶
RepoSyncHasSyncError returns an error if the RootSync does not have the specified Sync error code and (optional, partial) message.
func ResourceGroupHasObjects ¶ added in v1.17.0
ResourceGroupHasObjects checks whether the objects are in the ResourceGroup's inventory.
func ResourceGroupMissingObjects ¶ added in v1.17.0
ResourceGroupMissingObjects checks whether the objects are NOT in the ResourceGroup's inventory.
func ResourceGroupStatusEquals ¶ added in v1.17.0
func ResourceGroupStatusEquals(expected v1alpha1.ResourceGroupStatus) Predicate
ResourceGroupStatusEquals checks that the RootSync's spec.override matches the specified RootSyncOverrideSpec.
func ResourceVersionEquals ¶
ResourceVersionEquals checks that the object's ResourceVersion matches the specified value.
func ResourceVersionNotEquals ¶
ResourceVersionNotEquals checks that the object's ResourceVersion does NOT match specified value.
func RoleBindingHasName ¶
RoleBindingHasName will check the Rolebindings name and compare it with expected value
func RootSyncHasCondition ¶ added in v1.16.0
func RootSyncHasCondition(expected *v1beta1.RootSyncCondition) Predicate
RootSyncHasCondition returns a Predicate that errors if the RootSync does not have the specified RootSyncCondition. Fields such as timestamps are ignored.
func RootSyncHasNomosStatus ¶ added in v1.19.0
RootSyncHasNomosStatus returns an error if the RootSync does not have the specified commit or status according to `nomos status` (RootRepoStatus).
func RootSyncHasObservedGenerationNoLessThan ¶
RootSyncHasObservedGenerationNoLessThan returns an error if the RootSync has the observedGeneration less than the expected generation.
func RootSyncHasRenderingError ¶
RootSyncHasRenderingError returns an error if the RootSync does not have the specified Rendering error code and (optional, partial) message.
func RootSyncHasSourceError ¶
RootSyncHasSourceError returns an error if the RootSync does not have the specified Source error code and (optional, partial) message.
func RootSyncHasSyncError ¶
RootSyncHasSyncError returns an error if the RootSync does not have the specified Sync error code and (optional, partial) message.
func RootSyncSpecEquals ¶ added in v1.19.0
func RootSyncSpecEquals(expected v1beta1.RootSyncSpec) Predicate
RootSyncSpecEquals returns a Predicate that errors if the RootSync does not have the specified RootSyncCondition. Fields such as timestamps are ignored.
func RootSyncSpecOverrideEquals ¶ added in v1.17.0
func RootSyncSpecOverrideEquals(expected *v1beta1.RootSyncOverrideSpec) Predicate
RootSyncSpecOverrideEquals checks that the RootSync's spec.override matches the specified RootSyncOverrideSpec.
func SecretHasKey ¶
SecretHasKey checks that the secret contains key with value
func SecretMissingKey ¶
SecretMissingKey checks that the secret does not contain key
func StatusEquals ¶
StatusEquals checks that the object's computed status matches the specified status.
func WatchSyncPredicate ¶
func WatchSyncPredicate() (Predicate, <-chan struct{})
WatchSyncPredicate returns a predicate and a channel. The channel will be closed when the predicate is first called. Use this to block until WatchObject has completed its first LIST call. This will help avoid missed events when WatchObject is run asynchronously.