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: type mismatch in TidbMonitor remoteTimeout #5734

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions manifests/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51282,8 +51282,8 @@ spec:
type: integer
type: object
remoteTimeout:
format: int64
type: integer
pattern: ^\d+[smhd]$
type: string
tlsConfig:
properties:
ca:
Expand Down
4 changes: 2 additions & 2 deletions manifests/crd/v1/pingcap.com_tidbmonitors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1889,8 +1889,8 @@ spec:
type: integer
type: object
remoteTimeout:
format: int64
type: integer
pattern: ^\d+[smhd]$
type: string
tlsConfig:
properties:
ca:
Expand Down
3 changes: 2 additions & 1 deletion pkg/apis/pingcap/v1alpha1/tidbmonitor_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
6 changes: 2 additions & 4 deletions pkg/monitor/monitor/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"sort"
"strconv"
"strings"
"time"

semver "github.com/Masterminds/semver"
"github.com/pingcap/tidb-operator/pkg/apis/label"
Expand Down Expand Up @@ -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{
Expand Down
Loading