From 0af810aa718a9cb9a9466785715103ad6117e959 Mon Sep 17 00:00:00 2001 From: Marcin Skalski Date: Mon, 11 Dec 2023 17:01:52 +0100 Subject: [PATCH] fix go lint Signed-off-by: Marcin Skalski --- config/testdata/conf.good.yml | 2 +- config/testdata/roundtrip.good.yml | 2 +- discovery/xds/kuma.go | 8 ++++---- discovery/xds/kuma_test.go | 2 +- discovery/xds/xds.go | 2 +- discovery/xds/xds_test.go | 2 +- docs/configuration/configuration.md | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/config/testdata/conf.good.yml b/config/testdata/conf.good.yml index 972099800..b58430164 100644 --- a/config/testdata/conf.good.yml +++ b/config/testdata/conf.good.yml @@ -221,7 +221,7 @@ scrape_configs: kuma_sd_configs: - server: http://kuma-control-plane.kuma-system.svc:5676 - clientId: main-prometheus + client_id: main-prometheus - job_name: service-marathon marathon_sd_configs: diff --git a/config/testdata/roundtrip.good.yml b/config/testdata/roundtrip.good.yml index 26589ad1b..24ab7d259 100644 --- a/config/testdata/roundtrip.good.yml +++ b/config/testdata/roundtrip.good.yml @@ -108,7 +108,7 @@ scrape_configs: kuma_sd_configs: - server: http://kuma-control-plane.kuma-system.svc:5676 - clientId: main-prometheus + client_id: main-prometheus marathon_sd_configs: - servers: diff --git a/discovery/xds/kuma.go b/discovery/xds/kuma.go index 1cec053e4..e79195bb2 100644 --- a/discovery/xds/kuma.go +++ b/discovery/xds/kuma.go @@ -179,10 +179,10 @@ func kumaMadsV1ResourceParser(resources []*anypb.Any, typeURL string) ([]model.L func NewKumaHTTPDiscovery(conf *KumaSDConfig, logger log.Logger) (discovery.Discoverer, error) { // Default to "prometheus" if hostname is unavailable. var clientID string - if conf.ClientId == "" { - clientID = defaultClientId(logger) + if conf.ClientID == "" { + clientID = defaultClientID(logger) } else { - clientID = conf.ClientId + clientID = conf.ClientID } clientConfig := &HTTPResourceClientConfig{ @@ -217,7 +217,7 @@ func NewKumaHTTPDiscovery(conf *KumaSDConfig, logger log.Logger) (discovery.Disc return d, nil } -func defaultClientId(logger log.Logger) string { +func defaultClientID(logger log.Logger) string { clientID, err := osutil.GetFQDN() if err != nil { level.Debug(logger).Log("msg", "error getting FQDN", "err", err) diff --git a/discovery/xds/kuma_test.go b/discovery/xds/kuma_test.go index 7f2b0ce3b..6b4bb8784 100644 --- a/discovery/xds/kuma_test.go +++ b/discovery/xds/kuma_test.go @@ -204,7 +204,7 @@ func TestNewKumaHTTPDiscovery(t *testing.T) { require.True(t, ok) require.Equal(t, kumaConf.Server, resClient.Server()) require.Equal(t, KumaMadsV1ResourceTypeURL, resClient.ResourceTypeURL()) - require.Equal(t, kumaConf.ClientId, resClient.ID()) + require.Equal(t, kumaConf.ClientID, resClient.ID()) require.Equal(t, KumaMadsV1ResourceType, resClient.config.ResourceType) } diff --git a/discovery/xds/xds.go b/discovery/xds/xds.go index 47baece78..16aa3f148 100644 --- a/discovery/xds/xds.go +++ b/discovery/xds/xds.go @@ -55,7 +55,7 @@ type SDConfig struct { RefreshInterval model.Duration `yaml:"refresh_interval,omitempty"` FetchTimeout model.Duration `yaml:"fetch_timeout,omitempty"` Server string `yaml:"server,omitempty"` - ClientId string `yaml:"clientId,omitempty"` + ClientID string `yaml:"client_id,omitempty"` } // mustRegisterMessage registers the provided message type in the typeRegistry, and panics diff --git a/discovery/xds/xds_test.go b/discovery/xds/xds_test.go index 2e0f24e19..f57fff996 100644 --- a/discovery/xds/xds_test.go +++ b/discovery/xds/xds_test.go @@ -36,7 +36,7 @@ var ( sdConf = SDConfig{ Server: "http://127.0.0.1", RefreshInterval: model.Duration(10 * time.Second), - ClientId: "test-id", + ClientID: "test-id", } testFetchFailuresCount = prometheus.NewCounter( diff --git a/docs/configuration/configuration.md b/docs/configuration/configuration.md index d3ee459be..41f54dbd2 100644 --- a/docs/configuration/configuration.md +++ b/docs/configuration/configuration.md @@ -2233,7 +2233,7 @@ server: # Client id is used by Kuma Control Plane to compute Monitoring Assignment for specific Prometheus backend. # This is useful when migrating between multiple Prometheus backends, or having separate backend for each Mesh # When not specified, system hostname/fqdn will be used if available, if not `prometheus` will be used. -clientId: +client_id: # The time to wait between polling update requests. [ refresh_interval: | default = 30s ]