api: add custom validation for v1.Duration types

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
This commit is contained in:
Stefan Prodan 2022-09-20 12:08:08 +03:00
parent d0b0c69269
commit 456b48a909
No known key found for this signature in database
GPG Key ID: 3299AEB0E4085BAF
2 changed files with 3 additions and 0 deletions

View File

@ -44,6 +44,8 @@ type ImageUpdateAutomationSpec struct {
// Interval gives an lower bound for how often the automation
// run should be attempted.
// +kubebuilder:validation:Type=string
// +kubebuilder:validation:Pattern="^([0-9]+(\\.[0-9]+)?(ms|s|m|h))+$"
// +required
Interval metav1.Duration `json:"interval"`

View File

@ -648,6 +648,7 @@ spec:
interval:
description: Interval gives an lower bound for how often the automation
run should be attempted.
pattern: ^([0-9]+(\.[0-9]+)?(ms|s|m|h))+$
type: string
sourceRef:
description: SourceRef refers to the resource giving access details