From 73ea1b8b3c84d1c9d9c960f8f44375cec584a144 Mon Sep 17 00:00:00 2001 From: Aleksandr Prusov Date: Tue, 5 Nov 2024 12:23:51 +0300 Subject: [PATCH] change remoteTimeout type in pingcap.com_tidbmonitors.yaml --- manifests/crd.yaml | 4 ++-- manifests/crd/v1/pingcap.com_tidbmonitors.yaml | 4 ++-- pkg/apis/pingcap/v1alpha1/tidbmonitor_types.go | 3 ++- pkg/monitor/monitor/util.go | 6 ++---- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/manifests/crd.yaml b/manifests/crd.yaml index 49fed4d885a..21801c59051 100644 --- a/manifests/crd.yaml +++ b/manifests/crd.yaml @@ -51228,8 +51228,8 @@ spec: type: integer type: object remoteTimeout: - format: int64 - type: integer + pattern: ^\d+[smhd]$ + type: string tlsConfig: properties: ca: diff --git a/manifests/crd/v1/pingcap.com_tidbmonitors.yaml b/manifests/crd/v1/pingcap.com_tidbmonitors.yaml index e3e9c94b0cf..f87b26eadca 100644 --- a/manifests/crd/v1/pingcap.com_tidbmonitors.yaml +++ b/manifests/crd/v1/pingcap.com_tidbmonitors.yaml @@ -1889,8 +1889,8 @@ spec: type: integer type: object remoteTimeout: - format: int64 - type: integer + pattern: ^\d+[smhd]$ + type: string tlsConfig: properties: ca: diff --git a/pkg/apis/pingcap/v1alpha1/tidbmonitor_types.go b/pkg/apis/pingcap/v1alpha1/tidbmonitor_types.go index 665d1833aba..95b4c719167 100644 --- a/pkg/apis/pingcap/v1alpha1/tidbmonitor_types.go +++ b/pkg/apis/pingcap/v1alpha1/tidbmonitor_types.go @@ -445,8 +445,9 @@ type RemoteWriteSpec struct { // Only valid in Prometheus versions 2.15.0 and newer. // +optional Name string `json:"name,omitempty"` + // +kubebuilder:validation:Pattern=`^\d+[smhd]$` // +optional - RemoteTimeout *model.Duration `json:"remoteTimeout,omitempty"` + RemoteTimeout string `json:"remoteTimeout,omitempty"` // The list of remote write relabel configurations. // +optional WriteRelabelConfigs []RelabelConfig `json:"writeRelabelConfigs,omitempty"` diff --git a/pkg/monitor/monitor/util.go b/pkg/monitor/monitor/util.go index 10ca0499c9f..9ef5c5b1e83 100644 --- a/pkg/monitor/monitor/util.go +++ b/pkg/monitor/monitor/util.go @@ -19,7 +19,6 @@ import ( "sort" "strconv" "strings" - "time" semver "github.com/Masterminds/semver" "github.com/pingcap/tidb-operator/pkg/apis/label" @@ -1489,9 +1488,8 @@ func generateRemoteWrite(monitor *v1alpha1.TidbMonitor, store *Store) (yaml.MapI } for i, spec := range monitor.Spec.Prometheus.RemoteWrite { //defaults - if spec.RemoteTimeout == nil { - duration := model.Duration(30 * time.Second) - spec.RemoteTimeout = &duration + if spec.RemoteTimeout == "" { + spec.RemoteTimeout = "30s" } cfg := yaml.MapSlice{