Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: apply duration validation to all resync periods #1505

Merged
merged 5 commits into from Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions api/v1beta1/grafanadashboard_types.go
Expand Up @@ -94,6 +94,10 @@ type GrafanaDashboardSpec struct {

// how often the dashboard is refreshed, defaults to 5m if not set
// +optional
// +kubebuilder:validation:Type=string
// +kubebuilder:validation:Format=duration
// +kubebuilder:validation:Pattern="^([0-9]+(\\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$"
// +kubebuilder:default="5m"
ResyncPeriod string `json:"resyncPeriod,omitempty"`

// maps required data sources to existing ones
Expand Down
4 changes: 4 additions & 0 deletions api/v1beta1/grafanadatasource_types.go
Expand Up @@ -75,6 +75,10 @@ type GrafanaDatasourceSpec struct {

// how often the datasource is refreshed, defaults to 5m if not set
// +optional
// +kubebuilder:validation:Type=string
// +kubebuilder:validation:Format=duration
// +kubebuilder:validation:Pattern="^([0-9]+(\\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$"
// +kubebuilder:default="5m"
ResyncPeriod string `json:"resyncPeriod,omitempty"`

// allow to import this resources from an operator in a different namespace
Expand Down
4 changes: 4 additions & 0 deletions api/v1beta1/grafanafolder_types.go
Expand Up @@ -45,6 +45,10 @@ type GrafanaFolderSpec struct {

// how often the folder is synced, defaults to 5m if not set
// +optional
// +kubebuilder:validation:Type=string
// +kubebuilder:validation:Format=duration
// +kubebuilder:validation:Pattern="^([0-9]+(\\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$"
// +kubebuilder:default="5m"
ResyncPeriod string `json:"resyncPeriod,omitempty"`
}

Expand Down
Expand Up @@ -210,7 +210,7 @@ metadata:
capabilities: Basic Install
categories: Monitoring
containerImage: ghcr.io/grafana/grafana-operator@sha256:97561cef949b58f55ec67d133c02ac205e2ec3fb77388aeb868dacfcebad0752
createdAt: "2024-04-19T08:44:59Z"
createdAt: "2024-04-23T12:57:39Z"
description: Deploys and manages Grafana instances, dashboards and data sources
operators.operatorframework.io/builder: operator-sdk-v1.32.0
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
Expand Down
Expand Up @@ -202,6 +202,9 @@ spec:
type: object
type: array
resyncPeriod:
default: 5m
format: duration
pattern: ^([0-9]+(\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$
type: string
url:
type: string
Expand Down
Expand Up @@ -110,6 +110,9 @@ spec:
type: object
type: array
resyncPeriod:
default: 5m
format: duration
pattern: ^([0-9]+(\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$
type: string
valuesFrom:
items:
Expand Down
Expand Up @@ -62,6 +62,9 @@ spec:
permissions:
type: string
resyncPeriod:
default: 5m
format: duration
pattern: ^([0-9]+(\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$
type: string
title:
type: string
Expand Down
Expand Up @@ -202,6 +202,9 @@ spec:
type: object
type: array
resyncPeriod:
default: 5m
format: duration
pattern: ^([0-9]+(\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$
type: string
url:
type: string
Expand Down
Expand Up @@ -110,6 +110,9 @@ spec:
type: object
type: array
resyncPeriod:
default: 5m
format: duration
pattern: ^([0-9]+(\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$
type: string
valuesFrom:
items:
Expand Down
Expand Up @@ -62,6 +62,9 @@ spec:
permissions:
type: string
resyncPeriod:
default: 5m
format: duration
pattern: ^([0-9]+(\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$
type: string
title:
type: string
Expand Down
Expand Up @@ -202,6 +202,9 @@ spec:
type: object
type: array
resyncPeriod:
default: 5m
format: duration
pattern: ^([0-9]+(\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$
type: string
url:
type: string
Expand Down
Expand Up @@ -110,6 +110,9 @@ spec:
type: object
type: array
resyncPeriod:
default: 5m
format: duration
pattern: ^([0-9]+(\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$
type: string
valuesFrom:
items:
Expand Down
Expand Up @@ -62,6 +62,9 @@ spec:
permissions:
type: string
resyncPeriod:
default: 5m
format: duration
pattern: ^([0-9]+(\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$
type: string
title:
type: string
Expand Down