From ef3b1c800ef22130172d3f315e26e044a3d245ed Mon Sep 17 00:00:00 2001 From: Sylvain Baubeau Date: Fri, 3 Sep 2021 12:31:04 +0200 Subject: [PATCH] istio: do not fetch deprecated quotaspecs and quotaspecbindings --- topology/probes/istio/istio.go | 12 ++---- topology/probes/istio/quotaspec.go | 47 ----------------------- topology/probes/istio/quotaspecbinding.go | 47 ----------------------- 3 files changed, 4 insertions(+), 102 deletions(-) delete mode 100644 topology/probes/istio/quotaspec.go delete mode 100644 topology/probes/istio/quotaspecbinding.go diff --git a/topology/probes/istio/istio.go b/topology/probes/istio/istio.go index 102fee878a..ec89b76bb6 100644 --- a/topology/probes/istio/istio.go +++ b/topology/probes/istio/istio.go @@ -45,12 +45,10 @@ func NewIstioProbe(g *graph.Graph) (*k8s.Probe, error) { } subprobeHandlers := map[string]k8s.SubprobeHandler{ - "destinationrule": newDestinationRuleProbe, - "gateway": newGatewayProbe, - "quotaspec": newQuotaSpecProbe, - "quotaspecbinding": newQuotaSpecBindingProbe, - "serviceentry": newServiceEntryProbe, - "virtualservice": newVirtualServiceProbe, + "destinationrule": newDestinationRuleProbe, + "gateway": newGatewayProbe, + "serviceentry": newServiceEntryProbe, + "virtualservice": newVirtualServiceProbe, } k8s.InitSubprobes(enabledSubprobes, subprobeHandlers, client, g, Manager, "") @@ -75,8 +73,6 @@ func NewIstioProbe(g *graph.Graph) (*k8s.Probe, error) { probe.AppendNamespaceLinkers( "destinationrule", "gateway", - "quotaspec", - "quotaspecbinding", "serviceentry", "virtualservice", ) diff --git a/topology/probes/istio/quotaspec.go b/topology/probes/istio/quotaspec.go deleted file mode 100644 index 00b9f6bfab..0000000000 --- a/topology/probes/istio/quotaspec.go +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (C) 2018 IBM, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy ofthe License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specificlanguage governing permissions and - * limitations under the License. - * - */ - -package istio - -import ( - "fmt" - - "github.com/skydive-project/skydive/graffiti/graph" - "github.com/skydive-project/skydive/topology/probes/k8s" - models "istio.io/client-go/pkg/apis/config/v1alpha2" - client "istio.io/client-go/pkg/clientset/versioned" -) - -type quotaSpecHandler struct { -} - -// Map graph node to k8s resource -func (h *quotaSpecHandler) Map(obj interface{}) (graph.Identifier, graph.Metadata) { - qs := obj.(*models.QuotaSpec) - m := k8s.NewMetadataFields(&qs.ObjectMeta) - return graph.Identifier(qs.GetUID()), k8s.NewMetadata(Manager, "quotaspec", m, qs, qs.Name) -} - -// Dump k8s resource -func (h *quotaSpecHandler) Dump(obj interface{}) string { - qs := obj.(*models.QuotaSpec) - return fmt.Sprintf("quotaspec{Namespace: %s, Name: %s}", qs.Namespace, qs.Name) -} - -func newQuotaSpecProbe(c interface{}, g *graph.Graph) k8s.Subprobe { - return k8s.NewResourceCache(c.(*client.Clientset).ConfigV1alpha2().RESTClient(), &models.QuotaSpec{}, "quotaspecs", g, "aSpecHandler{}) -} diff --git a/topology/probes/istio/quotaspecbinding.go b/topology/probes/istio/quotaspecbinding.go deleted file mode 100644 index 1b8e06a9a5..0000000000 --- a/topology/probes/istio/quotaspecbinding.go +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (C) 2018 IBM, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy ofthe License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specificlanguage governing permissions and - * limitations under the License. - * - */ - -package istio - -import ( - "fmt" - - "github.com/skydive-project/skydive/graffiti/graph" - "github.com/skydive-project/skydive/topology/probes/k8s" - models "istio.io/client-go/pkg/apis/config/v1alpha2" - client "istio.io/client-go/pkg/clientset/versioned" -) - -type quotaSpecBindingHandler struct { -} - -// Map graph node to k8s resource -func (h *quotaSpecBindingHandler) Map(obj interface{}) (graph.Identifier, graph.Metadata) { - qsb := obj.(*models.QuotaSpecBinding) - m := k8s.NewMetadataFields(&qsb.ObjectMeta) - return graph.Identifier(qsb.GetUID()), k8s.NewMetadata(Manager, "quotaspecbinding", m, qsb, qsb.Name) -} - -// Dump k8s resource -func (h *quotaSpecBindingHandler) Dump(obj interface{}) string { - qsb := obj.(*models.QuotaSpecBinding) - return fmt.Sprintf("quotaspecbinding{Namespace: %s, Name: %s}", qsb.Namespace, qsb.Name) -} - -func newQuotaSpecBindingProbe(c interface{}, g *graph.Graph) k8s.Subprobe { - return k8s.NewResourceCache(c.(*client.Clientset).ConfigV1alpha2().RESTClient(), &models.QuotaSpecBinding{}, "quotaspecbindings", g, "aSpecBindingHandler{}) -}