Skip to content

Commit

Permalink
Merge pull request #420 from fluxcd/api-validate-duration
Browse files Browse the repository at this point in the history
api: add custom validation for v1.Duration types
  • Loading branch information
stefanprodan authored Sep 20, 2022
2 parents 97bcaf5 + b225c77 commit 0545fa9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions api/v1beta1/provider_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ type ProviderSpec struct {
Address string `json:"address,omitempty"`

// Timeout for sending alerts to the provider.
// +kubebuilder:validation:Type=string
// +kubebuilder:validation:Pattern="^([0-9]+(\\.[0-9]+)?(ms|s|m))+$"
// +optional
Timeout *metav1.Duration `json:"timeout,omitempty"`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ spec:
type: boolean
timeout:
description: Timeout for sending alerts to the provider.
pattern: ^([0-9]+(\.[0-9]+)?(ms|s|m))+$
type: string
type:
description: Type of provider
Expand Down

0 comments on commit 0545fa9

Please sign in to comment.