From 01fed09a93f167040fdfe4a146c55ae2ec5cda32 Mon Sep 17 00:00:00 2001 From: Jeffrey Limnardy Date: Wed, 11 Sep 2024 13:57:31 +0200 Subject: [PATCH 1/8] use labelselector implementation --- internal/istiostatus/istio_status_checker.go | 26 ++++++++++++++----- .../istiostatus/istio_status_checker_test.go | 3 +++ 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/internal/istiostatus/istio_status_checker.go b/internal/istiostatus/istio_status_checker.go index 0cd9b0377..5d537010f 100644 --- a/internal/istiostatus/istio_status_checker.go +++ b/internal/istiostatus/istio_status_checker.go @@ -2,10 +2,8 @@ package istiostatus import ( "context" - "slices" - "strings" - apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" + "k8s.io/apimachinery/pkg/labels" "sigs.k8s.io/controller-runtime/pkg/client" logf "sigs.k8s.io/controller-runtime/pkg/log" ) @@ -26,12 +24,26 @@ func NewChecker(client client.Reader) *Checker { // IsIstioActive checks if Istio is active on the cluster based on the presence of Istio CRDs func (isc *Checker) IsIstioActive(ctx context.Context) bool { var crdList apiextensionsv1.CustomResourceDefinitionList - if err := isc.client.List(ctx, &crdList); err != nil { + //add fieldselector to improve performance with large crds -> doesn't work with fakeclient + //listOptions := &client.ListOptions{ + // FieldSelector: fields.SelectorFromSet(fields.Set{"metadata.name": peerAuthenticationIstioCRD}), + //} + + //add labelselector to improve performance with large crds by filtering to list only crds with certain labels + //use labelselector because the fieldselector doesn't work with the fake client + istioLabels := labels.Set{"app": "istio-pilot"} + listOptions := &client.ListOptions{ + LabelSelector: labels.SelectorFromSet(istioLabels), + } + if err := isc.client.List(ctx, &crdList, listOptions); err != nil { logf.FromContext(ctx).Error(err, "Unable to list CRDs to check Istio status") return false } - return slices.ContainsFunc(crdList.Items, func(crd apiextensionsv1.CustomResourceDefinition) bool { - return strings.EqualFold(crd.GetName(), peerAuthenticationIstioCRD) - }) + for _, crd := range crdList.Items { + if crd.GetName() == peerAuthenticationIstioCRD { + return true + } + } + return false } diff --git a/internal/istiostatus/istio_status_checker_test.go b/internal/istiostatus/istio_status_checker_test.go index eaabbebd7..4a645997d 100644 --- a/internal/istiostatus/istio_status_checker_test.go +++ b/internal/istiostatus/istio_status_checker_test.go @@ -26,6 +26,9 @@ func TestIsIstioActive(t *testing.T) { { ObjectMeta: metav1.ObjectMeta{ Name: "peerauthentications.security.istio.io", + Labels: map[string]string{ + "app": "istio-pilot", + }, }, }, }, From 0760d60adf73e8f92db2870267104a4a897a062b Mon Sep 17 00:00:00 2001 From: Jeffrey Limnardy Date: Wed, 11 Sep 2024 13:59:11 +0200 Subject: [PATCH 2/8] use discoveryapi implementation --- internal/discovery/client.go | 21 ++++ internal/discovery/config.go | 101 ++++++++++++++++++ .../istio_status_checker_discoveryapi.go | 33 ++++++ .../istio_status_checker_discoveryapi_test.go | 61 +++++++++++ 4 files changed, 216 insertions(+) create mode 100644 internal/discovery/client.go create mode 100644 internal/discovery/config.go create mode 100644 internal/istiostatus/istio_status_checker_discoveryapi.go create mode 100644 internal/istiostatus/istio_status_checker_discoveryapi_test.go diff --git a/internal/discovery/client.go b/internal/discovery/client.go new file mode 100644 index 000000000..4de77d01f --- /dev/null +++ b/internal/discovery/client.go @@ -0,0 +1,21 @@ +package discovery + +import "k8s.io/client-go/discovery" + +func MakeDiscoveryClient(apiConf APIConfig) (discovery.DiscoveryInterface, error) { + if err := apiConf.Validate(); err != nil { + return nil, err + } + + authConf, err := CreateRestConfig(apiConf) + if err != nil { + return nil, err + } + + discoveryClient, err := discovery.NewDiscoveryClientForConfig(authConf) + if err != nil { + return nil, err + } + + return discoveryClient, nil +} diff --git a/internal/discovery/config.go b/internal/discovery/config.go new file mode 100644 index 000000000..4091828cb --- /dev/null +++ b/internal/discovery/config.go @@ -0,0 +1,101 @@ +package discovery + +import ( + "fmt" + "k8s.io/client-go/rest" + "k8s.io/client-go/tools/clientcmd" + "net" + "net/http" + "os" +) + +type AuthType string + +const ( + // AuthTypeNone means no auth is required + AuthTypeNone AuthType = "none" + // AuthTypeServiceAccount means to use the built-in service account that + // K8s automatically provisions for each pod. + AuthTypeServiceAccount AuthType = "serviceAccount" + // AuthTypeKubeConfig uses local credentials like those used by kubectl. + AuthTypeKubeConfig AuthType = "kubeConfig" +) + +var authTypes = map[AuthType]bool{ + AuthTypeNone: true, + AuthTypeServiceAccount: true, + AuthTypeKubeConfig: true, +} + +// APIConfig contains options relevant to connecting to the K8s API +type APIConfig struct { + // How to authenticate to the K8s API server. This can be one of `none` + // (for no auth), `serviceAccount` (to use the standard service account + // token provided to the agent pod), or `kubeConfig` to use credentials + // from `~/.kube/config`. + AuthType AuthType `mapstructure:"auth_type"` + + // When using auth_type `kubeConfig`, override the current context. + Context string `mapstructure:"context"` +} + +// Validate validates the K8s API config +func (c APIConfig) Validate() error { + if !authTypes[c.AuthType] { + return fmt.Errorf("invalid authType for kubernetes: %v", c.AuthType) + } + + return nil +} + +func CreateRestConfig(apiConf APIConfig) (*rest.Config, error) { + var authConf *rest.Config + var err error + + authType := apiConf.AuthType + var k8sHost string + if authType != AuthTypeKubeConfig { + host, port := os.Getenv("KUBERNETES_SERVICE_HOST"), os.Getenv("KUBERNETES_SERVICE_PORT") + if len(host) == 0 || len(port) == 0 { + return nil, fmt.Errorf("unable to load k8s config, KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT must be defined") + } + k8sHost = "https://" + net.JoinHostPort(host, port) + } + + switch authType { + case AuthTypeKubeConfig: + loadingRules := clientcmd.NewDefaultClientConfigLoadingRules() + configOverrides := &clientcmd.ConfigOverrides{} + if apiConf.Context != "" { + configOverrides.CurrentContext = apiConf.Context + } + authConf, err = clientcmd.NewNonInteractiveDeferredLoadingClientConfig( + loadingRules, configOverrides).ClientConfig() + + if err != nil { + return nil, fmt.Errorf("error connecting to k8s with auth_type=%s: %w", AuthTypeKubeConfig, err) + } + case AuthTypeNone: + authConf = &rest.Config{ + Host: k8sHost, + } + authConf.Insecure = true + case AuthTypeServiceAccount: + // This should work for most clusters but other auth types can be added + authConf, err = rest.InClusterConfig() + if err != nil { + return nil, err + } + } + + authConf.WrapTransport = func(rt http.RoundTripper) http.RoundTripper { + // Don't use system proxy settings since the API is local to the + // cluster + if t, ok := rt.(*http.Transport); ok { + t.Proxy = nil + } + return rt + } + + return authConf, nil +} diff --git a/internal/istiostatus/istio_status_checker_discoveryapi.go b/internal/istiostatus/istio_status_checker_discoveryapi.go new file mode 100644 index 000000000..a30fa6b7e --- /dev/null +++ b/internal/istiostatus/istio_status_checker_discoveryapi.go @@ -0,0 +1,33 @@ +package istiostatus + +import ( + "context" + "k8s.io/client-go/discovery" + logf "sigs.k8s.io/controller-runtime/pkg/log" + "strings" +) + +type CheckerDiscoveryAPI struct { + discovery discovery.DiscoveryInterface +} + +func NewCheckerDiscoveryAPI(d discovery.DiscoveryInterface) *CheckerDiscoveryAPI { + return &CheckerDiscoveryAPI{discovery: d} +} + +// IsIstioActiveDiscoveryAPI checks if Istio is active on the cluster based on the presence of Istio CRDs +func (isc *CheckerDiscoveryAPI) IsIstioActiveDiscoveryAPI(ctx context.Context) bool { + + groupList, err := isc.discovery.ServerGroups() + if err != nil { + logf.FromContext(ctx).Error(err, "error getting group list from server") + } + + for _, group := range groupList.Groups { + if strings.Contains(group.Name, ".istio.io") { + return true + } + } + return false + +} diff --git a/internal/istiostatus/istio_status_checker_discoveryapi_test.go b/internal/istiostatus/istio_status_checker_discoveryapi_test.go new file mode 100644 index 000000000..511ad5730 --- /dev/null +++ b/internal/istiostatus/istio_status_checker_discoveryapi_test.go @@ -0,0 +1,61 @@ +package istiostatus + +import ( + "context" + "testing" + + "github.com/stretchr/testify/assert" + apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + discoveryfake "k8s.io/client-go/discovery/fake" + clientgoscheme "k8s.io/client-go/kubernetes/scheme" + clienttesting "k8s.io/client-go/testing" +) + +func TestIsIstioActiveDiscoveryAPI(t *testing.T) { + scheme := clientgoscheme.Scheme + err := apiextensionsv1.AddToScheme(scheme) + if err != nil { + t.Fatalf("failed to add api extensions v1 scheme: %v", err) + } + tests := []struct { + name string + resources []*metav1.APIResourceList + want bool + }{ + { + name: "should return true if peerauthentication crd found", + resources: []*metav1.APIResourceList{ + { + GroupVersion: "peerauthentication.security.istio.io/v1beta1", + APIResources: []metav1.APIResource{}, + }, + }, + want: true, + }, + { + name: "should return false if peerauthentication not crd found", + resources: []*metav1.APIResourceList{ + { + GroupVersion: "operator.kyma-project.io/v1beta1", + APIResources: []metav1.APIResource{}, + }, + }, + want: false, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + discovery := discoveryfake.FakeDiscovery{ + Fake: &clienttesting.Fake{ + Resources: tt.resources, + }, + } + checker := NewCheckerDiscoveryAPI(&discovery) + got := checker.IsIstioActiveDiscoveryAPI(context.Background()) + + assert.Equal(t, tt.want, got) + }) + } +} From 110862d0b8aee58734212d4dcee77550a7a10a93 Mon Sep 17 00:00:00 2001 From: Jeffrey Limnardy Date: Wed, 11 Sep 2024 14:00:43 +0200 Subject: [PATCH 3/8] add benchmark docs --- internal/istiostatus/benchmark.md | 93 + .../new_pprof_discoveryapi_gardener.svg | 2137 +++++++++++++++++ .../new_pprof_with_labelselector_gardener.svg | 1396 +++++++++++ internal/istiostatus/old_pprof_gardener.svg | 1759 ++++++++++++++ 4 files changed, 5385 insertions(+) create mode 100644 internal/istiostatus/benchmark.md create mode 100644 internal/istiostatus/new_pprof_discoveryapi_gardener.svg create mode 100644 internal/istiostatus/new_pprof_with_labelselector_gardener.svg create mode 100644 internal/istiostatus/old_pprof_gardener.svg diff --git a/internal/istiostatus/benchmark.md b/internal/istiostatus/benchmark.md new file mode 100644 index 000000000..25fd0bfaa --- /dev/null +++ b/internal/istiostatus/benchmark.md @@ -0,0 +1,93 @@ + +### Test in Gardener cluster, with old IsIstioActive function +``` +Showing nodes accounting for 90ms, 100% of 90ms total +Showing top 20 nodes out of 58 + flat flat% sum% cum cum% + 10ms 11.11% 11.11% 10ms 11.11% runtime.(*mheap).allocSpan + 10ms 11.11% 22.22% 10ms 11.11% runtime.(*mspan).base (inline) + 10ms 11.11% 33.33% 10ms 11.11% runtime.(*mspan).writeHeapBitsSmall + 10ms 11.11% 44.44% 10ms 11.11% runtime.(*spanSet).push + 10ms 11.11% 55.56% 10ms 11.11% runtime.addb (inline) + 10ms 11.11% 66.67% 40ms 44.44% runtime.mallocgc + 10ms 11.11% 77.78% 40ms 44.44% runtime.scanobject + 10ms 11.11% 88.89% 10ms 11.11% runtime.typePointers.nextFast (inline) + 10ms 11.11% 100% 10ms 11.11% runtime/internal/atomic.(*Uint32).Add + 0 0% 100% 30ms 33.33% github.com/kyma-project/telemetry-manager/controllers/telemetry.(*LogPipelineController).Reconcile + 0 0% 100% 30ms 33.33% github.com/kyma-project/telemetry-manager/internal/istiostatus.(*Checker).IsIstioActive + 0 0% 100% 30ms 33.33% github.com/kyma-project/telemetry-manager/internal/reconciler/logpipeline.(*Reconciler).Reconcile + 0 0% 100% 30ms 33.33% github.com/kyma-project/telemetry-manager/internal/reconciler/logpipeline.(*Reconciler).doReconcile + 0 0% 100% 30ms 33.33% github.com/kyma-project/telemetry-manager/internal/reconciler/logpipeline.(*Reconciler).reconcileFluentBit + 0 0% 100% 10ms 11.11% golang.org/x/net/http2.(*ClientConn).readLoop + 0 0% 100% 10ms 11.11% golang.org/x/net/http2.(*clientConnReadLoop).handleResponse + 0 0% 100% 10ms 11.11% golang.org/x/net/http2.(*clientConnReadLoop).processHeaders + 0 0% 100% 10ms 11.11% golang.org/x/net/http2.(*clientConnReadLoop).run + 0 0% 100% 30ms 33.33% k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1.(*CustomResourceDefinition).DeepCopy (inline) + 0 0% 100% 30ms 33.33% k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1.(*CustomResourceDefinition).DeepCopyInto +``` +old_pprof_gardener + +### Test in Gardener cluster, with labelselector approach for IsIstioActive +``` +Showing nodes accounting for 30ms, 100% of 30ms total +Showing top 30 nodes out of 45 + flat flat% sum% cum cum% + 10ms 33.33% 33.33% 10ms 33.33% bytes.(*Buffer).ReadFrom + 10ms 33.33% 66.67% 10ms 33.33% crypto/internal/bigmod.addMulVVW1024 + 10ms 33.33% 100% 10ms 33.33% io.ReadAll + 0 0% 100% 10ms 33.33% bufio.(*Reader).Read + 0 0% 100% 10ms 33.33% crypto/internal/bigmod.(*Nat).Exp + 0 0% 100% 10ms 33.33% crypto/internal/bigmod.(*Nat).montgomeryMul + 0 0% 100% 10ms 33.33% crypto/rsa.(*PrivateKey).Sign + 0 0% 100% 10ms 33.33% crypto/rsa.SignPSS + 0 0% 100% 10ms 33.33% crypto/rsa.decrypt + 0 0% 100% 10ms 33.33% crypto/rsa.signPSSWithSalt + 0 0% 100% 10ms 33.33% crypto/tls.(*Conn).HandshakeContext + 0 0% 100% 10ms 33.33% crypto/tls.(*Conn).Read + 0 0% 100% 10ms 33.33% crypto/tls.(*Conn).handshakeContext + 0 0% 100% 10ms 33.33% crypto/tls.(*Conn).readFromUntil + 0 0% 100% 10ms 33.33% crypto/tls.(*Conn).readRecord (inline) + 0 0% 100% 10ms 33.33% crypto/tls.(*Conn).readRecordOrCCS + 0 0% 100% 10ms 33.33% crypto/tls.(*Conn).serverHandshake + 0 0% 100% 10ms 33.33% crypto/tls.(*serverHandshakeStateTLS13).handshake + 0 0% 100% 10ms 33.33% crypto/tls.(*serverHandshakeStateTLS13).sendServerCertificate + 0 0% 100% 10ms 33.33% github.com/kyma-project/telemetry-manager/controllers/telemetry.(*LogPipelineController).Reconcile + 0 0% 100% 10ms 33.33% github.com/kyma-project/telemetry-manager/internal/k8sutils.CreateOrUpdateDaemonSet + 0 0% 100% 10ms 33.33% github.com/kyma-project/telemetry-manager/internal/reconciler/logpipeline.(*Reconciler).Reconcile + 0 0% 100% 10ms 33.33% github.com/kyma-project/telemetry-manager/internal/reconciler/logpipeline.(*Reconciler).doReconcile + 0 0% 100% 10ms 33.33% github.com/kyma-project/telemetry-manager/internal/reconciler/logpipeline.(*Reconciler).reconcileFluentBit + 0 0% 100% 10ms 33.33% github.com/kyma-project/telemetry-manager/internal/reconciler/logpipeline.(*Reconciler).reconcileFluentBit.NewOwnerReferenceSetter.func2 + 0 0% 100% 10ms 33.33% golang.org/x/net/http2.(*ClientConn).readLoop + 0 0% 100% 10ms 33.33% golang.org/x/net/http2.(*Framer).ReadFrame + 0 0% 100% 10ms 33.33% golang.org/x/net/http2.(*clientConnReadLoop).run + 0 0% 100% 10ms 33.33% golang.org/x/net/http2.readFrameHeader +``` +new_pprof_with_labelselector_gardener + +### Test in Gardener cluster, with discoveryapi approach for IsIstioActive + +Showing nodes accounting for 70ms, 100% of 70ms total +Showing top 20 nodes out of 76 +flat flat% sum% cum cum% +20ms 28.57% 28.57% 20ms 28.57% runtime/internal/syscall.Syscall6 +10ms 14.29% 42.86% 10ms 14.29% encoding/json.stateEndValue +10ms 14.29% 57.14% 10ms 14.29% k8s.io/client-go/rest.IsValidPathSegmentName +10ms 14.29% 71.43% 30ms 42.86% runtime.gcDrain +10ms 14.29% 85.71% 10ms 14.29% runtime.getempty +10ms 14.29% 100% 10ms 14.29% runtime.scanobject +0 0% 100% 10ms 14.29% bufio.(*Reader).Read +0 0% 100% 10ms 14.29% bytes.(*Buffer).ReadFrom +0 0% 100% 10ms 14.29% crypto/tls.(*Conn).Read +0 0% 100% 10ms 14.29% crypto/tls.(*Conn).readFromUntil +0 0% 100% 10ms 14.29% crypto/tls.(*Conn).readRecord (inline) +0 0% 100% 10ms 14.29% crypto/tls.(*Conn).readRecordOrCCS +0 0% 100% 10ms 14.29% crypto/tls.(*atLeastReader).Read +0 0% 100% 10ms 14.29% encoding/json.Unmarshal +0 0% 100% 10ms 14.29% encoding/json.checkValid +0 0% 100% 10ms 14.29% github.com/kyma-project/telemetry-manager/controllers/telemetry.(*LogPipelineController).Reconcile +0 0% 100% 10ms 14.29% github.com/kyma-project/telemetry-manager/internal/istiostatus.(*CheckerDiscoveryAPI).IsIstioActiveDiscoveryAPI +0 0% 100% 10ms 14.29% github.com/kyma-project/telemetry-manager/internal/reconciler/logpipeline.(*Reconciler).Reconcile +0 0% 100% 10ms 14.29% github.com/kyma-project/telemetry-manager/internal/reconciler/logpipeline.(*Reconciler).doReconcile +0 0% 100% 10ms 14.29% github.com/kyma-project/telemetry-manager/internal/reconciler/logpipeline.(*Reconciler).reconcileFluentBit + +new_pprof_with_discoveryapi_gardener \ No newline at end of file diff --git a/internal/istiostatus/new_pprof_discoveryapi_gardener.svg b/internal/istiostatus/new_pprof_discoveryapi_gardener.svg new file mode 100644 index 000000000..ecf7123f4 --- /dev/null +++ b/internal/istiostatus/new_pprof_discoveryapi_gardener.svg @@ -0,0 +1,2137 @@ + + + + + + +manager + + +cluster_L + + + + +File: manager + + +File: manager +Type: cpu +Time: Sep 11, 2024 at 9:43am (CEST) +Duration: 30s, Total samples = 70ms ( 0.23%) +Showing nodes accounting for 70ms, 100% of 70ms total +See https://git.io/JfYMW for how to read the graph + + + + + +N1 + + +syscall +Syscall6 +20ms (28.57%) + + + + + +N2 + + +runtime +gcDrain +10ms (14.29%) +of 30ms (42.86%) + + + + + +N7 + + +runtime +scanobject +10ms (14.29%) + + + + + +N2->N7 + + + + + + + 10ms + + + + + +N62 + + +runtime +markroot +0 of 10ms (14.29%) + + + + + +N2->N62 + + + + + + + 10ms + + + + + +N3 + + +runtime +gcBgMarkWorker +0 of 30ms (42.86%) + + + + + +N68 + + +runtime +systemstack +0 of 30ms (42.86%) + + + + + +N3->N68 + + + + + + + 30ms + + + + + +N4 + + +json +stateEndValue +10ms (14.29%) + + + + + +N5 + + +rest +IsValidPathSegmentName +10ms (14.29%) + + + + + +N6 + + +runtime +getempty +10ms (14.29%) + + + + + +N8 + + +http2 +(*ClientConn) +readLoop +0 of 10ms (14.29%) + + + + + +N27 + + +http2 +(*clientConnReadLoop) +run +0 of 10ms (14.29%) + + + + + +N8->N27 + + + + + + + 10ms + + + + + +N9 + + +runtime +mcall +0 of 10ms (14.29%) + + + + + +N65 + + +runtime +park_m +0 of 10ms (14.29%) + + + + + +N9->N65 + + + + + + + 10ms + + + + + +N10 + + +controller +(*Controller[go +shape +struct { k8s +io/apimachinery/pkg/types +NamespacedName }]) +Start +func2 +2 +0 of 10ms (14.29%) + + + + + +N71 + + +controller +(*Controller[go +shape +struct { k8s +io/apimachinery/pkg/types +NamespacedName }]) +processNextWorkItem +0 of 10ms (14.29%) + + + + + +N10->N71 + + + + + + + 10ms + + + + + +N11 + + +manager +(*controllerManager) +Start +func3 +0 of 10ms (14.29%) + + + + + +N48 + + +leaderelection +(*LeaderElector) +Run +0 of 10ms (14.29%) + + + + + +N11->N48 + + + + + + + 10ms + + + + + +N12 + + +bufio +(*Reader) +Read +0 of 10ms (14.29%) + + + + + +N14 + + +tls +(*Conn) +Read +0 of 10ms (14.29%) + + + + + +N12->N14 + + + + + + + 10ms + + + + + +N13 + + +bytes +(*Buffer) +ReadFrom +0 of 10ms (14.29%) + + + + + +N18 + + +tls +(*atLeastReader) +Read +0 of 10ms (14.29%) + + + + + +N13->N18 + + + + + + + 10ms + + + + + +N16 + + +tls +(*Conn) +readRecord +0 of 10ms (14.29%) + + + + + +N14->N16 + + + + + + + 10ms + (inline) + + + + + +N15 + + +tls +(*Conn) +readFromUntil +0 of 10ms (14.29%) + + + + + +N15->N13 + + + + + + + 10ms + + + + + +N17 + + +tls +(*Conn) +readRecordOrCCS +0 of 10ms (14.29%) + + + + + +N16->N17 + + + + + + + 10ms + + + + + +N17->N15 + + + + + + + 10ms + + + + + +N54 + + +net +(*conn) +Read +0 of 10ms (14.29%) + + + + + +N18->N54 + + + + + + + 10ms + + + + + +N19 + + +json +Unmarshal +0 of 10ms (14.29%) + + + + + +N20 + + +json +checkValid +0 of 10ms (14.29%) + + + + + +N19->N20 + + + + + + + 10ms + + + + + +N20->N4 + + + + + + + 10ms + + + + + +N21 + + +telemetry +(*LogPipelineController) +Reconcile +0 of 10ms (14.29%) + + + + + +N23 + + +logpipeline +(*Reconciler) +Reconcile +0 of 10ms (14.29%) + + + + + +N21->N23 + + + + + + + 10ms + + + + + +N22 + + +istiostatus +(*CheckerDiscoveryAPI) +IsIstioActiveDiscoveryAPI +0 of 10ms (14.29%) + + + + + +N43 + + +discovery +(*DiscoveryClient) +ServerGroups +0 of 10ms (14.29%) + + + + + +N22->N43 + + + + + + + 10ms + + + + + +N24 + + +logpipeline +(*Reconciler) +doReconcile +0 of 10ms (14.29%) + + + + + +N23->N24 + + + + + + + 10ms + + + + + +N25 + + +logpipeline +(*Reconciler) +reconcileFluentBit +0 of 10ms (14.29%) + + + + + +N24->N25 + + + + + + + 10ms + + + + + +N25->N22 + + + + + + + 10ms + + + + + +N26 + + +http2 +(*Framer) +ReadFrame +0 of 10ms (14.29%) + + + + + +N28 + + +http2 +readFrameHeader +0 of 10ms (14.29%) + + + + + +N26->N28 + + + + + + + 10ms + + + + + +N27->N26 + + + + + + + 10ms + + + + + +N32 + + +io +ReadFull +0 of 10ms (14.29%) + + + + + +N28->N32 + + + + + + + 10ms + (inline) + + + + + +N29 + + +poll +(*FD) +Read +0 of 10ms (14.29%) + + + + + +N30 + + +poll +ignoringEINTRIO +0 of 10ms (14.29%) + + + + + +N29->N30 + + + + + + + 10ms + (inline) + + + + + +N74 + + +syscall +Read +0 of 10ms (14.29%) + + + + + +N30->N74 + + + + + + + 10ms + (inline) + + + + + +N31 + + +io +ReadAtLeast +0 of 10ms (14.29%) + + + + + +N31->N12 + + + + + + + 10ms + + + + + +N32->N31 + + + + + + + 10ms + + + + + +N33 + + +wait +BackoffUntil +0 of 10ms (14.29%) + + + + + +N34 + + +wait +BackoffUntil +func1 +0 of 10ms (14.29%) + + + + + +N33->N34 + + + + + + + 10ms + + + + + +N50 + + +leaderelection +(*LeaderElector) +renew +func1 +0 of 10ms (14.29%) + + + + + +N34->N50 + + + + + + + 10ms + + + + + +N35 + + +wait +JitterUntil +0 of 10ms (14.29%) + + + + + +N35->N33 + + + + + + + 10ms + + + + + +N36 + + +wait +PollImmediateUntil +0 of 10ms (14.29%) + + + + + +N38 + + +wait +PollImmediateUntilWithContext +0 of 10ms (14.29%) + + + + + +N36->N38 + + + + + + + 10ms + + + + + +N37 + + +wait +PollImmediateUntil +ConditionFunc +WithContext +func1 +0 of 10ms (14.29%) + + + + + +N51 + + +leaderelection +(*LeaderElector) +renew +func1 +1 +0 of 10ms (14.29%) + + + + + +N37->N51 + + + + + + + 10ms + + + + + +N40 + + +wait +poll +0 of 10ms (14.29%) + + + + + +N38->N40 + + + + + + + 10ms + + + + + +N39 + + +wait +Until +0 of 10ms (14.29%) + + + + + +N39->N35 + + + + + + + 10ms + + + + + +N41 + + +wait +runConditionWithCrashProtectionWithContext +0 of 10ms (14.29%) + + + + + +N40->N41 + + + + + + + 10ms + + + + + +N41->N37 + + + + + + + 10ms + + + + + +N42 + + +discovery +(*DiscoveryClient) +GroupsAndMaybeResources +0 of 10ms (14.29%) + + + + + +N44 + + +discovery +(*DiscoveryClient) +downloadAPIs +0 of 10ms (14.29%) + + + + + +N42->N44 + + + + + + + 10ms + + + + + +N43->N42 + + + + + + + 10ms + + + + + +N44->N19 + + + + + + + 10ms + + + + + +N45 + + +gentype +(*Client[go +shape +*uint8]) +Update +0 of 10ms (14.29%) + + + + + +N47 + + +rest +(*Request) +NamespaceIfScoped +0 of 10ms (14.29%) + + + + + +N45->N47 + + + + + + + 10ms + (inline) + + + + + +N46 + + +rest +(*Request) +Namespace +0 of 10ms (14.29%) + + + + + +N46->N5 + + + + + + + 10ms + + + + + +N47->N46 + + + + + + + 10ms + + + + + +N49 + + +leaderelection +(*LeaderElector) +renew +0 of 10ms (14.29%) + + + + + +N48->N49 + + + + + + + 10ms + + + + + +N49->N39 + + + + + + + 10ms + (inline) + + + + + +N50->N36 + + + + + + + 10ms + + + + + +N52 + + +leaderelection +(*LeaderElector) +tryAcquireOrRenew +0 of 10ms (14.29%) + + + + + +N51->N52 + + + + + + + 10ms + + + + + +N53 + + +resourcelock +(*LeaseLock) +Update +0 of 10ms (14.29%) + + + + + +N52->N53 + + + + + + + 10ms + + + + + +N53->N45 + + + + + + + 10ms + + + + + +N55 + + +net +(*netFD) +Read +0 of 10ms (14.29%) + + + + + +N54->N55 + + + + + + + 10ms + + + + + +N55->N29 + + + + + + + 10ms + + + + + +N56 + + +runtime +(*gcWork) +init +0 of 10ms (14.29%) + + + + + +N56->N6 + + + + + + + 10ms + + + + + +N57 + + +runtime +(*gcWork) +put +0 of 10ms (14.29%) + + + + + +N57->N56 + + + + + + + 10ms + + + + + +N58 + + +runtime +findRunnable +0 of 10ms (14.29%) + + + + + +N64 + + +runtime +netpoll +0 of 10ms (14.29%) + + + + + +N58->N64 + + + + + + + 10ms + + + + + +N59 + + +runtime +gcBgMarkWorker +func2 +0 of 30ms (42.86%) + + + + + +N60 + + +runtime +gcDrainMarkWorkerDedicated +0 of 30ms (42.86%) + + + + + +N59->N60 + + + + + + + 30ms + (inline) + + + + + +N60->N2 + + + + + + + 30ms + + + + + +N61 + + +runtime +greyobject +0 of 10ms (14.29%) + + + + + +N61->N57 + + + + + + + 10ms + + + + + +N63 + + +runtime +markrootBlock +0 of 10ms (14.29%) + + + + + +N62->N63 + + + + + + + 10ms + + + + + +N66 + + +runtime +scanblock +0 of 10ms (14.29%) + + + + + +N63->N66 + + + + + + + 10ms + + + + + +N69 + + +syscall +EpollWait +0 of 10ms (14.29%) + + + + + +N64->N69 + + + + + + + 10ms + + + + + +N67 + + +runtime +schedule +0 of 10ms (14.29%) + + + + + +N65->N67 + + + + + + + 10ms + + + + + +N66->N61 + + + + + + + 10ms + + + + + +N67->N58 + + + + + + + 10ms + + + + + +N68->N59 + + + + + + + 30ms + + + + + +N69->N1 + + + + + + + 10ms + + + + + +N70 + + +controller +(*Controller[go +shape +struct { k8s +io/apimachinery/pkg/types +NamespacedName }]) +Reconcile +0 of 10ms (14.29%) + + + + + +N70->N21 + + + + + + + 10ms + + + + + +N72 + + +controller +(*Controller[go +shape +struct { k8s +io/apimachinery/pkg/types +NamespacedName }]) +reconcileHandler +0 of 10ms (14.29%) + + + + + +N71->N72 + + + + + + + 10ms + + + + + +N72->N70 + + + + + + + 10ms + + + + + +N73 + + +syscall +RawSyscall6 +0 of 10ms (14.29%) + + + + + +N73->N1 + + + + + + + 10ms + + + + + +N76 + + +syscall +read +0 of 10ms (14.29%) + + + + + +N74->N76 + + + + + + + 10ms + + + + + +N75 + + +syscall +Syscall +0 of 10ms (14.29%) + + + + + +N75->N73 + + + + + + + 10ms + + + + + +N76->N75 + + + + + + + 10ms + + + + + diff --git a/internal/istiostatus/new_pprof_with_labelselector_gardener.svg b/internal/istiostatus/new_pprof_with_labelselector_gardener.svg new file mode 100644 index 000000000..61bd954a6 --- /dev/null +++ b/internal/istiostatus/new_pprof_with_labelselector_gardener.svg @@ -0,0 +1,1396 @@ + + + + + + +manager + + +cluster_L + + + + +File: manager + + +File: manager +Type: cpu +Time: Sep 10, 2024 at 11:21pm (CEST) +Duration: 30s, Total samples = 30ms (  0.1%) +Showing nodes accounting for 30ms, 100% of 30ms total +See https://git.io/JfYMW for how to read the graph + + + + + +N1 + + +bytes +(*Buffer) +ReadFrom +10ms (33.33%) + + + + + +N2 + + +bigmod +addMulVVW1024 +10ms (33.33%) + + + + + +N3 + + +io +ReadAll +10ms (33.33%) + + + + + +N4 + + +http2 +(*ClientConn) +readLoop +0 of 10ms (33.33%) + + + + + +N30 + + +http2 +(*clientConnReadLoop) +run +0 of 10ms (33.33%) + + + + + +N4->N30 + + + + + + + 10ms + + + + + +N5 + + +http +(*conn) +serve +0 of 10ms (33.33%) + + + + + +N14 + + +tls +(*Conn) +HandshakeContext +0 of 10ms (33.33%) + + + + + +N5->N14 + + + + + + + 10ms + (inline) + + + + + +N6 + + +controller +(*Controller[go +shape +struct { k8s +io/apimachinery/pkg/types +NamespacedName }]) +Start +func2 +2 +0 of 10ms (33.33%) + + + + + +N44 + + +controller +(*Controller[go +shape +struct { k8s +io/apimachinery/pkg/types +NamespacedName }]) +processNextWorkItem +0 of 10ms (33.33%) + + + + + +N6->N44 + + + + + + + 10ms + + + + + +N7 + + +bufio +(*Reader) +Read +0 of 10ms (33.33%) + + + + + +N15 + + +tls +(*Conn) +Read +0 of 10ms (33.33%) + + + + + +N7->N15 + + + + + + + 10ms + + + + + +N8 + + +bigmod +(*Nat) +Exp +0 of 10ms (33.33%) + + + + + +N9 + + +bigmod +(*Nat) +montgomeryMul +0 of 10ms (33.33%) + + + + + +N8->N9 + + + + + + + 10ms + + + + + +N9->N2 + + + + + + + 10ms + + + + + +N10 + + +rsa +(*PrivateKey) +Sign +0 of 10ms (33.33%) + + + + + +N11 + + +rsa +SignPSS +0 of 10ms (33.33%) + + + + + +N10->N11 + + + + + + + 10ms + + + + + +N13 + + +rsa +signPSSWithSalt +0 of 10ms (33.33%) + + + + + +N11->N13 + + + + + + + 10ms + + + + + +N12 + + +rsa +decrypt +0 of 10ms (33.33%) + + + + + +N12->N8 + + + + + + + 10ms + + + + + +N13->N12 + + + + + + + 10ms + + + + + +N16 + + +tls +(*Conn) +handshakeContext +0 of 10ms (33.33%) + + + + + +N14->N16 + + + + + + + 10ms + + + + + +N18 + + +tls +(*Conn) +readRecord +0 of 10ms (33.33%) + + + + + +N15->N18 + + + + + + + 10ms + (inline) + + + + + +N20 + + +tls +(*Conn) +serverHandshake +0 of 10ms (33.33%) + + + + + +N16->N20 + + + + + + + 10ms + + + + + +N17 + + +tls +(*Conn) +readFromUntil +0 of 10ms (33.33%) + + + + + +N17->N1 + + + + + + + 10ms + + + + + +N19 + + +tls +(*Conn) +readRecordOrCCS +0 of 10ms (33.33%) + + + + + +N18->N19 + + + + + + + 10ms + + + + + +N19->N17 + + + + + + + 10ms + + + + + +N21 + + +tls +(*serverHandshakeStateTLS13) +handshake +0 of 10ms (33.33%) + + + + + +N20->N21 + + + + + + + 10ms + + + + + +N22 + + +tls +(*serverHandshakeStateTLS13) +sendServerCertificate +0 of 10ms (33.33%) + + + + + +N21->N22 + + + + + + + 10ms + + + + + +N22->N10 + + + + + + + 10ms + + + + + +N23 + + +telemetry +(*LogPipelineController) +Reconcile +0 of 10ms (33.33%) + + + + + +N25 + + +logpipeline +(*Reconciler) +Reconcile +0 of 10ms (33.33%) + + + + + +N23->N25 + + + + + + + 10ms + + + + + +N24 + + +k8sutils +CreateOrUpdateDaemonSet +0 of 10ms (33.33%) + + + + + +N42 + + +interceptor +interceptor +Update +0 of 10ms (33.33%) + + + + + +N24->N42 + + + + + + + 10ms + + + + + +N26 + + +logpipeline +(*Reconciler) +doReconcile +0 of 10ms (33.33%) + + + + + +N25->N26 + + + + + + + 10ms + + + + + +N27 + + +logpipeline +(*Reconciler) +reconcileFluentBit +0 of 10ms (33.33%) + + + + + +N26->N27 + + + + + + + 10ms + + + + + +N27->N24 + + + + + + + 10ms + + + + + +N28 + + +logpipeline +(*Reconciler) +reconcileFluentBit +NewOwnerReferenceSetter +func2 +0 of 10ms (33.33%) + + + + + +N40 + + +client +(*client) +Update +0 of 10ms (33.33%) + + + + + +N28->N40 + + + + + + + 10ms + + + + + +N29 + + +http2 +(*Framer) +ReadFrame +0 of 10ms (33.33%) + + + + + +N31 + + +http2 +readFrameHeader +0 of 10ms (33.33%) + + + + + +N29->N31 + + + + + + + 10ms + + + + + +N30->N29 + + + + + + + 10ms + + + + + +N33 + + +io +ReadFull +0 of 10ms (33.33%) + + + + + +N31->N33 + + + + + + + 10ms + (inline) + + + + + +N32 + + +io +ReadAtLeast +0 of 10ms (33.33%) + + + + + +N32->N7 + + + + + + + 10ms + + + + + +N33->N32 + + + + + + + 10ms + + + + + +N34 + + +rest +(*Request) +Do +0 of 10ms (33.33%) + + + + + +N36 + + +rest +(*Request) +request +0 of 10ms (33.33%) + + + + + +N34->N36 + + + + + + + 10ms + + + + + +N35 + + +rest +(*Request) +Do +func1 +0 of 10ms (33.33%) + + + + + +N39 + + +rest +(*Request) +transformResponse +0 of 10ms (33.33%) + + + + + +N35->N39 + + + + + + + 10ms + + + + + +N37 + + +rest +(*Request) +request +func3 +0 of 10ms (33.33%) + + + + + +N36->N37 + + + + + + + 10ms + + + + + +N38 + + +rest +(*Request) +request +func3 +1 +0 of 10ms (33.33%) + + + + + +N37->N38 + + + + + + + 10ms + (inline) + + + + + +N38->N35 + + + + + + + 10ms + + + + + +N39->N3 + + + + + + + 10ms + + + + + +N41 + + +client +(*typedClient) +Update +0 of 10ms (33.33%) + + + + + +N40->N41 + + + + + + + 10ms + + + + + +N41->N34 + + + + + + + 10ms + + + + + +N42->N28 + + + + + + + 10ms + + + + + +N43 + + +controller +(*Controller[go +shape +struct { k8s +io/apimachinery/pkg/types +NamespacedName }]) +Reconcile +0 of 10ms (33.33%) + + + + + +N43->N23 + + + + + + + 10ms + + + + + +N45 + + +controller +(*Controller[go +shape +struct { k8s +io/apimachinery/pkg/types +NamespacedName }]) +reconcileHandler +0 of 10ms (33.33%) + + + + + +N44->N45 + + + + + + + 10ms + + + + + +N45->N43 + + + + + + + 10ms + + + + + diff --git a/internal/istiostatus/old_pprof_gardener.svg b/internal/istiostatus/old_pprof_gardener.svg new file mode 100644 index 000000000..2d1642c02 --- /dev/null +++ b/internal/istiostatus/old_pprof_gardener.svg @@ -0,0 +1,1759 @@ + + + + + + +manager + + +cluster_L + + + + +File: manager + + +File: manager +Type: cpu +Time: Sep 10, 2024 at 11:09pm (CEST) +Duration: 30s, Total samples = 90ms (  0.3%) +Showing nodes accounting for 90ms, 100% of 90ms total +See https://git.io/JfYMW for how to read the graph + + + + + +N1 + + +runtime +systemstack +0 of 50ms (55.56%) + + + + + +N6 + + +runtime +gcBgMarkWorker +func2 +0 of 40ms (44.44%) + + + + + +N1->N6 + + + + + + + 40ms + + + + + +N43 + + +runtime +(*mheap) +alloc +func1 +0 of 10ms (11.11%) + + + + + +N1->N43 + + + + + + + 10ms + + + + + +N2 + + +runtime +mallocgc +10ms (11.11%) +of 40ms (44.44%) + + + + + +N38 + + +runtime +(*mcache) +nextFree +0 of 20ms (22.22%) + + + + + +N2->N38 + + + + + + + 20ms + + + + + +N49 + + +runtime +heapSetType +0 of 10ms (11.11%) + + + + + +N2->N49 + + + + + + + 10ms + + + + + +N3 + + +runtime +scanobject +10ms (11.11%) +of 40ms (44.44%) + + + + + +N16 + + +runtime +greyobject +0 of 20ms (22.22%) + + + + + +N3->N16 + + + + + + + 20ms + + + + + +N17 + + +runtime +typePointers +nextFast +10ms (11.11%) + + + + + +N3->N17 + + + + + + + 10ms + (inline) + + + + + +N4 + + +v1 +(*JSONSchemaProps) +DeepCopy +0 of 30ms (33.33%) + + + + + +N8 + + +runtime +newobject +0 of 40ms (44.44%) + + + + + +N4->N8 + + + + + + + 30ms + + + + + +N35 + + +v1 +(*JSONSchemaPropsOrArray) +DeepCopyInto +0 of 30ms (33.33%) + + + + + +N4->N35 + + + + + + + 30ms + + + + + +N5 + + +runtime +gcBgMarkWorker +0 of 40ms (44.44%) + + + + + +N5->N1 + + + + + + + 40ms + + + + + +N47 + + +runtime +gcDrainMarkWorkerDedicated +0 of 20ms (22.22%) + + + + + +N6->N47 + + + + + + + 20ms + (inline) + + + + + +N48 + + +runtime +gcDrainMarkWorkerIdle +0 of 20ms (22.22%) + + + + + +N6->N48 + + + + + + + 20ms + (inline) + + + + + +N7 + + +runtime +gcDrain +0 of 40ms (44.44%) + + + + + +N7->N3 + + + + + + + 40ms + + + + + +N8->N2 + + + + + + + 40ms + + + + + +N9 + + +controller +(*Controller[go +shape +struct { k8s +io/apimachinery/pkg/types +NamespacedName }]) +Start +func2 +2 +0 of 30ms (33.33%) + + + + + +N57 + + +controller +(*Controller[go +shape +struct { k8s +io/apimachinery/pkg/types +NamespacedName }]) +processNextWorkItem +0 of 30ms (33.33%) + + + + + +N9->N57 + + + + + + + 30ms + + + + + +N10 + + +runtime +(*mcache) +refill +0 of 20ms (22.22%) + + + + + +N39 + + +runtime +(*mcentral) +cacheSpan +0 of 10ms (11.11%) + + + + + +N10->N39 + + + + + + + 10ms + + + + + +N41 + + +runtime +(*mcentral) +uncacheSpan +0 of 10ms (11.11%) + + + + + +N10->N41 + + + + + + + 10ms + + + + + +N11 + + +runtime +(*mheap) +allocSpan +10ms (11.11%) + + + + + +N12 + + +runtime +(*mspan) +base +10ms (11.11%) + + + + + +N13 + + +runtime +(*mspan) +writeHeapBitsSmall +10ms (11.11%) + + + + + +N14 + + +runtime +(*spanSet) +push +10ms (11.11%) + + + + + +N15 + + +runtime +addb +10ms (11.11%) + + + + + +N16->N12 + + + + + + + 10ms + (inline) + + + + + +N45 + + +runtime +(*mspan) +markBitsForIndex +0 of 10ms (11.11%) + + + + + +N16->N45 + + + + + + + 10ms + (inline) + + + + + +N18 + + +atomic +(*Uint32) +Add +10ms (11.11%) + + + + + +N19 + + +http2 +(*ClientConn) +readLoop +0 of 10ms (11.11%) + + + + + +N28 + + +http2 +(*clientConnReadLoop) +run +0 of 10ms (11.11%) + + + + + +N19->N28 + + + + + + + 10ms + + + + + +N20 + + +runtime +bgsweep +0 of 10ms (11.11%) + + + + + +N51 + + +runtime +sweepone +0 of 10ms (11.11%) + + + + + +N20->N51 + + + + + + + 10ms + + + + + +N21 + + +telemetry +(*LogPipelineController) +Reconcile +0 of 30ms (33.33%) + + + + + +N23 + + +logpipeline +(*Reconciler) +Reconcile +0 of 30ms (33.33%) + + + + + +N21->N23 + + + + + + + 30ms + + + + + +N22 + + +istiostatus +(*Checker) +IsIstioActive +0 of 30ms (33.33%) + + + + + +N55 + + +client +(*client) +List +0 of 30ms (33.33%) + + + + + +N22->N55 + + + + + + + 30ms + + + + + +N24 + + +logpipeline +(*Reconciler) +doReconcile +0 of 30ms (33.33%) + + + + + +N23->N24 + + + + + + + 30ms + + + + + +N25 + + +logpipeline +(*Reconciler) +reconcileFluentBit +0 of 30ms (33.33%) + + + + + +N24->N25 + + + + + + + 30ms + + + + + +N25->N22 + + + + + + + 30ms + + + + + +N26 + + +http2 +(*clientConnReadLoop) +handleResponse +0 of 10ms (11.11%) + + + + + +N50 + + +runtime +mapassign_faststr +0 of 10ms (11.11%) + + + + + +N26->N50 + + + + + + + 10ms + + + + + +N27 + + +http2 +(*clientConnReadLoop) +processHeaders +0 of 10ms (11.11%) + + + + + +N27->N26 + + + + + + + 10ms + + + + + +N28->N27 + + + + + + + 10ms + + + + + +N29 + + +v1 +(*CustomResourceDefinition) +DeepCopy +0 of 30ms (33.33%) + + + + + +N30 + + +v1 +(*CustomResourceDefinition) +DeepCopyInto +0 of 30ms (33.33%) + + + + + +N29->N30 + + + + + + + 30ms + + + + + +N32 + + +v1 +(*CustomResourceDefinitionSpec) +DeepCopyInto +0 of 30ms (33.33%) + + + + + +N30->N32 + + + + + + + 30ms + + + + + +N31 + + +v1 +(*CustomResourceDefinition) +DeepCopyObject +0 of 30ms (33.33%) + + + + + +N31->N29 + + + + + + + 30ms + (inline) + + + + + +N33 + + +v1 +(*CustomResourceDefinitionVersion) +DeepCopyInto +0 of 30ms (33.33%) + + + + + +N32->N33 + + + + + + + 30ms + + + + + +N34 + + +v1 +(*CustomResourceValidation) +DeepCopyInto +0 of 30ms (33.33%) + + + + + +N33->N34 + + + + + + + 30ms + + + + + +N34->N4 + + + + + + + 30ms + + + + + +N35->N4 + + + + + + + 30ms + + + + + +N36 + + +runtime +(*gcBits) +bitp +0 of 10ms (11.11%) + + + + + +N37 + + +runtime +(*gcBits) +bytep +0 of 10ms (11.11%) + + + + + +N36->N37 + + + + + + + 10ms + (inline) + + + + + +N37->N15 + + + + + + + 10ms + (inline) + + + + + +N38->N10 + + + + + + + 20ms + + + + + +N40 + + +runtime +(*mcentral) +grow +0 of 10ms (11.11%) + + + + + +N39->N40 + + + + + + + 10ms + + + + + +N42 + + +runtime +(*mheap) +alloc +0 of 10ms (11.11%) + + + + + +N40->N42 + + + + + + + 10ms + + + + + +N41->N14 + + + + + + + 10ms + + + + + +N42->N1 + + + + + + + 10ms + + + + + +N43->N11 + + + + + + + 10ms + + + + + +N44 + + +runtime +(*mheap) +nextSpanForSweep +0 of 10ms (11.11%) + + + + + +N46 + + +runtime +(*spanSet) +pop +0 of 10ms (11.11%) + + + + + +N44->N46 + + + + + + + 10ms + + + + + +N45->N36 + + + + + + + 10ms + (inline) + + + + + +N46->N18 + + + + + + + 10ms + (inline) + + + + + +N47->N7 + + + + + + + 20ms + + + + + +N48->N7 + + + + + + + 20ms + + + + + +N49->N13 + + + + + + + 10ms + + + + + +N50->N8 + + + + + + + 10ms + (inline) + + + + + +N51->N44 + + + + + + + 10ms + + + + + +N52 + + +cache +(*delegatingByGVKCache) +List +0 of 30ms (33.33%) + + + + + +N53 + + +cache +(*informerCache) +List +0 of 30ms (33.33%) + + + + + +N52->N53 + + + + + + + 30ms + + + + + +N54 + + +internal +(*CacheReader) +List +0 of 30ms (33.33%) + + + + + +N53->N54 + + + + + + + 30ms + + + + + +N54->N31 + + + + + + + 30ms + + + + + +N55->N52 + + + + + + + 30ms + + + + + +N56 + + +controller +(*Controller[go +shape +struct { k8s +io/apimachinery/pkg/types +NamespacedName }]) +Reconcile +0 of 30ms (33.33%) + + + + + +N56->N21 + + + + + + + 30ms + + + + + +N58 + + +controller +(*Controller[go +shape +struct { k8s +io/apimachinery/pkg/types +NamespacedName }]) +reconcileHandler +0 of 30ms (33.33%) + + + + + +N57->N58 + + + + + + + 30ms + + + + + +N58->N56 + + + + + + + 30ms + + + + + From 5ece73fc806686e09a271c9fe0b73d76d5941b6f Mon Sep 17 00:00:00 2001 From: Jeffrey Limnardy Date: Tue, 17 Sep 2024 11:05:37 +0200 Subject: [PATCH 4/8] implement discovery api --- .../telemetry/logpipeline_controller.go | 10 +- .../telemetry/metricpipeline_controller.go | 11 +- .../telemetry/tracepipeline_controller.go | 11 +- internal/discovery/client.go | 17 ++- internal/discovery/config.go | 101 ------------------ internal/istiostatus/istio_status_checker.go | 38 ++----- .../istio_status_checker_discoveryapi.go | 33 ------ .../istio_status_checker_discoveryapi_test.go | 61 ----------- .../istiostatus/istio_status_checker_test.go | 46 ++++---- internal/reconciler/logpipeline/reconciler.go | 2 + main.go | 1 + 11 files changed, 68 insertions(+), 263 deletions(-) delete mode 100644 internal/discovery/config.go delete mode 100644 internal/istiostatus/istio_status_checker_discoveryapi.go delete mode 100644 internal/istiostatus/istio_status_checker_discoveryapi_test.go diff --git a/controllers/telemetry/logpipeline_controller.go b/controllers/telemetry/logpipeline_controller.go index 1e989149e..254323f66 100644 --- a/controllers/telemetry/logpipeline_controller.go +++ b/controllers/telemetry/logpipeline_controller.go @@ -18,6 +18,8 @@ limitations under the License. import ( "context" + "github.com/kyma-project/telemetry-manager/internal/discovery" + "k8s.io/client-go/rest" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" @@ -65,6 +67,7 @@ type LogPipelineControllerConfig struct { PriorityClassName string SelfMonitorName string TelemetryNamespace string + RestConfig *rest.Config } func NewLogPipelineController(client client.Client, reconcileTriggerChan <-chan event.GenericEvent, config LogPipelineControllerConfig) (*LogPipelineController, error) { @@ -72,7 +75,6 @@ func NewLogPipelineController(client client.Client, reconcileTriggerChan <-chan if err != nil { return nil, err } - reconcilerCfg := logpipeline.Config{ SectionsConfigMap: types.NamespacedName{Name: "telemetry-fluent-bit-sections", Namespace: config.TelemetryNamespace}, FilesConfigMap: types.NamespacedName{Name: "telemetry-fluent-bit-files", Namespace: config.TelemetryNamespace}, @@ -99,12 +101,16 @@ func NewLogPipelineController(client client.Client, reconcileTriggerChan <-chan SecretRefValidator: &secretref.Validator{Client: client}, } + discoveryClient, err := discovery.MakeDiscoveryClient(config.RestConfig) + if err != nil { + return nil, err + } reconciler := logpipeline.New( client, reconcilerCfg, &workloadstatus.DaemonSetProber{Client: client}, flowHealthProber, - istiostatus.NewChecker(client), + istiostatus.NewChecker(discoveryClient), overrides.New(client, overrides.HandlerConfig{SystemNamespace: config.TelemetryNamespace}), pipelineValidator, &conditions.ErrorToMessageConverter{}, diff --git a/controllers/telemetry/metricpipeline_controller.go b/controllers/telemetry/metricpipeline_controller.go index 9c8bc8076..1e2fb0368 100644 --- a/controllers/telemetry/metricpipeline_controller.go +++ b/controllers/telemetry/metricpipeline_controller.go @@ -19,6 +19,8 @@ package telemetry import ( "context" "fmt" + "github.com/kyma-project/telemetry-manager/internal/discovery" + "k8s.io/client-go/rest" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" @@ -62,7 +64,7 @@ type MetricPipelineController struct { type MetricPipelineControllerConfig struct { metricpipeline.Config - + RestConfig *rest.Config SelfMonitorName string TelemetryNamespace string } @@ -84,7 +86,10 @@ func NewMetricPipelineController(client client.Client, reconcileTriggerChan <-ch agentRBAC := otelcollector.MakeMetricAgentRBAC(types.NamespacedName{Name: config.Agent.BaseName, Namespace: config.Agent.Namespace}) gatewayRBAC := otelcollector.MakeMetricGatewayRBAC(types.NamespacedName{Name: config.Gateway.BaseName, Namespace: config.Gateway.Namespace}, config.KymaInputAllowed) - + discoveryClient, err := discovery.MakeDiscoveryClient(config.RestConfig) + if err != nil { + return nil, err + } reconciler := metricpipeline.New( client, config.Config, @@ -99,7 +104,7 @@ func NewMetricPipelineController(client client.Client, reconcileTriggerChan <-ch &otelcollector.GatewayApplierDeleter{Config: config.Gateway, RBAC: gatewayRBAC}, &gateway.Builder{Reader: client}, &workloadstatus.DeploymentProber{Client: client}, - istiostatus.NewChecker(client), + istiostatus.NewChecker(discoveryClient), overrides.New(client, overrides.HandlerConfig{SystemNamespace: config.TelemetryNamespace}), pipelineLock, pipelineValidator, diff --git a/controllers/telemetry/tracepipeline_controller.go b/controllers/telemetry/tracepipeline_controller.go index d3a974bbd..70540443e 100644 --- a/controllers/telemetry/tracepipeline_controller.go +++ b/controllers/telemetry/tracepipeline_controller.go @@ -19,6 +19,8 @@ limitations under the License. import ( "context" "fmt" + "k8s.io/client-go/discovery" + "k8s.io/client-go/rest" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" @@ -60,7 +62,7 @@ type TracePipelineController struct { type TracePipelineControllerConfig struct { tracepipeline.Config - + RestConfig *rest.Config SelfMonitorName string TelemetryNamespace string } @@ -81,7 +83,10 @@ func NewTracePipelineController(client client.Client, reconcileTriggerChan <-cha } gatewayRBAC := otelcollector.MakeTraceGatewayRBAC(types.NamespacedName{Name: config.Gateway.BaseName, Namespace: config.Gateway.Namespace}) - + discoveryClient, err := discovery.NewDiscoveryClientForConfig(config.RestConfig) + if err != nil { + return nil, err + } reconciler := tracepipeline.New( client, config.Config, @@ -89,7 +94,7 @@ func NewTracePipelineController(client client.Client, reconcileTriggerChan <-cha &otelcollector.GatewayApplierDeleter{Config: config.Gateway, RBAC: gatewayRBAC}, &gateway.Builder{Reader: client}, &workloadstatus.DeploymentProber{Client: client}, - istiostatus.NewChecker(client), + istiostatus.NewChecker(discoveryClient), overrides.New(client, overrides.HandlerConfig{SystemNamespace: config.TelemetryNamespace}), pipelineLock, pipelineValidator, diff --git a/internal/discovery/client.go b/internal/discovery/client.go index 4de77d01f..ca7275553 100644 --- a/internal/discovery/client.go +++ b/internal/discovery/client.go @@ -1,18 +1,13 @@ package discovery -import "k8s.io/client-go/discovery" +import ( + "k8s.io/client-go/discovery" + "k8s.io/client-go/rest" +) -func MakeDiscoveryClient(apiConf APIConfig) (discovery.DiscoveryInterface, error) { - if err := apiConf.Validate(); err != nil { - return nil, err - } - - authConf, err := CreateRestConfig(apiConf) - if err != nil { - return nil, err - } +func MakeDiscoveryClient(restConfig *rest.Config) (discovery.DiscoveryInterface, error) { - discoveryClient, err := discovery.NewDiscoveryClientForConfig(authConf) + discoveryClient, err := discovery.NewDiscoveryClientForConfig(restConfig) if err != nil { return nil, err } diff --git a/internal/discovery/config.go b/internal/discovery/config.go deleted file mode 100644 index 4091828cb..000000000 --- a/internal/discovery/config.go +++ /dev/null @@ -1,101 +0,0 @@ -package discovery - -import ( - "fmt" - "k8s.io/client-go/rest" - "k8s.io/client-go/tools/clientcmd" - "net" - "net/http" - "os" -) - -type AuthType string - -const ( - // AuthTypeNone means no auth is required - AuthTypeNone AuthType = "none" - // AuthTypeServiceAccount means to use the built-in service account that - // K8s automatically provisions for each pod. - AuthTypeServiceAccount AuthType = "serviceAccount" - // AuthTypeKubeConfig uses local credentials like those used by kubectl. - AuthTypeKubeConfig AuthType = "kubeConfig" -) - -var authTypes = map[AuthType]bool{ - AuthTypeNone: true, - AuthTypeServiceAccount: true, - AuthTypeKubeConfig: true, -} - -// APIConfig contains options relevant to connecting to the K8s API -type APIConfig struct { - // How to authenticate to the K8s API server. This can be one of `none` - // (for no auth), `serviceAccount` (to use the standard service account - // token provided to the agent pod), or `kubeConfig` to use credentials - // from `~/.kube/config`. - AuthType AuthType `mapstructure:"auth_type"` - - // When using auth_type `kubeConfig`, override the current context. - Context string `mapstructure:"context"` -} - -// Validate validates the K8s API config -func (c APIConfig) Validate() error { - if !authTypes[c.AuthType] { - return fmt.Errorf("invalid authType for kubernetes: %v", c.AuthType) - } - - return nil -} - -func CreateRestConfig(apiConf APIConfig) (*rest.Config, error) { - var authConf *rest.Config - var err error - - authType := apiConf.AuthType - var k8sHost string - if authType != AuthTypeKubeConfig { - host, port := os.Getenv("KUBERNETES_SERVICE_HOST"), os.Getenv("KUBERNETES_SERVICE_PORT") - if len(host) == 0 || len(port) == 0 { - return nil, fmt.Errorf("unable to load k8s config, KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT must be defined") - } - k8sHost = "https://" + net.JoinHostPort(host, port) - } - - switch authType { - case AuthTypeKubeConfig: - loadingRules := clientcmd.NewDefaultClientConfigLoadingRules() - configOverrides := &clientcmd.ConfigOverrides{} - if apiConf.Context != "" { - configOverrides.CurrentContext = apiConf.Context - } - authConf, err = clientcmd.NewNonInteractiveDeferredLoadingClientConfig( - loadingRules, configOverrides).ClientConfig() - - if err != nil { - return nil, fmt.Errorf("error connecting to k8s with auth_type=%s: %w", AuthTypeKubeConfig, err) - } - case AuthTypeNone: - authConf = &rest.Config{ - Host: k8sHost, - } - authConf.Insecure = true - case AuthTypeServiceAccount: - // This should work for most clusters but other auth types can be added - authConf, err = rest.InClusterConfig() - if err != nil { - return nil, err - } - } - - authConf.WrapTransport = func(rt http.RoundTripper) http.RoundTripper { - // Don't use system proxy settings since the API is local to the - // cluster - if t, ok := rt.(*http.Transport); ok { - t.Proxy = nil - } - return rt - } - - return authConf, nil -} diff --git a/internal/istiostatus/istio_status_checker.go b/internal/istiostatus/istio_status_checker.go index 5d537010f..f43975db5 100644 --- a/internal/istiostatus/istio_status_checker.go +++ b/internal/istiostatus/istio_status_checker.go @@ -2,48 +2,32 @@ package istiostatus import ( "context" - apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" - "k8s.io/apimachinery/pkg/labels" - "sigs.k8s.io/controller-runtime/pkg/client" + "k8s.io/client-go/discovery" logf "sigs.k8s.io/controller-runtime/pkg/log" + "strings" ) type Checker struct { - client client.Reader + discovery discovery.DiscoveryInterface } -const peerAuthenticationIstioCRD = "peerauthentications.security.istio.io" - -func NewChecker(client client.Reader) *Checker { - return &Checker{ - client: client, - } - +func NewChecker(d discovery.DiscoveryInterface) *Checker { + return &Checker{discovery: d} } // IsIstioActive checks if Istio is active on the cluster based on the presence of Istio CRDs func (isc *Checker) IsIstioActive(ctx context.Context) bool { - var crdList apiextensionsv1.CustomResourceDefinitionList - //add fieldselector to improve performance with large crds -> doesn't work with fakeclient - //listOptions := &client.ListOptions{ - // FieldSelector: fields.SelectorFromSet(fields.Set{"metadata.name": peerAuthenticationIstioCRD}), - //} - //add labelselector to improve performance with large crds by filtering to list only crds with certain labels - //use labelselector because the fieldselector doesn't work with the fake client - istioLabels := labels.Set{"app": "istio-pilot"} - listOptions := &client.ListOptions{ - LabelSelector: labels.SelectorFromSet(istioLabels), - } - if err := isc.client.List(ctx, &crdList, listOptions); err != nil { - logf.FromContext(ctx).Error(err, "Unable to list CRDs to check Istio status") - return false + groupList, err := isc.discovery.ServerGroups() + if err != nil { + logf.FromContext(ctx).Error(err, "error getting group list from server") } - for _, crd := range crdList.Items { - if crd.GetName() == peerAuthenticationIstioCRD { + for _, group := range groupList.Groups { + if strings.Contains(group.Name, ".istio.io") { return true } } return false + } diff --git a/internal/istiostatus/istio_status_checker_discoveryapi.go b/internal/istiostatus/istio_status_checker_discoveryapi.go deleted file mode 100644 index a30fa6b7e..000000000 --- a/internal/istiostatus/istio_status_checker_discoveryapi.go +++ /dev/null @@ -1,33 +0,0 @@ -package istiostatus - -import ( - "context" - "k8s.io/client-go/discovery" - logf "sigs.k8s.io/controller-runtime/pkg/log" - "strings" -) - -type CheckerDiscoveryAPI struct { - discovery discovery.DiscoveryInterface -} - -func NewCheckerDiscoveryAPI(d discovery.DiscoveryInterface) *CheckerDiscoveryAPI { - return &CheckerDiscoveryAPI{discovery: d} -} - -// IsIstioActiveDiscoveryAPI checks if Istio is active on the cluster based on the presence of Istio CRDs -func (isc *CheckerDiscoveryAPI) IsIstioActiveDiscoveryAPI(ctx context.Context) bool { - - groupList, err := isc.discovery.ServerGroups() - if err != nil { - logf.FromContext(ctx).Error(err, "error getting group list from server") - } - - for _, group := range groupList.Groups { - if strings.Contains(group.Name, ".istio.io") { - return true - } - } - return false - -} diff --git a/internal/istiostatus/istio_status_checker_discoveryapi_test.go b/internal/istiostatus/istio_status_checker_discoveryapi_test.go deleted file mode 100644 index 511ad5730..000000000 --- a/internal/istiostatus/istio_status_checker_discoveryapi_test.go +++ /dev/null @@ -1,61 +0,0 @@ -package istiostatus - -import ( - "context" - "testing" - - "github.com/stretchr/testify/assert" - apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - discoveryfake "k8s.io/client-go/discovery/fake" - clientgoscheme "k8s.io/client-go/kubernetes/scheme" - clienttesting "k8s.io/client-go/testing" -) - -func TestIsIstioActiveDiscoveryAPI(t *testing.T) { - scheme := clientgoscheme.Scheme - err := apiextensionsv1.AddToScheme(scheme) - if err != nil { - t.Fatalf("failed to add api extensions v1 scheme: %v", err) - } - tests := []struct { - name string - resources []*metav1.APIResourceList - want bool - }{ - { - name: "should return true if peerauthentication crd found", - resources: []*metav1.APIResourceList{ - { - GroupVersion: "peerauthentication.security.istio.io/v1beta1", - APIResources: []metav1.APIResource{}, - }, - }, - want: true, - }, - { - name: "should return false if peerauthentication not crd found", - resources: []*metav1.APIResourceList{ - { - GroupVersion: "operator.kyma-project.io/v1beta1", - APIResources: []metav1.APIResource{}, - }, - }, - want: false, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - discovery := discoveryfake.FakeDiscovery{ - Fake: &clienttesting.Fake{ - Resources: tt.resources, - }, - } - checker := NewCheckerDiscoveryAPI(&discovery) - got := checker.IsIstioActiveDiscoveryAPI(context.Background()) - - assert.Equal(t, tt.want, got) - }) - } -} diff --git a/internal/istiostatus/istio_status_checker_test.go b/internal/istiostatus/istio_status_checker_test.go index 4a645997d..fa4aedecb 100644 --- a/internal/istiostatus/istio_status_checker_test.go +++ b/internal/istiostatus/istio_status_checker_test.go @@ -7,51 +7,53 @@ import ( "github.com/stretchr/testify/assert" apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + discoveryfake "k8s.io/client-go/discovery/fake" clientgoscheme "k8s.io/client-go/kubernetes/scheme" - "sigs.k8s.io/controller-runtime/pkg/client/fake" + clienttesting "k8s.io/client-go/testing" ) func TestIsIstioActive(t *testing.T) { scheme := clientgoscheme.Scheme - _ = apiextensionsv1.AddToScheme(scheme) - + err := apiextensionsv1.AddToScheme(scheme) + if err != nil { + t.Fatalf("failed to add api extensions v1 scheme: %v", err) + } tests := []struct { - name string - crds []*apiextensionsv1.CustomResourceDefinition - want bool + name string + resources []*metav1.APIResourceList + want bool }{ { name: "should return true if peerauthentication crd found", - crds: []*apiextensionsv1.CustomResourceDefinition{ + resources: []*metav1.APIResourceList{ { - ObjectMeta: metav1.ObjectMeta{ - Name: "peerauthentications.security.istio.io", - Labels: map[string]string{ - "app": "istio-pilot", - }, - }, + GroupVersion: "peerauthentication.security.istio.io/v1beta1", + APIResources: []metav1.APIResource{}, }, }, want: true, }, { name: "should return false if peerauthentication not crd found", - crds: []*apiextensionsv1.CustomResourceDefinition{}, + resources: []*metav1.APIResourceList{ + { + GroupVersion: "operator.kyma-project.io/v1beta1", + APIResources: []metav1.APIResource{}, + }, + }, want: false, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - fakeClientBuilder := fake.NewClientBuilder().WithScheme(scheme) - for _, crd := range tt.crds { - fakeClientBuilder.WithObjects(crd) + discovery := discoveryfake.FakeDiscovery{ + Fake: &clienttesting.Fake{ + Resources: tt.resources, + }, } - fakeClient := fakeClientBuilder.Build() - - isc := &Checker{client: fakeClient} - - got := isc.IsIstioActive(context.Background()) + checker := NewChecker(&discovery) + got := checker.IsIstioActive(context.Background()) assert.Equal(t, tt.want, got) }) diff --git a/internal/reconciler/logpipeline/reconciler.go b/internal/reconciler/logpipeline/reconciler.go index cea999bed..bf1d838b9 100644 --- a/internal/reconciler/logpipeline/reconciler.go +++ b/internal/reconciler/logpipeline/reconciler.go @@ -20,6 +20,7 @@ import ( "context" "errors" "fmt" + "k8s.io/client-go/rest" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" @@ -56,6 +57,7 @@ type Config struct { PipelineDefaults builder.PipelineDefaults Overrides overrides.Config DaemonSetConfig fluentbit.DaemonSetConfig + RestConfig rest.Config } type DaemonSetAnnotator interface { diff --git a/main.go b/main.go index 2bdc3a35b..e997f72a3 100644 --- a/main.go +++ b/main.go @@ -440,6 +440,7 @@ func enableLoggingController(mgr manager.Manager, reconcileTriggerChan <-chan ev PriorityClassName: fluentBitPriorityClassName, SelfMonitorName: selfMonitorName, TelemetryNamespace: telemetryNamespace, + RestConfig: mgr.GetConfig(), }, ) if err != nil { From 6d2860218e94c50aaaa4010e45c0615d43c1c09c Mon Sep 17 00:00:00 2001 From: Jeffrey Limnardy Date: Tue, 17 Sep 2024 13:06:01 +0200 Subject: [PATCH 5/8] remove old stuff --- internal/istiostatus/benchmark.md | 93 - .../new_pprof_discoveryapi_gardener.svg | 2137 ----------------- .../new_pprof_with_labelselector_gardener.svg | 1396 ----------- internal/istiostatus/old_pprof_gardener.svg | 1759 -------------- main.go | 2 + 5 files changed, 2 insertions(+), 5385 deletions(-) delete mode 100644 internal/istiostatus/benchmark.md delete mode 100644 internal/istiostatus/new_pprof_discoveryapi_gardener.svg delete mode 100644 internal/istiostatus/new_pprof_with_labelselector_gardener.svg delete mode 100644 internal/istiostatus/old_pprof_gardener.svg diff --git a/internal/istiostatus/benchmark.md b/internal/istiostatus/benchmark.md deleted file mode 100644 index 25fd0bfaa..000000000 --- a/internal/istiostatus/benchmark.md +++ /dev/null @@ -1,93 +0,0 @@ - -### Test in Gardener cluster, with old IsIstioActive function -``` -Showing nodes accounting for 90ms, 100% of 90ms total -Showing top 20 nodes out of 58 - flat flat% sum% cum cum% - 10ms 11.11% 11.11% 10ms 11.11% runtime.(*mheap).allocSpan - 10ms 11.11% 22.22% 10ms 11.11% runtime.(*mspan).base (inline) - 10ms 11.11% 33.33% 10ms 11.11% runtime.(*mspan).writeHeapBitsSmall - 10ms 11.11% 44.44% 10ms 11.11% runtime.(*spanSet).push - 10ms 11.11% 55.56% 10ms 11.11% runtime.addb (inline) - 10ms 11.11% 66.67% 40ms 44.44% runtime.mallocgc - 10ms 11.11% 77.78% 40ms 44.44% runtime.scanobject - 10ms 11.11% 88.89% 10ms 11.11% runtime.typePointers.nextFast (inline) - 10ms 11.11% 100% 10ms 11.11% runtime/internal/atomic.(*Uint32).Add - 0 0% 100% 30ms 33.33% github.com/kyma-project/telemetry-manager/controllers/telemetry.(*LogPipelineController).Reconcile - 0 0% 100% 30ms 33.33% github.com/kyma-project/telemetry-manager/internal/istiostatus.(*Checker).IsIstioActive - 0 0% 100% 30ms 33.33% github.com/kyma-project/telemetry-manager/internal/reconciler/logpipeline.(*Reconciler).Reconcile - 0 0% 100% 30ms 33.33% github.com/kyma-project/telemetry-manager/internal/reconciler/logpipeline.(*Reconciler).doReconcile - 0 0% 100% 30ms 33.33% github.com/kyma-project/telemetry-manager/internal/reconciler/logpipeline.(*Reconciler).reconcileFluentBit - 0 0% 100% 10ms 11.11% golang.org/x/net/http2.(*ClientConn).readLoop - 0 0% 100% 10ms 11.11% golang.org/x/net/http2.(*clientConnReadLoop).handleResponse - 0 0% 100% 10ms 11.11% golang.org/x/net/http2.(*clientConnReadLoop).processHeaders - 0 0% 100% 10ms 11.11% golang.org/x/net/http2.(*clientConnReadLoop).run - 0 0% 100% 30ms 33.33% k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1.(*CustomResourceDefinition).DeepCopy (inline) - 0 0% 100% 30ms 33.33% k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1.(*CustomResourceDefinition).DeepCopyInto -``` -old_pprof_gardener - -### Test in Gardener cluster, with labelselector approach for IsIstioActive -``` -Showing nodes accounting for 30ms, 100% of 30ms total -Showing top 30 nodes out of 45 - flat flat% sum% cum cum% - 10ms 33.33% 33.33% 10ms 33.33% bytes.(*Buffer).ReadFrom - 10ms 33.33% 66.67% 10ms 33.33% crypto/internal/bigmod.addMulVVW1024 - 10ms 33.33% 100% 10ms 33.33% io.ReadAll - 0 0% 100% 10ms 33.33% bufio.(*Reader).Read - 0 0% 100% 10ms 33.33% crypto/internal/bigmod.(*Nat).Exp - 0 0% 100% 10ms 33.33% crypto/internal/bigmod.(*Nat).montgomeryMul - 0 0% 100% 10ms 33.33% crypto/rsa.(*PrivateKey).Sign - 0 0% 100% 10ms 33.33% crypto/rsa.SignPSS - 0 0% 100% 10ms 33.33% crypto/rsa.decrypt - 0 0% 100% 10ms 33.33% crypto/rsa.signPSSWithSalt - 0 0% 100% 10ms 33.33% crypto/tls.(*Conn).HandshakeContext - 0 0% 100% 10ms 33.33% crypto/tls.(*Conn).Read - 0 0% 100% 10ms 33.33% crypto/tls.(*Conn).handshakeContext - 0 0% 100% 10ms 33.33% crypto/tls.(*Conn).readFromUntil - 0 0% 100% 10ms 33.33% crypto/tls.(*Conn).readRecord (inline) - 0 0% 100% 10ms 33.33% crypto/tls.(*Conn).readRecordOrCCS - 0 0% 100% 10ms 33.33% crypto/tls.(*Conn).serverHandshake - 0 0% 100% 10ms 33.33% crypto/tls.(*serverHandshakeStateTLS13).handshake - 0 0% 100% 10ms 33.33% crypto/tls.(*serverHandshakeStateTLS13).sendServerCertificate - 0 0% 100% 10ms 33.33% github.com/kyma-project/telemetry-manager/controllers/telemetry.(*LogPipelineController).Reconcile - 0 0% 100% 10ms 33.33% github.com/kyma-project/telemetry-manager/internal/k8sutils.CreateOrUpdateDaemonSet - 0 0% 100% 10ms 33.33% github.com/kyma-project/telemetry-manager/internal/reconciler/logpipeline.(*Reconciler).Reconcile - 0 0% 100% 10ms 33.33% github.com/kyma-project/telemetry-manager/internal/reconciler/logpipeline.(*Reconciler).doReconcile - 0 0% 100% 10ms 33.33% github.com/kyma-project/telemetry-manager/internal/reconciler/logpipeline.(*Reconciler).reconcileFluentBit - 0 0% 100% 10ms 33.33% github.com/kyma-project/telemetry-manager/internal/reconciler/logpipeline.(*Reconciler).reconcileFluentBit.NewOwnerReferenceSetter.func2 - 0 0% 100% 10ms 33.33% golang.org/x/net/http2.(*ClientConn).readLoop - 0 0% 100% 10ms 33.33% golang.org/x/net/http2.(*Framer).ReadFrame - 0 0% 100% 10ms 33.33% golang.org/x/net/http2.(*clientConnReadLoop).run - 0 0% 100% 10ms 33.33% golang.org/x/net/http2.readFrameHeader -``` -new_pprof_with_labelselector_gardener - -### Test in Gardener cluster, with discoveryapi approach for IsIstioActive - -Showing nodes accounting for 70ms, 100% of 70ms total -Showing top 20 nodes out of 76 -flat flat% sum% cum cum% -20ms 28.57% 28.57% 20ms 28.57% runtime/internal/syscall.Syscall6 -10ms 14.29% 42.86% 10ms 14.29% encoding/json.stateEndValue -10ms 14.29% 57.14% 10ms 14.29% k8s.io/client-go/rest.IsValidPathSegmentName -10ms 14.29% 71.43% 30ms 42.86% runtime.gcDrain -10ms 14.29% 85.71% 10ms 14.29% runtime.getempty -10ms 14.29% 100% 10ms 14.29% runtime.scanobject -0 0% 100% 10ms 14.29% bufio.(*Reader).Read -0 0% 100% 10ms 14.29% bytes.(*Buffer).ReadFrom -0 0% 100% 10ms 14.29% crypto/tls.(*Conn).Read -0 0% 100% 10ms 14.29% crypto/tls.(*Conn).readFromUntil -0 0% 100% 10ms 14.29% crypto/tls.(*Conn).readRecord (inline) -0 0% 100% 10ms 14.29% crypto/tls.(*Conn).readRecordOrCCS -0 0% 100% 10ms 14.29% crypto/tls.(*atLeastReader).Read -0 0% 100% 10ms 14.29% encoding/json.Unmarshal -0 0% 100% 10ms 14.29% encoding/json.checkValid -0 0% 100% 10ms 14.29% github.com/kyma-project/telemetry-manager/controllers/telemetry.(*LogPipelineController).Reconcile -0 0% 100% 10ms 14.29% github.com/kyma-project/telemetry-manager/internal/istiostatus.(*CheckerDiscoveryAPI).IsIstioActiveDiscoveryAPI -0 0% 100% 10ms 14.29% github.com/kyma-project/telemetry-manager/internal/reconciler/logpipeline.(*Reconciler).Reconcile -0 0% 100% 10ms 14.29% github.com/kyma-project/telemetry-manager/internal/reconciler/logpipeline.(*Reconciler).doReconcile -0 0% 100% 10ms 14.29% github.com/kyma-project/telemetry-manager/internal/reconciler/logpipeline.(*Reconciler).reconcileFluentBit - -new_pprof_with_discoveryapi_gardener \ No newline at end of file diff --git a/internal/istiostatus/new_pprof_discoveryapi_gardener.svg b/internal/istiostatus/new_pprof_discoveryapi_gardener.svg deleted file mode 100644 index ecf7123f4..000000000 --- a/internal/istiostatus/new_pprof_discoveryapi_gardener.svg +++ /dev/null @@ -1,2137 +0,0 @@ - - - - - - -manager - - -cluster_L - - - - -File: manager - - -File: manager -Type: cpu -Time: Sep 11, 2024 at 9:43am (CEST) -Duration: 30s, Total samples = 70ms ( 0.23%) -Showing nodes accounting for 70ms, 100% of 70ms total -See https://git.io/JfYMW for how to read the graph - - - - - -N1 - - -syscall -Syscall6 -20ms (28.57%) - - - - - -N2 - - -runtime -gcDrain -10ms (14.29%) -of 30ms (42.86%) - - - - - -N7 - - -runtime -scanobject -10ms (14.29%) - - - - - -N2->N7 - - - - - - - 10ms - - - - - -N62 - - -runtime -markroot -0 of 10ms (14.29%) - - - - - -N2->N62 - - - - - - - 10ms - - - - - -N3 - - -runtime -gcBgMarkWorker -0 of 30ms (42.86%) - - - - - -N68 - - -runtime -systemstack -0 of 30ms (42.86%) - - - - - -N3->N68 - - - - - - - 30ms - - - - - -N4 - - -json -stateEndValue -10ms (14.29%) - - - - - -N5 - - -rest -IsValidPathSegmentName -10ms (14.29%) - - - - - -N6 - - -runtime -getempty -10ms (14.29%) - - - - - -N8 - - -http2 -(*ClientConn) -readLoop -0 of 10ms (14.29%) - - - - - -N27 - - -http2 -(*clientConnReadLoop) -run -0 of 10ms (14.29%) - - - - - -N8->N27 - - - - - - - 10ms - - - - - -N9 - - -runtime -mcall -0 of 10ms (14.29%) - - - - - -N65 - - -runtime -park_m -0 of 10ms (14.29%) - - - - - -N9->N65 - - - - - - - 10ms - - - - - -N10 - - -controller -(*Controller[go -shape -struct { k8s -io/apimachinery/pkg/types -NamespacedName }]) -Start -func2 -2 -0 of 10ms (14.29%) - - - - - -N71 - - -controller -(*Controller[go -shape -struct { k8s -io/apimachinery/pkg/types -NamespacedName }]) -processNextWorkItem -0 of 10ms (14.29%) - - - - - -N10->N71 - - - - - - - 10ms - - - - - -N11 - - -manager -(*controllerManager) -Start -func3 -0 of 10ms (14.29%) - - - - - -N48 - - -leaderelection -(*LeaderElector) -Run -0 of 10ms (14.29%) - - - - - -N11->N48 - - - - - - - 10ms - - - - - -N12 - - -bufio -(*Reader) -Read -0 of 10ms (14.29%) - - - - - -N14 - - -tls -(*Conn) -Read -0 of 10ms (14.29%) - - - - - -N12->N14 - - - - - - - 10ms - - - - - -N13 - - -bytes -(*Buffer) -ReadFrom -0 of 10ms (14.29%) - - - - - -N18 - - -tls -(*atLeastReader) -Read -0 of 10ms (14.29%) - - - - - -N13->N18 - - - - - - - 10ms - - - - - -N16 - - -tls -(*Conn) -readRecord -0 of 10ms (14.29%) - - - - - -N14->N16 - - - - - - - 10ms - (inline) - - - - - -N15 - - -tls -(*Conn) -readFromUntil -0 of 10ms (14.29%) - - - - - -N15->N13 - - - - - - - 10ms - - - - - -N17 - - -tls -(*Conn) -readRecordOrCCS -0 of 10ms (14.29%) - - - - - -N16->N17 - - - - - - - 10ms - - - - - -N17->N15 - - - - - - - 10ms - - - - - -N54 - - -net -(*conn) -Read -0 of 10ms (14.29%) - - - - - -N18->N54 - - - - - - - 10ms - - - - - -N19 - - -json -Unmarshal -0 of 10ms (14.29%) - - - - - -N20 - - -json -checkValid -0 of 10ms (14.29%) - - - - - -N19->N20 - - - - - - - 10ms - - - - - -N20->N4 - - - - - - - 10ms - - - - - -N21 - - -telemetry -(*LogPipelineController) -Reconcile -0 of 10ms (14.29%) - - - - - -N23 - - -logpipeline -(*Reconciler) -Reconcile -0 of 10ms (14.29%) - - - - - -N21->N23 - - - - - - - 10ms - - - - - -N22 - - -istiostatus -(*CheckerDiscoveryAPI) -IsIstioActiveDiscoveryAPI -0 of 10ms (14.29%) - - - - - -N43 - - -discovery -(*DiscoveryClient) -ServerGroups -0 of 10ms (14.29%) - - - - - -N22->N43 - - - - - - - 10ms - - - - - -N24 - - -logpipeline -(*Reconciler) -doReconcile -0 of 10ms (14.29%) - - - - - -N23->N24 - - - - - - - 10ms - - - - - -N25 - - -logpipeline -(*Reconciler) -reconcileFluentBit -0 of 10ms (14.29%) - - - - - -N24->N25 - - - - - - - 10ms - - - - - -N25->N22 - - - - - - - 10ms - - - - - -N26 - - -http2 -(*Framer) -ReadFrame -0 of 10ms (14.29%) - - - - - -N28 - - -http2 -readFrameHeader -0 of 10ms (14.29%) - - - - - -N26->N28 - - - - - - - 10ms - - - - - -N27->N26 - - - - - - - 10ms - - - - - -N32 - - -io -ReadFull -0 of 10ms (14.29%) - - - - - -N28->N32 - - - - - - - 10ms - (inline) - - - - - -N29 - - -poll -(*FD) -Read -0 of 10ms (14.29%) - - - - - -N30 - - -poll -ignoringEINTRIO -0 of 10ms (14.29%) - - - - - -N29->N30 - - - - - - - 10ms - (inline) - - - - - -N74 - - -syscall -Read -0 of 10ms (14.29%) - - - - - -N30->N74 - - - - - - - 10ms - (inline) - - - - - -N31 - - -io -ReadAtLeast -0 of 10ms (14.29%) - - - - - -N31->N12 - - - - - - - 10ms - - - - - -N32->N31 - - - - - - - 10ms - - - - - -N33 - - -wait -BackoffUntil -0 of 10ms (14.29%) - - - - - -N34 - - -wait -BackoffUntil -func1 -0 of 10ms (14.29%) - - - - - -N33->N34 - - - - - - - 10ms - - - - - -N50 - - -leaderelection -(*LeaderElector) -renew -func1 -0 of 10ms (14.29%) - - - - - -N34->N50 - - - - - - - 10ms - - - - - -N35 - - -wait -JitterUntil -0 of 10ms (14.29%) - - - - - -N35->N33 - - - - - - - 10ms - - - - - -N36 - - -wait -PollImmediateUntil -0 of 10ms (14.29%) - - - - - -N38 - - -wait -PollImmediateUntilWithContext -0 of 10ms (14.29%) - - - - - -N36->N38 - - - - - - - 10ms - - - - - -N37 - - -wait -PollImmediateUntil -ConditionFunc -WithContext -func1 -0 of 10ms (14.29%) - - - - - -N51 - - -leaderelection -(*LeaderElector) -renew -func1 -1 -0 of 10ms (14.29%) - - - - - -N37->N51 - - - - - - - 10ms - - - - - -N40 - - -wait -poll -0 of 10ms (14.29%) - - - - - -N38->N40 - - - - - - - 10ms - - - - - -N39 - - -wait -Until -0 of 10ms (14.29%) - - - - - -N39->N35 - - - - - - - 10ms - - - - - -N41 - - -wait -runConditionWithCrashProtectionWithContext -0 of 10ms (14.29%) - - - - - -N40->N41 - - - - - - - 10ms - - - - - -N41->N37 - - - - - - - 10ms - - - - - -N42 - - -discovery -(*DiscoveryClient) -GroupsAndMaybeResources -0 of 10ms (14.29%) - - - - - -N44 - - -discovery -(*DiscoveryClient) -downloadAPIs -0 of 10ms (14.29%) - - - - - -N42->N44 - - - - - - - 10ms - - - - - -N43->N42 - - - - - - - 10ms - - - - - -N44->N19 - - - - - - - 10ms - - - - - -N45 - - -gentype -(*Client[go -shape -*uint8]) -Update -0 of 10ms (14.29%) - - - - - -N47 - - -rest -(*Request) -NamespaceIfScoped -0 of 10ms (14.29%) - - - - - -N45->N47 - - - - - - - 10ms - (inline) - - - - - -N46 - - -rest -(*Request) -Namespace -0 of 10ms (14.29%) - - - - - -N46->N5 - - - - - - - 10ms - - - - - -N47->N46 - - - - - - - 10ms - - - - - -N49 - - -leaderelection -(*LeaderElector) -renew -0 of 10ms (14.29%) - - - - - -N48->N49 - - - - - - - 10ms - - - - - -N49->N39 - - - - - - - 10ms - (inline) - - - - - -N50->N36 - - - - - - - 10ms - - - - - -N52 - - -leaderelection -(*LeaderElector) -tryAcquireOrRenew -0 of 10ms (14.29%) - - - - - -N51->N52 - - - - - - - 10ms - - - - - -N53 - - -resourcelock -(*LeaseLock) -Update -0 of 10ms (14.29%) - - - - - -N52->N53 - - - - - - - 10ms - - - - - -N53->N45 - - - - - - - 10ms - - - - - -N55 - - -net -(*netFD) -Read -0 of 10ms (14.29%) - - - - - -N54->N55 - - - - - - - 10ms - - - - - -N55->N29 - - - - - - - 10ms - - - - - -N56 - - -runtime -(*gcWork) -init -0 of 10ms (14.29%) - - - - - -N56->N6 - - - - - - - 10ms - - - - - -N57 - - -runtime -(*gcWork) -put -0 of 10ms (14.29%) - - - - - -N57->N56 - - - - - - - 10ms - - - - - -N58 - - -runtime -findRunnable -0 of 10ms (14.29%) - - - - - -N64 - - -runtime -netpoll -0 of 10ms (14.29%) - - - - - -N58->N64 - - - - - - - 10ms - - - - - -N59 - - -runtime -gcBgMarkWorker -func2 -0 of 30ms (42.86%) - - - - - -N60 - - -runtime -gcDrainMarkWorkerDedicated -0 of 30ms (42.86%) - - - - - -N59->N60 - - - - - - - 30ms - (inline) - - - - - -N60->N2 - - - - - - - 30ms - - - - - -N61 - - -runtime -greyobject -0 of 10ms (14.29%) - - - - - -N61->N57 - - - - - - - 10ms - - - - - -N63 - - -runtime -markrootBlock -0 of 10ms (14.29%) - - - - - -N62->N63 - - - - - - - 10ms - - - - - -N66 - - -runtime -scanblock -0 of 10ms (14.29%) - - - - - -N63->N66 - - - - - - - 10ms - - - - - -N69 - - -syscall -EpollWait -0 of 10ms (14.29%) - - - - - -N64->N69 - - - - - - - 10ms - - - - - -N67 - - -runtime -schedule -0 of 10ms (14.29%) - - - - - -N65->N67 - - - - - - - 10ms - - - - - -N66->N61 - - - - - - - 10ms - - - - - -N67->N58 - - - - - - - 10ms - - - - - -N68->N59 - - - - - - - 30ms - - - - - -N69->N1 - - - - - - - 10ms - - - - - -N70 - - -controller -(*Controller[go -shape -struct { k8s -io/apimachinery/pkg/types -NamespacedName }]) -Reconcile -0 of 10ms (14.29%) - - - - - -N70->N21 - - - - - - - 10ms - - - - - -N72 - - -controller -(*Controller[go -shape -struct { k8s -io/apimachinery/pkg/types -NamespacedName }]) -reconcileHandler -0 of 10ms (14.29%) - - - - - -N71->N72 - - - - - - - 10ms - - - - - -N72->N70 - - - - - - - 10ms - - - - - -N73 - - -syscall -RawSyscall6 -0 of 10ms (14.29%) - - - - - -N73->N1 - - - - - - - 10ms - - - - - -N76 - - -syscall -read -0 of 10ms (14.29%) - - - - - -N74->N76 - - - - - - - 10ms - - - - - -N75 - - -syscall -Syscall -0 of 10ms (14.29%) - - - - - -N75->N73 - - - - - - - 10ms - - - - - -N76->N75 - - - - - - - 10ms - - - - - diff --git a/internal/istiostatus/new_pprof_with_labelselector_gardener.svg b/internal/istiostatus/new_pprof_with_labelselector_gardener.svg deleted file mode 100644 index 61bd954a6..000000000 --- a/internal/istiostatus/new_pprof_with_labelselector_gardener.svg +++ /dev/null @@ -1,1396 +0,0 @@ - - - - - - -manager - - -cluster_L - - - - -File: manager - - -File: manager -Type: cpu -Time: Sep 10, 2024 at 11:21pm (CEST) -Duration: 30s, Total samples = 30ms (  0.1%) -Showing nodes accounting for 30ms, 100% of 30ms total -See https://git.io/JfYMW for how to read the graph - - - - - -N1 - - -bytes -(*Buffer) -ReadFrom -10ms (33.33%) - - - - - -N2 - - -bigmod -addMulVVW1024 -10ms (33.33%) - - - - - -N3 - - -io -ReadAll -10ms (33.33%) - - - - - -N4 - - -http2 -(*ClientConn) -readLoop -0 of 10ms (33.33%) - - - - - -N30 - - -http2 -(*clientConnReadLoop) -run -0 of 10ms (33.33%) - - - - - -N4->N30 - - - - - - - 10ms - - - - - -N5 - - -http -(*conn) -serve -0 of 10ms (33.33%) - - - - - -N14 - - -tls -(*Conn) -HandshakeContext -0 of 10ms (33.33%) - - - - - -N5->N14 - - - - - - - 10ms - (inline) - - - - - -N6 - - -controller -(*Controller[go -shape -struct { k8s -io/apimachinery/pkg/types -NamespacedName }]) -Start -func2 -2 -0 of 10ms (33.33%) - - - - - -N44 - - -controller -(*Controller[go -shape -struct { k8s -io/apimachinery/pkg/types -NamespacedName }]) -processNextWorkItem -0 of 10ms (33.33%) - - - - - -N6->N44 - - - - - - - 10ms - - - - - -N7 - - -bufio -(*Reader) -Read -0 of 10ms (33.33%) - - - - - -N15 - - -tls -(*Conn) -Read -0 of 10ms (33.33%) - - - - - -N7->N15 - - - - - - - 10ms - - - - - -N8 - - -bigmod -(*Nat) -Exp -0 of 10ms (33.33%) - - - - - -N9 - - -bigmod -(*Nat) -montgomeryMul -0 of 10ms (33.33%) - - - - - -N8->N9 - - - - - - - 10ms - - - - - -N9->N2 - - - - - - - 10ms - - - - - -N10 - - -rsa -(*PrivateKey) -Sign -0 of 10ms (33.33%) - - - - - -N11 - - -rsa -SignPSS -0 of 10ms (33.33%) - - - - - -N10->N11 - - - - - - - 10ms - - - - - -N13 - - -rsa -signPSSWithSalt -0 of 10ms (33.33%) - - - - - -N11->N13 - - - - - - - 10ms - - - - - -N12 - - -rsa -decrypt -0 of 10ms (33.33%) - - - - - -N12->N8 - - - - - - - 10ms - - - - - -N13->N12 - - - - - - - 10ms - - - - - -N16 - - -tls -(*Conn) -handshakeContext -0 of 10ms (33.33%) - - - - - -N14->N16 - - - - - - - 10ms - - - - - -N18 - - -tls -(*Conn) -readRecord -0 of 10ms (33.33%) - - - - - -N15->N18 - - - - - - - 10ms - (inline) - - - - - -N20 - - -tls -(*Conn) -serverHandshake -0 of 10ms (33.33%) - - - - - -N16->N20 - - - - - - - 10ms - - - - - -N17 - - -tls -(*Conn) -readFromUntil -0 of 10ms (33.33%) - - - - - -N17->N1 - - - - - - - 10ms - - - - - -N19 - - -tls -(*Conn) -readRecordOrCCS -0 of 10ms (33.33%) - - - - - -N18->N19 - - - - - - - 10ms - - - - - -N19->N17 - - - - - - - 10ms - - - - - -N21 - - -tls -(*serverHandshakeStateTLS13) -handshake -0 of 10ms (33.33%) - - - - - -N20->N21 - - - - - - - 10ms - - - - - -N22 - - -tls -(*serverHandshakeStateTLS13) -sendServerCertificate -0 of 10ms (33.33%) - - - - - -N21->N22 - - - - - - - 10ms - - - - - -N22->N10 - - - - - - - 10ms - - - - - -N23 - - -telemetry -(*LogPipelineController) -Reconcile -0 of 10ms (33.33%) - - - - - -N25 - - -logpipeline -(*Reconciler) -Reconcile -0 of 10ms (33.33%) - - - - - -N23->N25 - - - - - - - 10ms - - - - - -N24 - - -k8sutils -CreateOrUpdateDaemonSet -0 of 10ms (33.33%) - - - - - -N42 - - -interceptor -interceptor -Update -0 of 10ms (33.33%) - - - - - -N24->N42 - - - - - - - 10ms - - - - - -N26 - - -logpipeline -(*Reconciler) -doReconcile -0 of 10ms (33.33%) - - - - - -N25->N26 - - - - - - - 10ms - - - - - -N27 - - -logpipeline -(*Reconciler) -reconcileFluentBit -0 of 10ms (33.33%) - - - - - -N26->N27 - - - - - - - 10ms - - - - - -N27->N24 - - - - - - - 10ms - - - - - -N28 - - -logpipeline -(*Reconciler) -reconcileFluentBit -NewOwnerReferenceSetter -func2 -0 of 10ms (33.33%) - - - - - -N40 - - -client -(*client) -Update -0 of 10ms (33.33%) - - - - - -N28->N40 - - - - - - - 10ms - - - - - -N29 - - -http2 -(*Framer) -ReadFrame -0 of 10ms (33.33%) - - - - - -N31 - - -http2 -readFrameHeader -0 of 10ms (33.33%) - - - - - -N29->N31 - - - - - - - 10ms - - - - - -N30->N29 - - - - - - - 10ms - - - - - -N33 - - -io -ReadFull -0 of 10ms (33.33%) - - - - - -N31->N33 - - - - - - - 10ms - (inline) - - - - - -N32 - - -io -ReadAtLeast -0 of 10ms (33.33%) - - - - - -N32->N7 - - - - - - - 10ms - - - - - -N33->N32 - - - - - - - 10ms - - - - - -N34 - - -rest -(*Request) -Do -0 of 10ms (33.33%) - - - - - -N36 - - -rest -(*Request) -request -0 of 10ms (33.33%) - - - - - -N34->N36 - - - - - - - 10ms - - - - - -N35 - - -rest -(*Request) -Do -func1 -0 of 10ms (33.33%) - - - - - -N39 - - -rest -(*Request) -transformResponse -0 of 10ms (33.33%) - - - - - -N35->N39 - - - - - - - 10ms - - - - - -N37 - - -rest -(*Request) -request -func3 -0 of 10ms (33.33%) - - - - - -N36->N37 - - - - - - - 10ms - - - - - -N38 - - -rest -(*Request) -request -func3 -1 -0 of 10ms (33.33%) - - - - - -N37->N38 - - - - - - - 10ms - (inline) - - - - - -N38->N35 - - - - - - - 10ms - - - - - -N39->N3 - - - - - - - 10ms - - - - - -N41 - - -client -(*typedClient) -Update -0 of 10ms (33.33%) - - - - - -N40->N41 - - - - - - - 10ms - - - - - -N41->N34 - - - - - - - 10ms - - - - - -N42->N28 - - - - - - - 10ms - - - - - -N43 - - -controller -(*Controller[go -shape -struct { k8s -io/apimachinery/pkg/types -NamespacedName }]) -Reconcile -0 of 10ms (33.33%) - - - - - -N43->N23 - - - - - - - 10ms - - - - - -N45 - - -controller -(*Controller[go -shape -struct { k8s -io/apimachinery/pkg/types -NamespacedName }]) -reconcileHandler -0 of 10ms (33.33%) - - - - - -N44->N45 - - - - - - - 10ms - - - - - -N45->N43 - - - - - - - 10ms - - - - - diff --git a/internal/istiostatus/old_pprof_gardener.svg b/internal/istiostatus/old_pprof_gardener.svg deleted file mode 100644 index 2d1642c02..000000000 --- a/internal/istiostatus/old_pprof_gardener.svg +++ /dev/null @@ -1,1759 +0,0 @@ - - - - - - -manager - - -cluster_L - - - - -File: manager - - -File: manager -Type: cpu -Time: Sep 10, 2024 at 11:09pm (CEST) -Duration: 30s, Total samples = 90ms (  0.3%) -Showing nodes accounting for 90ms, 100% of 90ms total -See https://git.io/JfYMW for how to read the graph - - - - - -N1 - - -runtime -systemstack -0 of 50ms (55.56%) - - - - - -N6 - - -runtime -gcBgMarkWorker -func2 -0 of 40ms (44.44%) - - - - - -N1->N6 - - - - - - - 40ms - - - - - -N43 - - -runtime -(*mheap) -alloc -func1 -0 of 10ms (11.11%) - - - - - -N1->N43 - - - - - - - 10ms - - - - - -N2 - - -runtime -mallocgc -10ms (11.11%) -of 40ms (44.44%) - - - - - -N38 - - -runtime -(*mcache) -nextFree -0 of 20ms (22.22%) - - - - - -N2->N38 - - - - - - - 20ms - - - - - -N49 - - -runtime -heapSetType -0 of 10ms (11.11%) - - - - - -N2->N49 - - - - - - - 10ms - - - - - -N3 - - -runtime -scanobject -10ms (11.11%) -of 40ms (44.44%) - - - - - -N16 - - -runtime -greyobject -0 of 20ms (22.22%) - - - - - -N3->N16 - - - - - - - 20ms - - - - - -N17 - - -runtime -typePointers -nextFast -10ms (11.11%) - - - - - -N3->N17 - - - - - - - 10ms - (inline) - - - - - -N4 - - -v1 -(*JSONSchemaProps) -DeepCopy -0 of 30ms (33.33%) - - - - - -N8 - - -runtime -newobject -0 of 40ms (44.44%) - - - - - -N4->N8 - - - - - - - 30ms - - - - - -N35 - - -v1 -(*JSONSchemaPropsOrArray) -DeepCopyInto -0 of 30ms (33.33%) - - - - - -N4->N35 - - - - - - - 30ms - - - - - -N5 - - -runtime -gcBgMarkWorker -0 of 40ms (44.44%) - - - - - -N5->N1 - - - - - - - 40ms - - - - - -N47 - - -runtime -gcDrainMarkWorkerDedicated -0 of 20ms (22.22%) - - - - - -N6->N47 - - - - - - - 20ms - (inline) - - - - - -N48 - - -runtime -gcDrainMarkWorkerIdle -0 of 20ms (22.22%) - - - - - -N6->N48 - - - - - - - 20ms - (inline) - - - - - -N7 - - -runtime -gcDrain -0 of 40ms (44.44%) - - - - - -N7->N3 - - - - - - - 40ms - - - - - -N8->N2 - - - - - - - 40ms - - - - - -N9 - - -controller -(*Controller[go -shape -struct { k8s -io/apimachinery/pkg/types -NamespacedName }]) -Start -func2 -2 -0 of 30ms (33.33%) - - - - - -N57 - - -controller -(*Controller[go -shape -struct { k8s -io/apimachinery/pkg/types -NamespacedName }]) -processNextWorkItem -0 of 30ms (33.33%) - - - - - -N9->N57 - - - - - - - 30ms - - - - - -N10 - - -runtime -(*mcache) -refill -0 of 20ms (22.22%) - - - - - -N39 - - -runtime -(*mcentral) -cacheSpan -0 of 10ms (11.11%) - - - - - -N10->N39 - - - - - - - 10ms - - - - - -N41 - - -runtime -(*mcentral) -uncacheSpan -0 of 10ms (11.11%) - - - - - -N10->N41 - - - - - - - 10ms - - - - - -N11 - - -runtime -(*mheap) -allocSpan -10ms (11.11%) - - - - - -N12 - - -runtime -(*mspan) -base -10ms (11.11%) - - - - - -N13 - - -runtime -(*mspan) -writeHeapBitsSmall -10ms (11.11%) - - - - - -N14 - - -runtime -(*spanSet) -push -10ms (11.11%) - - - - - -N15 - - -runtime -addb -10ms (11.11%) - - - - - -N16->N12 - - - - - - - 10ms - (inline) - - - - - -N45 - - -runtime -(*mspan) -markBitsForIndex -0 of 10ms (11.11%) - - - - - -N16->N45 - - - - - - - 10ms - (inline) - - - - - -N18 - - -atomic -(*Uint32) -Add -10ms (11.11%) - - - - - -N19 - - -http2 -(*ClientConn) -readLoop -0 of 10ms (11.11%) - - - - - -N28 - - -http2 -(*clientConnReadLoop) -run -0 of 10ms (11.11%) - - - - - -N19->N28 - - - - - - - 10ms - - - - - -N20 - - -runtime -bgsweep -0 of 10ms (11.11%) - - - - - -N51 - - -runtime -sweepone -0 of 10ms (11.11%) - - - - - -N20->N51 - - - - - - - 10ms - - - - - -N21 - - -telemetry -(*LogPipelineController) -Reconcile -0 of 30ms (33.33%) - - - - - -N23 - - -logpipeline -(*Reconciler) -Reconcile -0 of 30ms (33.33%) - - - - - -N21->N23 - - - - - - - 30ms - - - - - -N22 - - -istiostatus -(*Checker) -IsIstioActive -0 of 30ms (33.33%) - - - - - -N55 - - -client -(*client) -List -0 of 30ms (33.33%) - - - - - -N22->N55 - - - - - - - 30ms - - - - - -N24 - - -logpipeline -(*Reconciler) -doReconcile -0 of 30ms (33.33%) - - - - - -N23->N24 - - - - - - - 30ms - - - - - -N25 - - -logpipeline -(*Reconciler) -reconcileFluentBit -0 of 30ms (33.33%) - - - - - -N24->N25 - - - - - - - 30ms - - - - - -N25->N22 - - - - - - - 30ms - - - - - -N26 - - -http2 -(*clientConnReadLoop) -handleResponse -0 of 10ms (11.11%) - - - - - -N50 - - -runtime -mapassign_faststr -0 of 10ms (11.11%) - - - - - -N26->N50 - - - - - - - 10ms - - - - - -N27 - - -http2 -(*clientConnReadLoop) -processHeaders -0 of 10ms (11.11%) - - - - - -N27->N26 - - - - - - - 10ms - - - - - -N28->N27 - - - - - - - 10ms - - - - - -N29 - - -v1 -(*CustomResourceDefinition) -DeepCopy -0 of 30ms (33.33%) - - - - - -N30 - - -v1 -(*CustomResourceDefinition) -DeepCopyInto -0 of 30ms (33.33%) - - - - - -N29->N30 - - - - - - - 30ms - - - - - -N32 - - -v1 -(*CustomResourceDefinitionSpec) -DeepCopyInto -0 of 30ms (33.33%) - - - - - -N30->N32 - - - - - - - 30ms - - - - - -N31 - - -v1 -(*CustomResourceDefinition) -DeepCopyObject -0 of 30ms (33.33%) - - - - - -N31->N29 - - - - - - - 30ms - (inline) - - - - - -N33 - - -v1 -(*CustomResourceDefinitionVersion) -DeepCopyInto -0 of 30ms (33.33%) - - - - - -N32->N33 - - - - - - - 30ms - - - - - -N34 - - -v1 -(*CustomResourceValidation) -DeepCopyInto -0 of 30ms (33.33%) - - - - - -N33->N34 - - - - - - - 30ms - - - - - -N34->N4 - - - - - - - 30ms - - - - - -N35->N4 - - - - - - - 30ms - - - - - -N36 - - -runtime -(*gcBits) -bitp -0 of 10ms (11.11%) - - - - - -N37 - - -runtime -(*gcBits) -bytep -0 of 10ms (11.11%) - - - - - -N36->N37 - - - - - - - 10ms - (inline) - - - - - -N37->N15 - - - - - - - 10ms - (inline) - - - - - -N38->N10 - - - - - - - 20ms - - - - - -N40 - - -runtime -(*mcentral) -grow -0 of 10ms (11.11%) - - - - - -N39->N40 - - - - - - - 10ms - - - - - -N42 - - -runtime -(*mheap) -alloc -0 of 10ms (11.11%) - - - - - -N40->N42 - - - - - - - 10ms - - - - - -N41->N14 - - - - - - - 10ms - - - - - -N42->N1 - - - - - - - 10ms - - - - - -N43->N11 - - - - - - - 10ms - - - - - -N44 - - -runtime -(*mheap) -nextSpanForSweep -0 of 10ms (11.11%) - - - - - -N46 - - -runtime -(*spanSet) -pop -0 of 10ms (11.11%) - - - - - -N44->N46 - - - - - - - 10ms - - - - - -N45->N36 - - - - - - - 10ms - (inline) - - - - - -N46->N18 - - - - - - - 10ms - (inline) - - - - - -N47->N7 - - - - - - - 20ms - - - - - -N48->N7 - - - - - - - 20ms - - - - - -N49->N13 - - - - - - - 10ms - - - - - -N50->N8 - - - - - - - 10ms - (inline) - - - - - -N51->N44 - - - - - - - 10ms - - - - - -N52 - - -cache -(*delegatingByGVKCache) -List -0 of 30ms (33.33%) - - - - - -N53 - - -cache -(*informerCache) -List -0 of 30ms (33.33%) - - - - - -N52->N53 - - - - - - - 30ms - - - - - -N54 - - -internal -(*CacheReader) -List -0 of 30ms (33.33%) - - - - - -N53->N54 - - - - - - - 30ms - - - - - -N54->N31 - - - - - - - 30ms - - - - - -N55->N52 - - - - - - - 30ms - - - - - -N56 - - -controller -(*Controller[go -shape -struct { k8s -io/apimachinery/pkg/types -NamespacedName }]) -Reconcile -0 of 30ms (33.33%) - - - - - -N56->N21 - - - - - - - 30ms - - - - - -N58 - - -controller -(*Controller[go -shape -struct { k8s -io/apimachinery/pkg/types -NamespacedName }]) -reconcileHandler -0 of 30ms (33.33%) - - - - - -N57->N58 - - - - - - - 30ms - - - - - -N58->N56 - - - - - - - 30ms - - - - - diff --git a/main.go b/main.go index e997f72a3..4efefbc00 100644 --- a/main.go +++ b/main.go @@ -492,6 +492,7 @@ func enableTracingController(mgr manager.Manager, reconcileTriggerChan <-chan ev }, MaxPipelines: maxTracePipelines, }, + RestConfig: mgr.GetConfig(), TelemetryNamespace: telemetryNamespace, SelfMonitorName: selfMonitorName, }, @@ -551,6 +552,7 @@ func enableMetricsController(mgr manager.Manager, reconcileTriggerChan <-chan ev ModuleVersion: version, KymaInputAllowed: kymaInputAllowed, }, + RestConfig: mgr.GetConfig(), TelemetryNamespace: telemetryNamespace, SelfMonitorName: selfMonitorName, }, From 8c36ba778fc0e352aecaf8956771df3a68d01e6f Mon Sep 17 00:00:00 2001 From: Jeffrey Limnardy Date: Tue, 17 Sep 2024 13:33:52 +0200 Subject: [PATCH 6/8] fix lint --- .golangci.yaml | 2 ++ controllers/telemetry/logpipeline_controller.go | 4 ++-- controllers/telemetry/metricpipeline_controller.go | 4 ++-- controllers/telemetry/tracepipeline_controller.go | 4 ++-- internal/istiostatus/istio_status_checker.go | 3 ++- internal/istiostatus/istio_status_checker_test.go | 4 ++-- internal/reconciler/logpipeline/reconciler.go | 2 +- 7 files changed, 13 insertions(+), 10 deletions(-) diff --git a/.golangci.yaml b/.golangci.yaml index f229f2187..fdbb2e980 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -124,6 +124,8 @@ linters-settings: alias: ctrlpredicate - pkg: "github.com/kyma-project/telemetry-manager/internal/reconciler/commonstatus/stubs" alias: commonStatusStubs + - pkg: "k8s.io/client-go/testing" + alias: clienttesting errcheck: check-type-assertions: true # Reports type assertions: `a := b.(SomeStruct)`. check-blank: true # Report assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`. diff --git a/controllers/telemetry/logpipeline_controller.go b/controllers/telemetry/logpipeline_controller.go index 254323f66..9e9e9707d 100644 --- a/controllers/telemetry/logpipeline_controller.go +++ b/controllers/telemetry/logpipeline_controller.go @@ -18,14 +18,13 @@ limitations under the License. import ( "context" - "github.com/kyma-project/telemetry-manager/internal/discovery" - "k8s.io/client-go/rest" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" rbacv1 "k8s.io/api/rbac/v1" "k8s.io/apimachinery/pkg/api/resource" "k8s.io/apimachinery/pkg/types" + "k8s.io/client-go/rest" ctrl "sigs.k8s.io/controller-runtime" ctrlbuilder "sigs.k8s.io/controller-runtime/pkg/builder" "sigs.k8s.io/controller-runtime/pkg/client" @@ -35,6 +34,7 @@ import ( telemetryv1alpha1 "github.com/kyma-project/telemetry-manager/apis/telemetry/v1alpha1" "github.com/kyma-project/telemetry-manager/internal/conditions" + "github.com/kyma-project/telemetry-manager/internal/discovery" "github.com/kyma-project/telemetry-manager/internal/fluentbit/config/builder" "github.com/kyma-project/telemetry-manager/internal/istiostatus" "github.com/kyma-project/telemetry-manager/internal/overrides" diff --git a/controllers/telemetry/metricpipeline_controller.go b/controllers/telemetry/metricpipeline_controller.go index 1e2fb0368..f66d5599d 100644 --- a/controllers/telemetry/metricpipeline_controller.go +++ b/controllers/telemetry/metricpipeline_controller.go @@ -19,8 +19,6 @@ package telemetry import ( "context" "fmt" - "github.com/kyma-project/telemetry-manager/internal/discovery" - "k8s.io/client-go/rest" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" @@ -28,6 +26,7 @@ import ( rbacv1 "k8s.io/api/rbac/v1" apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" "k8s.io/apimachinery/pkg/types" + "k8s.io/client-go/rest" ctrl "sigs.k8s.io/controller-runtime" ctrlbuilder "sigs.k8s.io/controller-runtime/pkg/builder" "sigs.k8s.io/controller-runtime/pkg/client" @@ -40,6 +39,7 @@ import ( operatorv1alpha1 "github.com/kyma-project/telemetry-manager/apis/operator/v1alpha1" telemetryv1alpha1 "github.com/kyma-project/telemetry-manager/apis/telemetry/v1alpha1" "github.com/kyma-project/telemetry-manager/internal/conditions" + "github.com/kyma-project/telemetry-manager/internal/discovery" "github.com/kyma-project/telemetry-manager/internal/istiostatus" "github.com/kyma-project/telemetry-manager/internal/otelcollector/config/metric/agent" "github.com/kyma-project/telemetry-manager/internal/otelcollector/config/metric/gateway" diff --git a/controllers/telemetry/tracepipeline_controller.go b/controllers/telemetry/tracepipeline_controller.go index 70540443e..2ab1819eb 100644 --- a/controllers/telemetry/tracepipeline_controller.go +++ b/controllers/telemetry/tracepipeline_controller.go @@ -19,14 +19,14 @@ limitations under the License. import ( "context" "fmt" - "k8s.io/client-go/discovery" - "k8s.io/client-go/rest" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" networkingv1 "k8s.io/api/networking/v1" rbacv1 "k8s.io/api/rbac/v1" "k8s.io/apimachinery/pkg/types" + "k8s.io/client-go/discovery" + "k8s.io/client-go/rest" ctrl "sigs.k8s.io/controller-runtime" ctrlbuilder "sigs.k8s.io/controller-runtime/pkg/builder" "sigs.k8s.io/controller-runtime/pkg/client" diff --git a/internal/istiostatus/istio_status_checker.go b/internal/istiostatus/istio_status_checker.go index f43975db5..462718506 100644 --- a/internal/istiostatus/istio_status_checker.go +++ b/internal/istiostatus/istio_status_checker.go @@ -2,9 +2,10 @@ package istiostatus import ( "context" + "strings" + "k8s.io/client-go/discovery" logf "sigs.k8s.io/controller-runtime/pkg/log" - "strings" ) type Checker struct { diff --git a/internal/istiostatus/istio_status_checker_test.go b/internal/istiostatus/istio_status_checker_test.go index fa4aedecb..bf6d2552b 100644 --- a/internal/istiostatus/istio_status_checker_test.go +++ b/internal/istiostatus/istio_status_checker_test.go @@ -7,7 +7,7 @@ import ( "github.com/stretchr/testify/assert" apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - discoveryfake "k8s.io/client-go/discovery/fake" + "k8s.io/client-go/discovery/fake" clientgoscheme "k8s.io/client-go/kubernetes/scheme" clienttesting "k8s.io/client-go/testing" ) @@ -47,7 +47,7 @@ func TestIsIstioActive(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - discovery := discoveryfake.FakeDiscovery{ + discovery := fake.FakeDiscovery{ Fake: &clienttesting.Fake{ Resources: tt.resources, }, diff --git a/internal/reconciler/logpipeline/reconciler.go b/internal/reconciler/logpipeline/reconciler.go index bf1d838b9..78a1afc0b 100644 --- a/internal/reconciler/logpipeline/reconciler.go +++ b/internal/reconciler/logpipeline/reconciler.go @@ -20,7 +20,6 @@ import ( "context" "errors" "fmt" - "k8s.io/client-go/rest" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" @@ -28,6 +27,7 @@ import ( rbacv1 "k8s.io/api/rbac/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" + "k8s.io/client-go/rest" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" logf "sigs.k8s.io/controller-runtime/pkg/log" From e873f3c04b543b7fd300be900329985b484d1a67 Mon Sep 17 00:00:00 2001 From: Jeffrey Limnardy Date: Tue, 17 Sep 2024 13:49:00 +0200 Subject: [PATCH 7/8] remove unnecessary makediscoveryclient function --- controllers/telemetry/logpipeline_controller.go | 5 +++-- .../telemetry/metricpipeline_controller.go | 4 ++-- internal/discovery/client.go | 16 ---------------- 3 files changed, 5 insertions(+), 20 deletions(-) delete mode 100644 internal/discovery/client.go diff --git a/controllers/telemetry/logpipeline_controller.go b/controllers/telemetry/logpipeline_controller.go index 9e9e9707d..b670fef7f 100644 --- a/controllers/telemetry/logpipeline_controller.go +++ b/controllers/telemetry/logpipeline_controller.go @@ -24,7 +24,9 @@ import ( rbacv1 "k8s.io/api/rbac/v1" "k8s.io/apimachinery/pkg/api/resource" "k8s.io/apimachinery/pkg/types" + "k8s.io/client-go/discovery" "k8s.io/client-go/rest" + ctrl "sigs.k8s.io/controller-runtime" ctrlbuilder "sigs.k8s.io/controller-runtime/pkg/builder" "sigs.k8s.io/controller-runtime/pkg/client" @@ -34,7 +36,6 @@ import ( telemetryv1alpha1 "github.com/kyma-project/telemetry-manager/apis/telemetry/v1alpha1" "github.com/kyma-project/telemetry-manager/internal/conditions" - "github.com/kyma-project/telemetry-manager/internal/discovery" "github.com/kyma-project/telemetry-manager/internal/fluentbit/config/builder" "github.com/kyma-project/telemetry-manager/internal/istiostatus" "github.com/kyma-project/telemetry-manager/internal/overrides" @@ -101,7 +102,7 @@ func NewLogPipelineController(client client.Client, reconcileTriggerChan <-chan SecretRefValidator: &secretref.Validator{Client: client}, } - discoveryClient, err := discovery.MakeDiscoveryClient(config.RestConfig) + discoveryClient, err := discovery.NewDiscoveryClientForConfig(config.RestConfig) if err != nil { return nil, err } diff --git a/controllers/telemetry/metricpipeline_controller.go b/controllers/telemetry/metricpipeline_controller.go index f66d5599d..81b03366e 100644 --- a/controllers/telemetry/metricpipeline_controller.go +++ b/controllers/telemetry/metricpipeline_controller.go @@ -26,6 +26,7 @@ import ( rbacv1 "k8s.io/api/rbac/v1" apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" "k8s.io/apimachinery/pkg/types" + "k8s.io/client-go/discovery" "k8s.io/client-go/rest" ctrl "sigs.k8s.io/controller-runtime" ctrlbuilder "sigs.k8s.io/controller-runtime/pkg/builder" @@ -39,7 +40,6 @@ import ( operatorv1alpha1 "github.com/kyma-project/telemetry-manager/apis/operator/v1alpha1" telemetryv1alpha1 "github.com/kyma-project/telemetry-manager/apis/telemetry/v1alpha1" "github.com/kyma-project/telemetry-manager/internal/conditions" - "github.com/kyma-project/telemetry-manager/internal/discovery" "github.com/kyma-project/telemetry-manager/internal/istiostatus" "github.com/kyma-project/telemetry-manager/internal/otelcollector/config/metric/agent" "github.com/kyma-project/telemetry-manager/internal/otelcollector/config/metric/gateway" @@ -86,7 +86,7 @@ func NewMetricPipelineController(client client.Client, reconcileTriggerChan <-ch agentRBAC := otelcollector.MakeMetricAgentRBAC(types.NamespacedName{Name: config.Agent.BaseName, Namespace: config.Agent.Namespace}) gatewayRBAC := otelcollector.MakeMetricGatewayRBAC(types.NamespacedName{Name: config.Gateway.BaseName, Namespace: config.Gateway.Namespace}, config.KymaInputAllowed) - discoveryClient, err := discovery.MakeDiscoveryClient(config.RestConfig) + discoveryClient, err := discovery.NewDiscoveryClientForConfig(config.RestConfig) if err != nil { return nil, err } diff --git a/internal/discovery/client.go b/internal/discovery/client.go deleted file mode 100644 index ca7275553..000000000 --- a/internal/discovery/client.go +++ /dev/null @@ -1,16 +0,0 @@ -package discovery - -import ( - "k8s.io/client-go/discovery" - "k8s.io/client-go/rest" -) - -func MakeDiscoveryClient(restConfig *rest.Config) (discovery.DiscoveryInterface, error) { - - discoveryClient, err := discovery.NewDiscoveryClientForConfig(restConfig) - if err != nil { - return nil, err - } - - return discoveryClient, nil -} From b551a6cd4bad57a64e22962af5a69dfa47e2d52c Mon Sep 17 00:00:00 2001 From: Jeffrey Limnardy Date: Tue, 17 Sep 2024 13:50:18 +0200 Subject: [PATCH 8/8] fix lint --- controllers/telemetry/logpipeline_controller.go | 1 - 1 file changed, 1 deletion(-) diff --git a/controllers/telemetry/logpipeline_controller.go b/controllers/telemetry/logpipeline_controller.go index b670fef7f..1b7e488f0 100644 --- a/controllers/telemetry/logpipeline_controller.go +++ b/controllers/telemetry/logpipeline_controller.go @@ -26,7 +26,6 @@ import ( "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/discovery" "k8s.io/client-go/rest" - ctrl "sigs.k8s.io/controller-runtime" ctrlbuilder "sigs.k8s.io/controller-runtime/pkg/builder" "sigs.k8s.io/controller-runtime/pkg/client"