From: Guillem Jover <gjover@sipwise.com>
Date: Fri, 14 Jul 2023 19:05:45 +0200
Subject: Disable xDS service discovery

Forwarded: not-needed
Last-Updated: Sat Mar 12 18:35:22 2022 +0000

This requires modules not present in Debian.
---
 config/config_test.go              | 27 ---------------------------
 config/testdata/conf.good.yml      |  5 -----
 config/testdata/roundtrip.good.yml |  3 ---
 discovery/install/install.go       |  1 -
 discovery/xds/client.go            |  3 +++
 discovery/xds/client_test.go       |  3 +++
 discovery/xds/kuma.go              |  3 +++
 discovery/xds/kuma_mads.pb.go      |  3 +++
 discovery/xds/kuma_test.go         |  3 +++
 discovery/xds/xds.go               |  3 +++
 discovery/xds/xds_test.go          |  3 +++
 plugins/plugins.go                 |  3 ---
 12 files changed, 21 insertions(+), 39 deletions(-)

diff --git a/config/config_test.go b/config/config_test.go
index 7132cb6..b63ebc3 100644
--- a/config/config_test.go
+++ b/config/config_test.go
@@ -53,7 +53,6 @@ import (
 	"github.com/prometheus/prometheus/discovery/triton"
 	"github.com/prometheus/prometheus/discovery/uyuni"
 	"github.com/prometheus/prometheus/discovery/vultr"
-	"github.com/prometheus/prometheus/discovery/xds"
 	"github.com/prometheus/prometheus/discovery/zookeeper"
 	"github.com/prometheus/prometheus/model/labels"
 	"github.com/prometheus/prometheus/model/relabel"
@@ -458,32 +457,6 @@ var expectedConf = &Config{
 				EnableHTTP2:     true,
 			},
 		},
-		{
-			JobName: "service-kuma",
-
-			HonorTimestamps:       true,
-			ScrapeInterval:        model.Duration(15 * time.Second),
-			ScrapeTimeout:         DefaultGlobalConfig.ScrapeTimeout,
-			BodySizeLimit:         globBodySizeLimit,
-			SampleLimit:           globSampleLimit,
-			TargetLimit:           globTargetLimit,
-			LabelLimit:            globLabelLimit,
-			LabelNameLengthLimit:  globLabelNameLengthLimit,
-			LabelValueLengthLimit: globLabelValueLengthLimit,
-
-			MetricsPath:      DefaultScrapeConfig.MetricsPath,
-			Scheme:           DefaultScrapeConfig.Scheme,
-			HTTPClientConfig: config.DefaultHTTPClientConfig,
-
-			ServiceDiscoveryConfigs: discovery.Configs{
-				&xds.KumaSDConfig{
-					Server:           "http://kuma-control-plane.kuma-system.svc:5676",
-					HTTPClientConfig: config.DefaultHTTPClientConfig,
-					RefreshInterval:  model.Duration(15 * time.Second),
-					FetchTimeout:     model.Duration(2 * time.Minute),
-				},
-			},
-		},
 		{
 			JobName: "service-marathon",
 
diff --git a/config/testdata/conf.good.yml b/config/testdata/conf.good.yml
index b32021f..518bcca 100644
--- a/config/testdata/conf.good.yml
+++ b/config/testdata/conf.good.yml
@@ -191,11 +191,6 @@ scrape_configs:
     authorization:
       credentials: mysecret
 
-  - job_name: service-kuma
-
-    kuma_sd_configs:
-      - server: http://kuma-control-plane.kuma-system.svc:5676
-
   - job_name: service-marathon
     marathon_sd_configs:
       - servers:
diff --git a/config/testdata/roundtrip.good.yml b/config/testdata/roundtrip.good.yml
index de7fd67..4840174 100644
--- a/config/testdata/roundtrip.good.yml
+++ b/config/testdata/roundtrip.good.yml
@@ -88,9 +88,6 @@ scrape_configs:
       - files:
           - single/file.yml
 
-    kuma_sd_configs:
-      - server: http://kuma-control-plane.kuma-system.svc:5676
-
     marathon_sd_configs:
       - servers:
           - https://marathon.example.com:443
diff --git a/discovery/install/install.go b/discovery/install/install.go
index 467984d..9e0986c 100644
--- a/discovery/install/install.go
+++ b/discovery/install/install.go
@@ -38,6 +38,5 @@ import (
 	_ "github.com/prometheus/prometheus/discovery/triton"       // register triton
 	_ "github.com/prometheus/prometheus/discovery/uyuni"        // register uyuni
 	_ "github.com/prometheus/prometheus/discovery/vultr"        // register vultr
-	_ "github.com/prometheus/prometheus/discovery/xds"          // register xds
 	_ "github.com/prometheus/prometheus/discovery/zookeeper"    // register zookeeper
 )
diff --git a/discovery/xds/client.go b/discovery/xds/client.go
index 9844c6d..7ebc44b 100644
--- a/discovery/xds/client.go
+++ b/discovery/xds/client.go
@@ -11,6 +11,9 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build ignore
+// +build ignore
+
 package xds
 
 import (
diff --git a/discovery/xds/client_test.go b/discovery/xds/client_test.go
index ff52173..aa52df4 100644
--- a/discovery/xds/client_test.go
+++ b/discovery/xds/client_test.go
@@ -11,6 +11,9 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build ignore
+// +build ignore
+
 package xds
 
 import (
diff --git a/discovery/xds/kuma.go b/discovery/xds/kuma.go
index bc88ba5..3b59672 100644
--- a/discovery/xds/kuma.go
+++ b/discovery/xds/kuma.go
@@ -11,6 +11,9 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build ignore
+// +build ignore
+
 package xds
 
 import (
diff --git a/discovery/xds/kuma_mads.pb.go b/discovery/xds/kuma_mads.pb.go
index b1079bf..fdb2e00 100644
--- a/discovery/xds/kuma_mads.pb.go
+++ b/discovery/xds/kuma_mads.pb.go
@@ -11,6 +11,9 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build ignore
+// +build ignore
+
 // Code generated by protoc-gen-go. DO NOT EDIT.
 // versions:
 // 	protoc-gen-go v1.25.0
diff --git a/discovery/xds/kuma_test.go b/discovery/xds/kuma_test.go
index 1db0a08..61fd630 100644
--- a/discovery/xds/kuma_test.go
+++ b/discovery/xds/kuma_test.go
@@ -11,6 +11,9 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build ignore
+// +build ignore
+
 package xds
 
 import (
diff --git a/discovery/xds/xds.go b/discovery/xds/xds.go
index 48bdbab..095562a 100644
--- a/discovery/xds/xds.go
+++ b/discovery/xds/xds.go
@@ -11,6 +11,9 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build ignore
+// +build ignore
+
 package xds
 
 import (
diff --git a/discovery/xds/xds_test.go b/discovery/xds/xds_test.go
index 974a473..c1a965a 100644
--- a/discovery/xds/xds_test.go
+++ b/discovery/xds/xds_test.go
@@ -11,6 +11,9 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build ignore
+// +build ignore
+
 package xds
 
 import (
diff --git a/plugins/plugins.go b/plugins/plugins.go
index f135e1d..246fd30 100644
--- a/plugins/plugins.go
+++ b/plugins/plugins.go
@@ -76,9 +76,6 @@ import (
 	// Register vultr plugin.
 	_ "github.com/prometheus/prometheus/discovery/vultr"
 
-	// Register xds plugin.
-	_ "github.com/prometheus/prometheus/discovery/xds"
-
 	// Register zookeeper plugin.
 	_ "github.com/prometheus/prometheus/discovery/zookeeper"
 )
