From 9ea51a029caec6c4e71fb3b6d49cfbaf8a4d5806 Mon Sep 17 00:00:00 2001 From: Omri Eival Date: Sat, 28 Dec 2024 23:20:48 -0600 Subject: [PATCH] fix races --- cmd/expose.go | 20 +- cmd/inject.go | 11 +- coverage.txt | 797 ++++++++++++++++++++------------------- pkg/k8s/cleanup.go | 8 +- pkg/k8s/cleanup_test.go | 31 +- pkg/k8s/client.go | 14 + pkg/k8s/common.go | 70 ++-- pkg/k8s/exposer.go | 37 +- pkg/k8s/injector.go | 12 +- pkg/k8s/injector_test.go | 27 -- 10 files changed, 542 insertions(+), 485 deletions(-) diff --git a/cmd/expose.go b/cmd/expose.go index f75eed0..737ed5f 100644 --- a/cmd/expose.go +++ b/cmd/expose.go @@ -88,6 +88,10 @@ ktunnel expose redis 6379 deploymentAnnotations[parsed[0]] = parsed[1] } + svc, err := k8s.NewKubeService(KubeContext, Namespace) + if err != nil { + log.Fatalf("Failed to create new kube service: %v", err) + } podTolerations := make([]apiv1.Toleration, 0, len(PodTolerations)) for _, label := range PodTolerations { parsed := strings.Split(label, "=") @@ -110,15 +114,15 @@ ktunnel expose redis 6379 } if Force { - err := k8s.TeardownExposedService(Namespace, svcName, &KubeContext, DeploymentOnly) + err := svc.TeardownExposedService(svcName, DeploymentOnly) if err != nil { log.Infof("Force delete: Failed deleting k8s objects: %s", err) } } - err := k8s.ExposeAsService( - &Namespace, - &svcName, + err = svc.ExposeAsService( + Namespace, + svcName, port, Scheme, ports, @@ -134,7 +138,7 @@ ktunnel expose redis 6379 CertFile, KeyFile, ServiceType, - &KubeContext, + KubeContext, ServerCPURequest, ServerCPULimit, ServerMemRequest, @@ -159,7 +163,7 @@ ktunnel expose redis 6379 } cancel() if !Reuse { - err := k8s.TeardownExposedService(Namespace, svcName, &KubeContext, DeploymentOnly) + err := svc.TeardownExposedService(svcName, DeploymentOnly) if err != nil { log.Errorf("Failed deleting k8s objects: %s", err) } @@ -171,11 +175,13 @@ ktunnel expose redis 6379 log.Info("waiting for deployment to be ready") <-readyChan + // Kube Service + kubeService, err := k8s.NewKubeService(KubeContext, Namespace) // port-Forward strPort := strconv.FormatInt(int64(port), 10) stopChan := make(chan struct{}, 1) // Create a tunnel client for each replica - sourcePorts, err := k8s.PortForward(&Namespace, &svcName, strPort, wg, stopChan, &KubeContext) + sourcePorts, err := kubeService.PortForward(Namespace, svcName, strPort, wg, stopChan) if err != nil { log.Fatalf("Failed to run port forwarding: %v", err) os.Exit(1) diff --git a/cmd/inject.go b/cmd/inject.go index fa0988b..b6c4cdc 100644 --- a/cmd/inject.go +++ b/cmd/inject.go @@ -46,7 +46,12 @@ ktunnel inject deployment mydeployment 3306 6379 // Inject deployment := args[0] readyChan := make(chan bool, 1) - _, err := k8s.InjectSidecar(&Namespace, &deployment, &port, ServerImage, CertFile, KeyFile, readyChan, &KubeContext) + // Kube Service + svc, err := k8s.NewKubeService(KubeContext, Namespace) + if err != nil { + log.Fatalf("failed creating kube service: %v", err) + } + _, err = svc.InjectSidecar(&Namespace, &deployment, &port, ServerImage, CertFile, KeyFile, readyChan, &KubeContext) if err != nil { log.Fatalf("failed injecting sidecar: %v", err) } @@ -67,7 +72,7 @@ ktunnel inject deployment mydeployment 3306 6379 wg.Wait() if eject { readyChan = make(chan bool, 1) - ok, err := k8s.RemoveSidecar(&Namespace, &deployment, ServerImage, readyChan, &KubeContext) + ok, err := svc.RemoveSidecar(&Namespace, &deployment, ServerImage, readyChan, &KubeContext) if !ok { log.Errorf("Failed removing tunnel sidecar; %v", err) } @@ -90,7 +95,7 @@ ktunnel inject deployment mydeployment 3306 6379 // port-Forward strPort := strconv.FormatInt(int64(port), 10) // Create a tunnel client for each replica - sourcePorts, err := k8s.PortForward(&Namespace, &deployment, strPort, wg, stopChan, &KubeContext) + sourcePorts, err := svc.PortForward(Namespace, deployment, strPort, wg, stopChan) if err != nil { log.Fatalf("Failed to run port forwarding: %v", err) os.Exit(1) diff --git a/coverage.txt b/coverage.txt index 95cf8d9..1afc0aa 100644 --- a/coverage.txt +++ b/coverage.txt @@ -1,135 +1,4 @@ mode: atomic -github.com/omrikiei/ktunnel/main.go:7.13,9.2 1 0 -github.com/omrikiei/ktunnel/cmd/client.go:30.47,32.14 2 0 -github.com/omrikiei/ktunnel/cmd/client.go:32.14,34.4 1 0 -github.com/omrikiei/ktunnel/cmd/client.go:35.3,40.13 4 0 -github.com/omrikiei/ktunnel/cmd/client.go:40.13,41.16 1 0 -github.com/omrikiei/ktunnel/cmd/client.go:41.16,45.5 3 0 -github.com/omrikiei/ktunnel/cmd/client.go:48.3,56.17 3 0 -github.com/omrikiei/ktunnel/cmd/client.go:56.17,58.4 1 0 -github.com/omrikiei/ktunnel/cmd/client.go:62.13,68.2 5 0 -github.com/omrikiei/ktunnel/cmd/expose.go:50.47,52.14 2 0 -github.com/omrikiei/ktunnel/cmd/expose.go:52.14,55.4 2 0 -github.com/omrikiei/ktunnel/cmd/expose.go:56.3,62.40 5 0 -github.com/omrikiei/ktunnel/cmd/expose.go:62.40,64.24 2 0 -github.com/omrikiei/ktunnel/cmd/expose.go:64.24,66.13 2 0 -github.com/omrikiei/ktunnel/cmd/expose.go:68.4,68.43 1 0 -github.com/omrikiei/ktunnel/cmd/expose.go:71.3,72.42 2 0 -github.com/omrikiei/ktunnel/cmd/expose.go:72.42,74.24 2 0 -github.com/omrikiei/ktunnel/cmd/expose.go:74.24,76.13 2 0 -github.com/omrikiei/ktunnel/cmd/expose.go:78.4,78.43 1 0 -github.com/omrikiei/ktunnel/cmd/expose.go:81.3,82.47 2 0 -github.com/omrikiei/ktunnel/cmd/expose.go:82.47,84.24 2 0 -github.com/omrikiei/ktunnel/cmd/expose.go:84.24,86.13 2 0 -github.com/omrikiei/ktunnel/cmd/expose.go:88.4,88.48 1 0 -github.com/omrikiei/ktunnel/cmd/expose.go:91.3,92.40 2 0 -github.com/omrikiei/ktunnel/cmd/expose.go:92.40,94.24 2 0 -github.com/omrikiei/ktunnel/cmd/expose.go:94.24,96.13 2 0 -github.com/omrikiei/ktunnel/cmd/expose.go:98.4,99.32 2 0 -github.com/omrikiei/ktunnel/cmd/expose.go:99.32,101.13 2 0 -github.com/omrikiei/ktunnel/cmd/expose.go:104.4,109.6 1 0 -github.com/omrikiei/ktunnel/cmd/expose.go:112.3,112.12 1 0 -github.com/omrikiei/ktunnel/cmd/expose.go:112.12,114.18 2 0 -github.com/omrikiei/ktunnel/cmd/expose.go:114.18,116.5 1 0 -github.com/omrikiei/ktunnel/cmd/expose.go:119.3,143.17 2 0 -github.com/omrikiei/ktunnel/cmd/expose.go:143.17,145.4 1 0 -github.com/omrikiei/ktunnel/cmd/expose.go:146.3,152.13 5 0 -github.com/omrikiei/ktunnel/cmd/expose.go:152.13,153.16 1 0 -github.com/omrikiei/ktunnel/cmd/expose.go:153.16,155.14 2 0 -github.com/omrikiei/ktunnel/cmd/expose.go:155.14,157.6 1 0 -github.com/omrikiei/ktunnel/cmd/expose.go:157.11,159.6 1 0 -github.com/omrikiei/ktunnel/cmd/expose.go:160.5,161.15 2 0 -github.com/omrikiei/ktunnel/cmd/expose.go:161.15,163.20 2 0 -github.com/omrikiei/ktunnel/cmd/expose.go:163.20,165.7 1 0 -github.com/omrikiei/ktunnel/cmd/expose.go:167.5,167.17 1 0 -github.com/omrikiei/ktunnel/cmd/expose.go:171.3,179.17 6 0 -github.com/omrikiei/ktunnel/cmd/expose.go:179.17,182.4 2 0 -github.com/omrikiei/ktunnel/cmd/expose.go:183.3,183.40 1 0 -github.com/omrikiei/ktunnel/cmd/expose.go:183.40,184.25 1 0 -github.com/omrikiei/ktunnel/cmd/expose.go:184.25,186.19 2 0 -github.com/omrikiei/ktunnel/cmd/expose.go:186.19,188.6 1 0 -github.com/omrikiei/ktunnel/cmd/expose.go:189.5,195.12 3 0 -github.com/omrikiei/ktunnel/cmd/expose.go:195.12,197.6 1 0 -github.com/omrikiei/ktunnel/cmd/expose.go:198.5,199.19 2 0 -github.com/omrikiei/ktunnel/cmd/expose.go:199.19,201.6 1 0 -github.com/omrikiei/ktunnel/cmd/expose.go:204.3,204.9 1 0 -github.com/omrikiei/ktunnel/cmd/expose.go:208.13,231.2 22 0 -github.com/omrikiei/ktunnel/cmd/inject.go:39.47,41.14 2 0 -github.com/omrikiei/ktunnel/cmd/inject.go:41.14,44.4 2 0 -github.com/omrikiei/ktunnel/cmd/inject.go:45.3,50.17 5 0 -github.com/omrikiei/ktunnel/cmd/inject.go:50.17,52.4 1 0 -github.com/omrikiei/ktunnel/cmd/inject.go:54.3,62.13 6 0 -github.com/omrikiei/ktunnel/cmd/inject.go:62.13,63.16 1 0 -github.com/omrikiei/ktunnel/cmd/inject.go:63.16,68.14 5 0 -github.com/omrikiei/ktunnel/cmd/inject.go:68.14,71.13 3 0 -github.com/omrikiei/ktunnel/cmd/inject.go:71.13,73.7 1 0 -github.com/omrikiei/ktunnel/cmd/inject.go:74.6,74.17 1 0 -github.com/omrikiei/ktunnel/cmd/inject.go:76.5,77.17 2 0 -github.com/omrikiei/ktunnel/cmd/inject.go:82.3,84.15 3 0 -github.com/omrikiei/ktunnel/cmd/inject.go:84.15,88.4 3 0 -github.com/omrikiei/ktunnel/cmd/inject.go:91.3,94.17 3 0 -github.com/omrikiei/ktunnel/cmd/inject.go:94.17,97.4 2 0 -github.com/omrikiei/ktunnel/cmd/inject.go:98.3,98.40 1 0 -github.com/omrikiei/ktunnel/cmd/inject.go:98.40,99.25 1 0 -github.com/omrikiei/ktunnel/cmd/inject.go:99.25,101.19 2 0 -github.com/omrikiei/ktunnel/cmd/inject.go:101.19,103.6 1 0 -github.com/omrikiei/ktunnel/cmd/inject.go:104.5,110.12 3 0 -github.com/omrikiei/ktunnel/cmd/inject.go:110.12,112.6 1 0 -github.com/omrikiei/ktunnel/cmd/inject.go:113.5,114.19 2 0 -github.com/omrikiei/ktunnel/cmd/inject.go:114.19,116.6 1 0 -github.com/omrikiei/ktunnel/cmd/inject.go:119.3,119.9 1 0 -github.com/omrikiei/ktunnel/cmd/inject.go:123.13,142.2 18 0 -github.com/omrikiei/ktunnel/cmd/root.go:38.16,39.54 1 0 -github.com/omrikiei/ktunnel/cmd/root.go:39.54,41.17 2 0 -github.com/omrikiei/ktunnel/cmd/root.go:41.17,43.4 1 0 -github.com/omrikiei/ktunnel/cmd/root.go:46.2,46.42 1 0 -github.com/omrikiei/ktunnel/cmd/root.go:46.42,49.3 2 0 -github.com/omrikiei/ktunnel/cmd/root.go:52.13,57.2 4 0 -github.com/omrikiei/ktunnel/cmd/server.go:26.47,28.14 2 0 -github.com/omrikiei/ktunnel/cmd/server.go:28.14,30.4 1 0 -github.com/omrikiei/ktunnel/cmd/server.go:31.3,36.13 4 0 -github.com/omrikiei/ktunnel/cmd/server.go:36.13,37.16 1 0 -github.com/omrikiei/ktunnel/cmd/server.go:37.16,41.5 3 0 -github.com/omrikiei/ktunnel/cmd/server.go:43.3,44.10 2 0 -github.com/omrikiei/ktunnel/cmd/server.go:44.10,46.4 1 0 -github.com/omrikiei/ktunnel/cmd/server.go:47.3,48.17 2 0 -github.com/omrikiei/ktunnel/cmd/server.go:48.17,50.4 1 0 -github.com/omrikiei/ktunnel/cmd/server.go:54.13,58.2 3 0 -github.com/omrikiei/ktunnel/cmd/version.go:9.13,11.2 1 0 -github.com/omrikiei/ktunnel/cmd/version.go:17.47,18.14 1 0 -github.com/omrikiei/ktunnel/cmd/version.go:18.14,20.4 1 0 -github.com/omrikiei/ktunnel/cmd/version.go:21.3,21.23 1 0 -github.com/omrikiei/ktunnel/pkg/common/common.go:33.27,35.19 2 0 -github.com/omrikiei/ktunnel/pkg/common/common.go:35.19,38.3 2 0 -github.com/omrikiei/ktunnel/pkg/common/common.go:39.2,39.12 1 0 -github.com/omrikiei/ktunnel/pkg/common/common.go:39.12,42.3 2 0 -github.com/omrikiei/ktunnel/pkg/common/common.go:51.41,63.2 4 0 -github.com/omrikiei/ktunnel/pkg/common/common.go:65.65,77.2 4 0 -github.com/omrikiei/ktunnel/pkg/common/common.go:79.43,80.44 1 0 -github.com/omrikiei/ktunnel/pkg/common/common.go:80.44,82.3 1 0 -github.com/omrikiei/ktunnel/pkg/common/common.go:83.2,84.18 2 0 -github.com/omrikiei/ktunnel/pkg/common/common.go:87.48,89.8 2 0 -github.com/omrikiei/ktunnel/pkg/common/common.go:89.8,91.3 1 0 -github.com/omrikiei/ktunnel/pkg/common/common.go:92.2,92.16 1 0 -github.com/omrikiei/ktunnel/pkg/common/common.go:95.53,97.19 2 0 -github.com/omrikiei/ktunnel/pkg/common/common.go:97.19,99.3 1 0 -github.com/omrikiei/ktunnel/pkg/common/common.go:100.2,100.19 1 0 -github.com/omrikiei/ktunnel/pkg/common/common.go:100.19,102.17 2 0 -github.com/omrikiei/ktunnel/pkg/common/common.go:102.17,104.4 1 0 -github.com/omrikiei/ktunnel/pkg/common/common.go:105.3,109.9 1 0 -github.com/omrikiei/ktunnel/pkg/common/common.go:111.2,111.19 1 0 -github.com/omrikiei/ktunnel/pkg/common/common.go:111.19,113.17 2 0 -github.com/omrikiei/ktunnel/pkg/common/common.go:113.17,115.4 1 0 -github.com/omrikiei/ktunnel/pkg/common/common.go:116.3,117.17 2 0 -github.com/omrikiei/ktunnel/pkg/common/common.go:117.17,119.4 1 0 -github.com/omrikiei/ktunnel/pkg/common/common.go:120.3,124.9 1 0 -github.com/omrikiei/ktunnel/pkg/common/common.go:126.2,126.19 1 0 -github.com/omrikiei/ktunnel/pkg/common/common.go:126.19,128.17 2 0 -github.com/omrikiei/ktunnel/pkg/common/common.go:128.17,130.4 1 0 -github.com/omrikiei/ktunnel/pkg/common/common.go:131.3,132.17 2 0 -github.com/omrikiei/ktunnel/pkg/common/common.go:132.17,134.4 1 0 -github.com/omrikiei/ktunnel/pkg/common/common.go:135.3,139.9 1 0 -github.com/omrikiei/ktunnel/pkg/common/common.go:141.2,141.72 1 0 github.com/omrikiei/ktunnel/pkg/client/client.go:26.139,28.6 1 0 github.com/omrikiei/ktunnel/pkg/client/client.go:28.6,31.10 3 0 github.com/omrikiei/ktunnel/pkg/client/client.go:32.30,35.14 3 0 @@ -212,6 +81,215 @@ github.com/omrikiei/ktunnel/pkg/client/client.go:314.43,315.33 1 0 github.com/omrikiei/ktunnel/pkg/client/client.go:315.33,318.3 2 0 github.com/omrikiei/ktunnel/pkg/client/client.go:324.59,325.33 1 0 github.com/omrikiei/ktunnel/pkg/client/client.go:325.33,329.3 3 0 +github.com/omrikiei/ktunnel/cmd/client.go:30.47,32.14 2 0 +github.com/omrikiei/ktunnel/cmd/client.go:32.14,34.4 1 0 +github.com/omrikiei/ktunnel/cmd/client.go:35.3,40.13 4 0 +github.com/omrikiei/ktunnel/cmd/client.go:40.13,41.16 1 0 +github.com/omrikiei/ktunnel/cmd/client.go:41.16,45.5 3 0 +github.com/omrikiei/ktunnel/cmd/client.go:48.3,56.17 3 0 +github.com/omrikiei/ktunnel/cmd/client.go:56.17,58.4 1 0 +github.com/omrikiei/ktunnel/cmd/client.go:62.13,68.2 5 0 +github.com/omrikiei/ktunnel/cmd/expose.go:50.47,52.14 2 0 +github.com/omrikiei/ktunnel/cmd/expose.go:52.14,55.4 2 0 +github.com/omrikiei/ktunnel/cmd/expose.go:56.3,62.40 5 0 +github.com/omrikiei/ktunnel/cmd/expose.go:62.40,64.24 2 0 +github.com/omrikiei/ktunnel/cmd/expose.go:64.24,66.13 2 0 +github.com/omrikiei/ktunnel/cmd/expose.go:68.4,68.43 1 0 +github.com/omrikiei/ktunnel/cmd/expose.go:71.3,72.42 2 0 +github.com/omrikiei/ktunnel/cmd/expose.go:72.42,74.24 2 0 +github.com/omrikiei/ktunnel/cmd/expose.go:74.24,76.13 2 0 +github.com/omrikiei/ktunnel/cmd/expose.go:78.4,78.43 1 0 +github.com/omrikiei/ktunnel/cmd/expose.go:81.3,82.47 2 0 +github.com/omrikiei/ktunnel/cmd/expose.go:82.47,84.24 2 0 +github.com/omrikiei/ktunnel/cmd/expose.go:84.24,86.13 2 0 +github.com/omrikiei/ktunnel/cmd/expose.go:88.4,88.48 1 0 +github.com/omrikiei/ktunnel/cmd/expose.go:91.3,92.17 2 0 +github.com/omrikiei/ktunnel/cmd/expose.go:92.17,94.4 1 0 +github.com/omrikiei/ktunnel/cmd/expose.go:95.3,96.40 2 0 +github.com/omrikiei/ktunnel/cmd/expose.go:96.40,98.24 2 0 +github.com/omrikiei/ktunnel/cmd/expose.go:98.24,100.13 2 0 +github.com/omrikiei/ktunnel/cmd/expose.go:102.4,103.32 2 0 +github.com/omrikiei/ktunnel/cmd/expose.go:103.32,105.13 2 0 +github.com/omrikiei/ktunnel/cmd/expose.go:108.4,113.6 1 0 +github.com/omrikiei/ktunnel/cmd/expose.go:116.3,116.12 1 0 +github.com/omrikiei/ktunnel/cmd/expose.go:116.12,118.18 2 0 +github.com/omrikiei/ktunnel/cmd/expose.go:118.18,120.5 1 0 +github.com/omrikiei/ktunnel/cmd/expose.go:123.3,147.17 2 0 +github.com/omrikiei/ktunnel/cmd/expose.go:147.17,149.4 1 0 +github.com/omrikiei/ktunnel/cmd/expose.go:150.3,156.13 5 0 +github.com/omrikiei/ktunnel/cmd/expose.go:156.13,157.16 1 0 +github.com/omrikiei/ktunnel/cmd/expose.go:157.16,159.14 2 0 +github.com/omrikiei/ktunnel/cmd/expose.go:159.14,161.6 1 0 +github.com/omrikiei/ktunnel/cmd/expose.go:161.11,163.6 1 0 +github.com/omrikiei/ktunnel/cmd/expose.go:164.5,165.15 2 0 +github.com/omrikiei/ktunnel/cmd/expose.go:165.15,167.20 2 0 +github.com/omrikiei/ktunnel/cmd/expose.go:167.20,169.7 1 0 +github.com/omrikiei/ktunnel/cmd/expose.go:171.5,171.17 1 0 +github.com/omrikiei/ktunnel/cmd/expose.go:175.3,185.17 7 0 +github.com/omrikiei/ktunnel/cmd/expose.go:185.17,188.4 2 0 +github.com/omrikiei/ktunnel/cmd/expose.go:189.3,189.40 1 0 +github.com/omrikiei/ktunnel/cmd/expose.go:189.40,190.25 1 0 +github.com/omrikiei/ktunnel/cmd/expose.go:190.25,192.19 2 0 +github.com/omrikiei/ktunnel/cmd/expose.go:192.19,194.6 1 0 +github.com/omrikiei/ktunnel/cmd/expose.go:195.5,201.12 3 0 +github.com/omrikiei/ktunnel/cmd/expose.go:201.12,203.6 1 0 +github.com/omrikiei/ktunnel/cmd/expose.go:204.5,205.19 2 0 +github.com/omrikiei/ktunnel/cmd/expose.go:205.19,207.6 1 0 +github.com/omrikiei/ktunnel/cmd/expose.go:210.3,210.9 1 0 +github.com/omrikiei/ktunnel/cmd/expose.go:214.13,237.2 22 0 +github.com/omrikiei/ktunnel/cmd/inject.go:39.47,41.14 2 0 +github.com/omrikiei/ktunnel/cmd/inject.go:41.14,44.4 2 0 +github.com/omrikiei/ktunnel/cmd/inject.go:45.3,51.17 5 0 +github.com/omrikiei/ktunnel/cmd/inject.go:51.17,53.4 1 0 +github.com/omrikiei/ktunnel/cmd/inject.go:54.3,55.17 2 0 +github.com/omrikiei/ktunnel/cmd/inject.go:55.17,57.4 1 0 +github.com/omrikiei/ktunnel/cmd/inject.go:59.3,67.13 6 0 +github.com/omrikiei/ktunnel/cmd/inject.go:67.13,68.16 1 0 +github.com/omrikiei/ktunnel/cmd/inject.go:68.16,73.14 5 0 +github.com/omrikiei/ktunnel/cmd/inject.go:73.14,76.13 3 0 +github.com/omrikiei/ktunnel/cmd/inject.go:76.13,78.7 1 0 +github.com/omrikiei/ktunnel/cmd/inject.go:79.6,79.17 1 0 +github.com/omrikiei/ktunnel/cmd/inject.go:81.5,82.17 2 0 +github.com/omrikiei/ktunnel/cmd/inject.go:87.3,89.15 3 0 +github.com/omrikiei/ktunnel/cmd/inject.go:89.15,93.4 3 0 +github.com/omrikiei/ktunnel/cmd/inject.go:96.3,99.17 3 0 +github.com/omrikiei/ktunnel/cmd/inject.go:99.17,102.4 2 0 +github.com/omrikiei/ktunnel/cmd/inject.go:103.3,103.40 1 0 +github.com/omrikiei/ktunnel/cmd/inject.go:103.40,104.25 1 0 +github.com/omrikiei/ktunnel/cmd/inject.go:104.25,106.19 2 0 +github.com/omrikiei/ktunnel/cmd/inject.go:106.19,108.6 1 0 +github.com/omrikiei/ktunnel/cmd/inject.go:109.5,115.12 3 0 +github.com/omrikiei/ktunnel/cmd/inject.go:115.12,117.6 1 0 +github.com/omrikiei/ktunnel/cmd/inject.go:118.5,119.19 2 0 +github.com/omrikiei/ktunnel/cmd/inject.go:119.19,121.6 1 0 +github.com/omrikiei/ktunnel/cmd/inject.go:124.3,124.9 1 0 +github.com/omrikiei/ktunnel/cmd/inject.go:128.13,147.2 18 0 +github.com/omrikiei/ktunnel/cmd/root.go:38.16,39.54 1 0 +github.com/omrikiei/ktunnel/cmd/root.go:39.54,41.17 2 0 +github.com/omrikiei/ktunnel/cmd/root.go:41.17,43.4 1 0 +github.com/omrikiei/ktunnel/cmd/root.go:46.2,46.42 1 0 +github.com/omrikiei/ktunnel/cmd/root.go:46.42,49.3 2 0 +github.com/omrikiei/ktunnel/cmd/root.go:52.13,57.2 4 0 +github.com/omrikiei/ktunnel/cmd/server.go:26.47,28.14 2 0 +github.com/omrikiei/ktunnel/cmd/server.go:28.14,30.4 1 0 +github.com/omrikiei/ktunnel/cmd/server.go:31.3,36.13 4 0 +github.com/omrikiei/ktunnel/cmd/server.go:36.13,37.16 1 0 +github.com/omrikiei/ktunnel/cmd/server.go:37.16,41.5 3 0 +github.com/omrikiei/ktunnel/cmd/server.go:43.3,44.10 2 0 +github.com/omrikiei/ktunnel/cmd/server.go:44.10,46.4 1 0 +github.com/omrikiei/ktunnel/cmd/server.go:47.3,48.17 2 0 +github.com/omrikiei/ktunnel/cmd/server.go:48.17,50.4 1 0 +github.com/omrikiei/ktunnel/cmd/server.go:54.13,58.2 3 0 +github.com/omrikiei/ktunnel/cmd/version.go:9.13,11.2 1 0 +github.com/omrikiei/ktunnel/cmd/version.go:17.47,18.14 1 0 +github.com/omrikiei/ktunnel/cmd/version.go:18.14,20.4 1 0 +github.com/omrikiei/ktunnel/cmd/version.go:21.3,21.23 1 0 +github.com/omrikiei/ktunnel/pkg/common/common.go:33.27,35.19 2 0 +github.com/omrikiei/ktunnel/pkg/common/common.go:35.19,38.3 2 0 +github.com/omrikiei/ktunnel/pkg/common/common.go:39.2,39.12 1 0 +github.com/omrikiei/ktunnel/pkg/common/common.go:39.12,42.3 2 0 +github.com/omrikiei/ktunnel/pkg/common/common.go:51.41,63.2 4 0 +github.com/omrikiei/ktunnel/pkg/common/common.go:65.65,77.2 4 0 +github.com/omrikiei/ktunnel/pkg/common/common.go:79.43,80.44 1 0 +github.com/omrikiei/ktunnel/pkg/common/common.go:80.44,82.3 1 0 +github.com/omrikiei/ktunnel/pkg/common/common.go:83.2,84.18 2 0 +github.com/omrikiei/ktunnel/pkg/common/common.go:87.48,89.8 2 0 +github.com/omrikiei/ktunnel/pkg/common/common.go:89.8,91.3 1 0 +github.com/omrikiei/ktunnel/pkg/common/common.go:92.2,92.16 1 0 +github.com/omrikiei/ktunnel/pkg/common/common.go:95.53,97.19 2 0 +github.com/omrikiei/ktunnel/pkg/common/common.go:97.19,99.3 1 0 +github.com/omrikiei/ktunnel/pkg/common/common.go:100.2,100.19 1 0 +github.com/omrikiei/ktunnel/pkg/common/common.go:100.19,102.17 2 0 +github.com/omrikiei/ktunnel/pkg/common/common.go:102.17,104.4 1 0 +github.com/omrikiei/ktunnel/pkg/common/common.go:105.3,109.9 1 0 +github.com/omrikiei/ktunnel/pkg/common/common.go:111.2,111.19 1 0 +github.com/omrikiei/ktunnel/pkg/common/common.go:111.19,113.17 2 0 +github.com/omrikiei/ktunnel/pkg/common/common.go:113.17,115.4 1 0 +github.com/omrikiei/ktunnel/pkg/common/common.go:116.3,117.17 2 0 +github.com/omrikiei/ktunnel/pkg/common/common.go:117.17,119.4 1 0 +github.com/omrikiei/ktunnel/pkg/common/common.go:120.3,124.9 1 0 +github.com/omrikiei/ktunnel/pkg/common/common.go:126.2,126.19 1 0 +github.com/omrikiei/ktunnel/pkg/common/common.go:126.19,128.17 2 0 +github.com/omrikiei/ktunnel/pkg/common/common.go:128.17,130.4 1 0 +github.com/omrikiei/ktunnel/pkg/common/common.go:131.3,132.17 2 0 +github.com/omrikiei/ktunnel/pkg/common/common.go:132.17,134.4 1 0 +github.com/omrikiei/ktunnel/pkg/common/common.go:135.3,139.9 1 0 +github.com/omrikiei/ktunnel/pkg/common/common.go:141.2,141.72 1 0 +github.com/omrikiei/ktunnel/main.go:7.13,9.2 1 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:28.44,30.2 1 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:34.97,35.6 1 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:35.6,36.10 1 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:37.34,38.10 1 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:39.30,61.18 9 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:61.18,63.13 2 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:65.4,68.52 1 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:73.67,74.6 1 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:74.6,75.10 1 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:76.34,77.10 1 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:78.11,80.18 2 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:80.18,82.13 2 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:85.4,86.18 2 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:86.18,88.13 2 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:91.4,92.42 2 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:92.42,94.13 2 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:97.4,106.30 4 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:106.30,109.19 3 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:109.19,112.6 2 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:112.11,114.6 1 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:117.4,117.35 1 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:117.35,121.5 3 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:127.108,131.6 3 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:131.6,136.10 3 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:137.21,140.10 3 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:141.11,145.18 3 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:145.18,146.22 1 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:146.22,148.6 1 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:152.5,152.25 1 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:156.4,156.14 1 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:156.14,158.5 1 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:159.4,162.29 3 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:162.29,164.5 1 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:169.76,171.16 2 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:171.16,173.3 1 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:175.2,176.15 2 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:176.15,184.17 2 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:184.17,186.4 1 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:188.3,188.36 1 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:191.2,196.16 3 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:196.16,197.16 1 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:197.16,199.4 1 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:200.3,207.13 2 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:210.2,211.12 2 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:211.12,215.3 3 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:217.2,217.12 1 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:217.12,220.3 2 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:221.2,221.12 1 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:221.12,224.3 2 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:226.2,226.6 1 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:226.6,229.17 3 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:229.17,231.4 1 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:234.3,235.59 2 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:240.59,242.16 2 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:242.16,244.3 1 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:246.2,247.14 2 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:247.14,249.17 2 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:249.17,251.4 1 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:252.3,252.52 1 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:255.2,257.16 3 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:257.16,259.3 1 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:262.2,262.12 1 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:262.12,265.3 2 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:267.2,269.30 3 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:273.50,283.25 2 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:283.25,284.32 1 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:284.32,286.4 1 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:289.2,289.17 1 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:294.29,295.33 1 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:295.33,298.3 2 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:303.39,304.33 1 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:304.33,309.3 4 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:314.43,315.33 1 0 +github.com/omrikiei/ktunnel/pkg/server/server.go:315.33,318.3 2 0 github.com/omrikiei/ktunnel/tunnel_pb/tunnel.pb.go:53.35,55.2 1 0 github.com/omrikiei/ktunnel/tunnel_pb/tunnel.pb.go:57.50,59.2 1 0 github.com/omrikiei/ktunnel/tunnel_pb/tunnel.pb.go:78.39,80.2 1 0 @@ -299,80 +377,6 @@ github.com/omrikiei/ktunnel/tunnel_pb/tunnel.pb.go:408.68,410.2 1 0 github.com/omrikiei/ktunnel/tunnel_pb/tunnel.pb.go:412.69,414.50 2 0 github.com/omrikiei/ktunnel/tunnel_pb/tunnel.pb.go:414.50,416.3 1 0 github.com/omrikiei/ktunnel/tunnel_pb/tunnel.pb.go:417.2,417.15 1 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:28.44,30.2 1 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:34.97,35.6 1 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:35.6,36.10 1 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:37.34,38.10 1 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:39.30,61.18 9 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:61.18,63.13 2 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:65.4,68.52 1 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:73.67,74.6 1 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:74.6,75.10 1 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:76.34,77.10 1 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:78.11,80.18 2 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:80.18,82.13 2 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:85.4,86.18 2 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:86.18,88.13 2 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:91.4,92.42 2 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:92.42,94.13 2 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:97.4,106.30 4 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:106.30,109.19 3 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:109.19,112.6 2 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:112.11,114.6 1 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:117.4,117.35 1 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:117.35,121.5 3 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:127.108,131.6 3 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:131.6,136.10 3 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:137.21,140.10 3 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:141.11,145.18 3 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:145.18,146.22 1 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:146.22,148.6 1 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:152.5,152.25 1 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:156.4,156.14 1 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:156.14,158.5 1 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:159.4,162.29 3 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:162.29,164.5 1 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:169.76,171.16 2 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:171.16,173.3 1 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:175.2,176.15 2 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:176.15,184.17 2 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:184.17,186.4 1 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:188.3,188.36 1 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:191.2,196.16 3 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:196.16,197.16 1 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:197.16,199.4 1 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:200.3,207.13 2 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:210.2,211.12 2 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:211.12,215.3 3 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:217.2,217.12 1 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:217.12,220.3 2 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:221.2,221.12 1 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:221.12,224.3 2 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:226.2,226.6 1 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:226.6,229.17 3 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:229.17,231.4 1 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:234.3,235.59 2 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:240.59,242.16 2 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:242.16,244.3 1 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:246.2,247.14 2 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:247.14,249.17 2 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:249.17,251.4 1 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:252.3,252.52 1 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:255.2,257.16 3 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:257.16,259.3 1 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:262.2,262.12 1 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:262.12,265.3 2 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:267.2,269.30 3 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:273.50,283.25 2 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:283.25,284.32 1 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:284.32,286.4 1 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:289.2,289.17 1 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:294.29,295.33 1 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:295.33,298.3 2 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:303.39,304.33 1 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:304.33,309.3 4 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:314.43,315.33 1 0 -github.com/omrikiei/ktunnel/pkg/server/server.go:315.33,318.3 2 0 github.com/omrikiei/ktunnel/pkg/common/common.go:33.27,35.19 2 0 github.com/omrikiei/ktunnel/pkg/common/common.go:35.19,38.3 2 0 github.com/omrikiei/ktunnel/pkg/common/common.go:39.2,39.12 1 0 @@ -404,167 +408,172 @@ github.com/omrikiei/ktunnel/pkg/common/common.go:131.3,132.17 2 0 github.com/omrikiei/ktunnel/pkg/common/common.go:132.17,134.4 1 0 github.com/omrikiei/ktunnel/pkg/common/common.go:135.3,139.9 1 0 github.com/omrikiei/ktunnel/pkg/common/common.go:141.2,141.72 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:26.60,33.2 1 3 -github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:36.62,38.2 1 2 -github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:41.55,46.2 4 3 -github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:49.52,54.2 4 4 -github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:57.58,60.35 3 1 -github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:60.35,61.16 1 1 -github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:61.16,65.4 3 1 -github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:70.55,73.32 3 1 -github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:73.32,74.16 1 1 -github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:74.16,78.4 3 1 -github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:83.63,100.41 11 2 -github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:100.41,102.24 2 1 -github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:102.24,105.18 3 1 -github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:105.18,107.12 2 1 -github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:108.25,108.25 0 1 -github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:109.13,109.13 0 0 -github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:111.10,113.5 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:118.2,118.35 1 2 -github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:118.35,120.24 2 2 -github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:120.24,123.18 3 2 -github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:123.18,125.12 2 1 -github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:126.25,126.25 0 1 -github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:127.13,127.13 0 0 -github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:129.10,131.5 1 1 -github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:136.2,137.12 2 2 -github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:137.12,140.3 2 2 -github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:142.2,142.9 1 2 -github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:143.20,144.19 1 1 -github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:145.18,149.28 3 1 -github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:149.28,151.4 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:152.3,152.20 1 1 -github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:152.20,155.4 2 0 -github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:156.3,156.13 1 1 -github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:161.51,165.12 3 0 -github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:165.12,170.41 4 0 -github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:170.41,171.39 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:171.39,173.5 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:173.10,175.5 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:176.4,176.14 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:179.3,180.13 2 0 -github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:185.71,193.2 7 2 -github.com/omrikiei/ktunnel/pkg/k8s/client.go:18.52,22.2 3 1 -github.com/omrikiei/ktunnel/pkg/k8s/client.go:24.47,28.2 3 2 -github.com/omrikiei/ktunnel/pkg/k8s/client.go:30.107,36.2 5 1 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:44.35,44.52 1 2 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:45.45,47.2 1 4 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:48.40,48.67 1 1 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:58.25,62.2 3 1 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:65.23,69.2 3 5 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:71.50,73.23 2 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:73.23,76.3 2 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:77.2,83.23 4 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:83.23,85.3 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:87.2,90.60 3 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:90.60,93.3 2 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:95.2,96.22 2 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:96.22,98.3 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:100.2,101.16 2 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:101.16,103.3 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:104.2,105.19 2 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:108.53,113.71 3 1 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:113.71,115.3 1 1 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:117.2,118.16 2 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:118.16,121.3 2 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:123.2,125.53 3 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:128.96,137.16 5 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:137.16,139.3 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:140.2,140.18 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:143.59,144.39 1 5 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:144.39,145.23 1 5 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:145.23,147.4 1 2 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:149.2,149.14 1 3 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:152.150,154.17 2 5 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:154.17,156.3 1 3 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:157.2,157.16 1 5 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:157.16,159.3 1 1 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:160.2,160.15 1 5 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:160.15,162.3 1 1 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:163.2,189.3 7 5 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:203.22,237.2 5 1 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:239.114,261.2 1 1 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:263.95,266.16 3 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:266.16,268.3 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:269.2,272.39 4 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:272.39,273.26 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:273.26,275.9 2 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:277.3,277.41 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:277.41,279.4 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:281.2,282.33 2 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:282.33,284.3 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:286.2,286.12 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:289.168,295.16 5 0 +github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:27.78,35.2 1 3 +github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:38.62,40.2 1 2 +github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:43.55,48.2 4 3 +github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:51.52,56.2 4 4 +github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:59.58,62.35 3 1 +github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:62.35,63.16 1 1 +github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:63.16,67.4 3 1 +github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:72.55,75.32 3 1 +github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:75.32,76.16 1 1 +github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:76.16,80.4 3 1 +github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:85.63,102.41 11 2 +github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:102.41,104.24 2 1 +github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:104.24,107.18 3 1 +github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:107.18,109.12 2 1 +github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:110.25,110.25 0 1 +github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:111.13,111.13 0 0 +github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:113.10,115.5 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:120.2,120.35 1 2 +github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:120.35,122.24 2 2 +github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:122.24,125.18 3 2 +github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:125.18,127.12 2 1 +github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:128.25,128.25 0 1 +github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:129.13,129.13 0 0 +github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:131.10,133.5 1 1 +github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:138.2,139.12 2 2 +github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:139.12,142.3 2 2 +github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:144.2,144.9 1 2 +github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:145.20,146.19 1 1 +github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:147.18,151.28 3 1 +github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:151.28,153.4 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:154.3,154.20 1 1 +github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:154.20,157.4 2 0 +github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:158.3,158.13 1 1 +github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:163.51,167.12 3 0 +github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:167.12,172.41 4 0 +github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:172.41,173.39 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:173.39,175.5 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:175.10,177.5 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:178.4,178.14 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:181.3,182.13 2 0 +github.com/omrikiei/ktunnel/pkg/k8s/cleanup.go:187.71,195.2 7 2 +github.com/omrikiei/ktunnel/pkg/k8s/client.go:24.52,28.2 3 0 +github.com/omrikiei/ktunnel/pkg/k8s/client.go:30.47,34.2 3 0 +github.com/omrikiei/ktunnel/pkg/k8s/client.go:36.116,42.2 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/client.go:44.107,50.2 5 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:49.70,56.2 2 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:58.62,60.16 2 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:60.16,63.3 2 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:65.2,73.3 4 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:76.35,76.52 1 2 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:77.45,79.2 1 4 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:80.40,80.67 1 1 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:90.25,94.2 3 1 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:97.23,101.2 3 5 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:103.49,105.23 2 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:105.23,108.3 2 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:109.2,115.23 4 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:115.23,117.3 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:119.2,122.60 3 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:122.60,125.3 2 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:127.2,128.21 2 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:128.21,130.3 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:132.2,133.16 2 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:133.16,135.3 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:136.2,137.19 2 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:140.52,145.71 3 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:145.71,147.3 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:149.2,150.16 2 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:150.16,153.3 2 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:155.2,157.53 3 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:160.92,166.16 2 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:166.16,168.3 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:169.2,169.18 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:172.59,173.39 1 5 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:173.39,174.23 1 5 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:174.23,176.4 1 2 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:178.2,178.14 1 3 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:181.150,183.17 2 5 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:183.17,185.3 1 3 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:186.2,186.16 1 5 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:186.16,188.3 1 1 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:189.2,189.15 1 5 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:189.15,191.3 1 1 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:192.2,218.3 7 5 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:232.22,266.2 5 1 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:268.114,290.2 1 1 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:292.79,295.16 3 0 github.com/omrikiei/ktunnel/pkg/k8s/common.go:295.16,297.3 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:299.2,303.16 4 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:303.16,305.3 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:306.2,309.16 4 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:309.16,311.3 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:312.2,312.40 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:312.40,314.3 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:316.2,317.35 2 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:317.35,323.17 5 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:323.17,325.4 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:326.3,331.17 5 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:331.17,333.4 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:335.3,335.13 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:335.13,336.24 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:336.25,337.5 0 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:338.4,338.33 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:338.33,341.5 2 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:341.10,341.37 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:341.37,343.54 2 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:343.54,345.6 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:348.3,348.13 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:348.13,349.50 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:349.50,351.5 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:355.2,358.12 3 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:358.12,361.3 2 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:363.2,363.9 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:364.33,365.18 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:366.16,367.27 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:371.88,374.48 3 6 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:374.48,376.3 1 6 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:376.8,376.54 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:376.54,379.3 2 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:380.2,383.60 4 6 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:383.60,385.3 1 2 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:386.2,391.3 2 6 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:394.74,395.12 1 2 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:395.12,399.65 2 2 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:399.65,401.26 2 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:401.26,403.5 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:407.3,408.53 2 2 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:408.53,410.4 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:412.3,422.17 6 2 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:422.17,426.4 3 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:428.3,430.41 2 2 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:430.41,432.11 2 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:432.11,433.13 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:436.4,437.18 2 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:437.18,441.5 3 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:443.4,443.22 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:443.22,446.5 2 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:448.4,448.13 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:448.13,451.5 2 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:454.3,454.21 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:458.76,459.67 1 2 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:459.67,461.63 2 1 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:461.63,463.4 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:465.3,465.103 1 1 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:465.103,467.4 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:469.3,469.69 1 1 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:469.69,471.4 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:473.3,473.78 1 1 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:473.78,475.4 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:477.3,477.92 1 1 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:479.2,479.77 1 1 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:482.130,483.35 1 1 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:483.35,485.25 2 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:485.25,487.4 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/common.go:489.2,489.12 1 1 -github.com/omrikiei/ktunnel/pkg/k8s/exposer.go:45.9,53.9 6 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:298.2,300.39 3 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:300.39,301.26 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:301.26,303.9 2 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:305.3,305.41 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:305.41,307.4 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:309.2,310.33 2 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:310.33,312.3 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:314.2,314.12 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:317.163,321.16 4 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:321.16,323.3 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:325.2,329.16 4 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:329.16,331.3 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:332.2,335.16 4 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:335.16,337.3 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:338.2,338.40 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:338.40,340.3 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:342.2,343.35 2 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:343.35,349.17 5 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:349.17,351.4 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:352.3,357.17 5 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:357.17,359.4 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:361.3,361.13 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:361.13,362.24 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:362.25,363.5 0 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:364.4,364.33 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:364.33,367.5 2 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:367.10,367.37 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:367.37,369.54 2 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:369.54,371.6 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:374.3,374.13 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:374.13,375.50 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:375.50,377.5 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:381.2,384.12 3 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:384.12,387.3 2 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:389.2,389.9 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:390.33,391.18 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:392.16,393.27 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:397.88,400.48 3 6 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:400.48,402.3 1 6 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:402.8,402.54 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:402.54,405.3 2 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:406.2,409.60 4 6 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:409.60,411.3 1 2 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:412.2,417.3 2 6 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:420.74,421.12 1 2 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:421.12,425.65 2 2 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:425.65,427.26 2 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:427.26,429.5 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:433.3,434.53 2 2 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:434.53,436.4 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:438.3,448.17 6 2 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:448.17,452.4 3 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:454.3,456.41 2 2 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:456.41,458.11 2 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:458.11,459.13 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:462.4,463.18 2 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:463.18,467.5 3 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:469.4,469.22 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:469.22,472.5 2 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:474.4,474.13 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:474.13,477.5 2 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:480.3,480.21 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:484.76,485.67 1 2 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:485.67,487.63 2 1 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:487.63,489.4 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:491.3,491.103 1 1 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:491.103,493.4 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:495.3,495.69 1 1 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:495.69,497.4 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:499.3,499.78 1 1 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:499.78,501.4 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:503.3,503.92 1 1 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:505.2,505.77 1 1 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:508.130,509.35 1 1 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:509.35,511.25 2 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:511.25,513.4 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/common.go:515.2,515.12 1 1 +github.com/omrikiei/ktunnel/pkg/k8s/exposer.go:45.9,53.9 7 0 github.com/omrikiei/ktunnel/pkg/k8s/exposer.go:53.9,55.3 1 0 github.com/omrikiei/ktunnel/pkg/k8s/exposer.go:56.2,56.29 1 0 github.com/omrikiei/ktunnel/pkg/k8s/exposer.go:56.29,58.17 2 0 @@ -589,7 +598,7 @@ github.com/omrikiei/ktunnel/pkg/k8s/exposer.go:149.2,149.21 1 0 github.com/omrikiei/ktunnel/pkg/k8s/exposer.go:149.21,153.46 4 0 github.com/omrikiei/ktunnel/pkg/k8s/exposer.go:153.46,161.18 2 0 github.com/omrikiei/ktunnel/pkg/k8s/exposer.go:161.18,163.5 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/exposer.go:164.4,165.29 2 0 +github.com/omrikiei/ktunnel/pkg/k8s/exposer.go:164.4,165.28 2 0 github.com/omrikiei/ktunnel/pkg/k8s/exposer.go:167.3,167.31 1 0 github.com/omrikiei/ktunnel/pkg/k8s/exposer.go:167.31,173.18 4 0 github.com/omrikiei/ktunnel/pkg/k8s/exposer.go:173.18,175.5 1 0 @@ -601,12 +610,12 @@ github.com/omrikiei/ktunnel/pkg/k8s/exposer.go:187.23,189.5 1 0 github.com/omrikiei/ktunnel/pkg/k8s/exposer.go:190.4,190.50 1 0 github.com/omrikiei/ktunnel/pkg/k8s/exposer.go:192.3,192.74 1 0 github.com/omrikiei/ktunnel/pkg/k8s/exposer.go:195.2,196.12 2 0 -github.com/omrikiei/ktunnel/pkg/k8s/exposer.go:199.101,201.21 2 0 -github.com/omrikiei/ktunnel/pkg/k8s/exposer.go:201.21,204.17 3 0 -github.com/omrikiei/ktunnel/pkg/k8s/exposer.go:204.17,206.4 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/exposer.go:208.2,210.16 3 0 -github.com/omrikiei/ktunnel/pkg/k8s/exposer.go:210.16,212.3 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/exposer.go:213.2,213.12 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/exposer.go:199.86,200.21 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/exposer.go:200.21,203.17 3 0 +github.com/omrikiei/ktunnel/pkg/k8s/exposer.go:203.17,205.4 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/exposer.go:207.2,209.16 3 0 +github.com/omrikiei/ktunnel/pkg/k8s/exposer.go:209.16,211.3 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/exposer.go:212.2,212.12 1 0 github.com/omrikiei/ktunnel/pkg/k8s/injector.go:14.31,16.54 2 0 github.com/omrikiei/ktunnel/pkg/k8s/injector.go:16.54,18.3 1 0 github.com/omrikiei/ktunnel/pkg/k8s/injector.go:21.118,22.45 1 2 @@ -614,25 +623,25 @@ github.com/omrikiei/ktunnel/pkg/k8s/injector.go:22.45,26.3 3 1 github.com/omrikiei/ktunnel/pkg/k8s/injector.go:27.2,33.22 3 1 github.com/omrikiei/ktunnel/pkg/k8s/injector.go:33.22,35.3 1 0 github.com/omrikiei/ktunnel/pkg/k8s/injector.go:36.2,37.18 2 1 -github.com/omrikiei/ktunnel/pkg/k8s/injector.go:40.159,49.16 9 0 -github.com/omrikiei/ktunnel/pkg/k8s/injector.go:49.16,51.3 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/injector.go:52.2,52.35 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/injector.go:52.35,54.3 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/injector.go:55.2,56.16 2 0 -github.com/omrikiei/ktunnel/pkg/k8s/injector.go:56.16,58.3 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/injector.go:59.2,59.18 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/injector.go:62.67,63.28 1 3 -github.com/omrikiei/ktunnel/pkg/k8s/injector.go:63.28,65.3 1 2 -github.com/omrikiei/ktunnel/pkg/k8s/injector.go:66.2,67.33 2 1 -github.com/omrikiei/ktunnel/pkg/k8s/injector.go:67.33,68.23 1 1 -github.com/omrikiei/ktunnel/pkg/k8s/injector.go:68.23,70.9 2 1 -github.com/omrikiei/ktunnel/pkg/k8s/injector.go:74.2,74.18 1 1 -github.com/omrikiei/ktunnel/pkg/k8s/injector.go:74.18,78.3 3 1 -github.com/omrikiei/ktunnel/pkg/k8s/injector.go:78.8,80.3 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/injector.go:83.123,87.16 4 0 -github.com/omrikiei/ktunnel/pkg/k8s/injector.go:87.16,89.3 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/injector.go:90.2,91.16 2 0 -github.com/omrikiei/ktunnel/pkg/k8s/injector.go:91.16,93.3 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/injector.go:94.2,99.22 2 0 -github.com/omrikiei/ktunnel/pkg/k8s/injector.go:99.22,101.3 1 0 -github.com/omrikiei/ktunnel/pkg/k8s/injector.go:102.2,103.18 2 0 +github.com/omrikiei/ktunnel/pkg/k8s/injector.go:40.176,48.16 8 0 +github.com/omrikiei/ktunnel/pkg/k8s/injector.go:48.16,50.3 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/injector.go:51.2,51.35 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/injector.go:51.35,53.3 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/injector.go:54.2,55.16 2 0 +github.com/omrikiei/ktunnel/pkg/k8s/injector.go:55.16,57.3 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/injector.go:58.2,58.18 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/injector.go:61.67,62.28 1 3 +github.com/omrikiei/ktunnel/pkg/k8s/injector.go:62.28,64.3 1 2 +github.com/omrikiei/ktunnel/pkg/k8s/injector.go:65.2,66.33 2 1 +github.com/omrikiei/ktunnel/pkg/k8s/injector.go:66.33,67.23 1 1 +github.com/omrikiei/ktunnel/pkg/k8s/injector.go:67.23,69.9 2 1 +github.com/omrikiei/ktunnel/pkg/k8s/injector.go:73.2,73.18 1 1 +github.com/omrikiei/ktunnel/pkg/k8s/injector.go:73.18,77.3 3 1 +github.com/omrikiei/ktunnel/pkg/k8s/injector.go:77.8,79.3 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/injector.go:82.140,85.16 3 0 +github.com/omrikiei/ktunnel/pkg/k8s/injector.go:85.16,87.3 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/injector.go:88.2,89.16 2 0 +github.com/omrikiei/ktunnel/pkg/k8s/injector.go:89.16,91.3 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/injector.go:92.2,97.22 2 0 +github.com/omrikiei/ktunnel/pkg/k8s/injector.go:97.22,99.3 1 0 +github.com/omrikiei/ktunnel/pkg/k8s/injector.go:100.2,101.18 2 0 diff --git a/pkg/k8s/cleanup.go b/pkg/k8s/cleanup.go index 8eb7063..9671973 100644 --- a/pkg/k8s/cleanup.go +++ b/pkg/k8s/cleanup.go @@ -15,6 +15,7 @@ import ( // ResourceTracker keeps track of resources created by ktunnel for cleanup type ResourceTracker struct { + clients *Clients namespace string deployments []string services []string @@ -23,8 +24,9 @@ type ResourceTracker struct { } // NewResourceTracker creates a new ResourceTracker for the given namespace -func NewResourceTracker(namespace string) *ResourceTracker { +func NewResourceTracker(namespace string, clients *Clients) *ResourceTracker { return &ResourceTracker{ + clients: clients, namespace: namespace, deployments: make([]string, 0), services: make([]string, 0), @@ -101,7 +103,7 @@ func (rt *ResourceTracker) Cleanup(ctx context.Context) error { wg.Add(1) go func(name string) { defer wg.Done() - err := getDeploymentsClient().Delete(ctx, name, metav1.DeleteOptions{}) + err := rt.clients.Deployments.Delete(ctx, name, metav1.DeleteOptions{}) if err != nil { log.Warnf("Failed to delete deployment %s: %v", name, err) select { @@ -119,7 +121,7 @@ func (rt *ResourceTracker) Cleanup(ctx context.Context) error { wg.Add(1) go func(name string) { defer wg.Done() - err := getServicesClient().Delete(ctx, name, metav1.DeleteOptions{}) + err := rt.clients.Services.Delete(ctx, name, metav1.DeleteOptions{}) if err != nil { log.Warnf("Failed to delete service %s: %v", name, err) select { diff --git a/pkg/k8s/cleanup_test.go b/pkg/k8s/cleanup_test.go index ec93c8d..b2e9f64 100644 --- a/pkg/k8s/cleanup_test.go +++ b/pkg/k8s/cleanup_test.go @@ -11,7 +11,17 @@ import ( ) func TestResourceTracker_AddAndRemove(t *testing.T) { - rt := NewResourceTracker("test-namespace") + namespace := "test-namespace" + fakeClient := testclient.NewSimpleClientset() + // Initialize the clients + deploymentsClient = fakeClient.AppsV1().Deployments(namespace) + svcClient = fakeClient.CoreV1().Services(namespace) + + clients := &Clients{ + Deployments: deploymentsClient, + Services: svcClient, + } + rt := NewResourceTracker("test-namespace", clients) // Test adding resources rt.AddDeployment("test-deployment-1") @@ -51,8 +61,13 @@ func TestResourceTracker_Cleanup(t *testing.T) { deploymentsClient = fakeClient.AppsV1().Deployments(namespace) svcClient = fakeClient.CoreV1().Services(namespace) + clients := &Clients{ + Deployments: deploymentsClient, + Services: svcClient, + } + // Create a resource tracker - rt := NewResourceTracker(namespace) + rt := NewResourceTracker(namespace, clients) rt.SetTimeout(5 * time.Second) // Create test resources in the fake client @@ -88,7 +103,17 @@ func TestResourceTracker_Cleanup(t *testing.T) { } func TestResourceTracker_CleanupTimeout(t *testing.T) { - rt := NewResourceTracker("test-namespace") + namespace := "test-namespace" + fakeClient := testclient.NewSimpleClientset() + // Initialize the clients + deploymentsClient = fakeClient.AppsV1().Deployments(namespace) + svcClient = fakeClient.CoreV1().Services(namespace) + + clients := &Clients{ + Deployments: deploymentsClient, + Services: svcClient, + } + rt := NewResourceTracker("test-namespace", clients) rt.SetTimeout(1 * time.Millisecond) // Very short timeout // Add some resources diff --git a/pkg/k8s/client.go b/pkg/k8s/client.go index f35e710..6322571 100644 --- a/pkg/k8s/client.go +++ b/pkg/k8s/client.go @@ -15,6 +15,12 @@ var ( svcClient v12.ServiceInterface ) +type Clients struct { + Deployments v1.DeploymentInterface + Pods v12.PodInterface + Services v12.ServiceInterface +} + func getDeploymentsClient() v1.DeploymentInterface { clientMutex.RLock() defer clientMutex.RUnlock() @@ -27,6 +33,14 @@ func getServicesClient() v12.ServiceInterface { return svcClient } +func NewClients(deployments v1.DeploymentInterface, pods v12.PodInterface, services v12.ServiceInterface) *Clients { + return &Clients{ + Deployments: deployments, + Pods: pods, + Services: services, + } +} + func setClients(deployments v1.DeploymentInterface, pods v12.PodInterface, services v12.ServiceInterface) { clientMutex.Lock() defer clientMutex.Unlock() diff --git a/pkg/k8s/common.go b/pkg/k8s/common.go index 59d0f8d..874445f 100644 --- a/pkg/k8s/common.go +++ b/pkg/k8s/common.go @@ -41,6 +41,38 @@ const ( type ByCreationTime []apiv1.Pod +type KubeService struct { + clients *Clients + config *rest.Config +} + +func NewKubeService(kubeCtx, namespace string) (*KubeService, error) { + cfg := GetKubeConfig(kubeCtx) + + return &KubeService{ + clients: GetClients(cfg, namespace), + config: cfg, + }, nil +} + +func GetClients(cfg *rest.Config, namespace string) *Clients { + clientSet, err := kubernetes.NewForConfig(cfg) + if err != nil { + log.Errorf("Failed to get k8s client: %v", err) + os.Exit(1) + } + + deploymentsClient = clientSet.AppsV1().Deployments(namespace) + podsClient = clientSet.CoreV1().Pods(namespace) + svcClient = clientSet.CoreV1().Services(namespace) + + return &Clients{ + Deployments: deploymentsClient, + Pods: podsClient, + Services: svcClient, + } +} + func (a ByCreationTime) Len() int { return len(a) } func (a ByCreationTime) Less(i, j int) bool { return a[i].CreationTimestamp.After(a[j].CreationTimestamp.Time) @@ -68,7 +100,7 @@ func IsVerbose() bool { return verbose } -func getKubeConfig(kubeCtx *string) *rest.Config { +func GetKubeConfig(kubeCtx string) *rest.Config { configMutex.RLock() if kubeconfig != nil { defer configMutex.RUnlock() @@ -93,8 +125,8 @@ func getKubeConfig(kubeCtx *string) *rest.Config { } var configOverrides *clientcmd.ConfigOverrides - if (kubeCtx) != nil { - configOverrides = &clientcmd.ConfigOverrides{CurrentContext: *kubeCtx} + if (kubeCtx) != "" { + configOverrides = &clientcmd.ConfigOverrides{CurrentContext: kubeCtx} } config, err := clientcmd.NewNonInteractiveDeferredLoadingClientConfig(loadingRules, configOverrides).ClientConfig() @@ -105,7 +137,7 @@ func getKubeConfig(kubeCtx *string) *rest.Config { return kubeconfig } -func getClients(namespace *string, kubeCtx *string) { +func getClients(namespace *string, kubeCtx string) { clientMutex.Lock() defer clientMutex.Unlock() @@ -114,7 +146,7 @@ func getClients(namespace *string, kubeCtx *string) { return } - clientSet, err := kubernetes.NewForConfig(getKubeConfig(kubeCtx)) + clientSet, err := kubernetes.NewForConfig(GetKubeConfig(kubeCtx)) if err != nil { log.Errorf("Failed to get k8s client: %v", err) os.Exit(1) @@ -125,13 +157,10 @@ func getClients(namespace *string, kubeCtx *string) { svcClient = clientSet.CoreV1().Services(*namespace) } -func getPodsFilteredByLabel(namespace, kubeCtx, labelSelector *string) (*apiv1.PodList, error) { - getClients(namespace, kubeCtx) - clientMutex.RLock() - defer clientMutex.RUnlock() - pods, err := podsClient.List( +func (k *KubeService) getPodsFilteredByLabel(labelSelector string) (*apiv1.PodList, error) { + pods, err := k.clients.Pods.List( context.Background(), metav1.ListOptions{ - LabelSelector: *labelSelector, + LabelSelector: labelSelector, }, ) if err != nil { @@ -260,13 +289,12 @@ func newService(namespace, name string, ports []apiv1.ServicePort, serviceType a } } -func getPodNames(namespace, deploymentName *string, podsPtr *[]string, kubeCtx *string) error { - labelSelector := deploymentNameLabel + "=" + *deploymentName + "," + deploymentInstanceLabel + "=" + *deploymentName - filteredPods, err := getPodsFilteredByLabel(namespace, kubeCtx, &labelSelector) +func (k *KubeService) getPodNames(deploymentName string, pods []string) error { + labelSelector := deploymentNameLabel + "=" + deploymentName + "," + deploymentInstanceLabel + "=" + deploymentName + filteredPods, err := k.getPodsFilteredByLabel(labelSelector) if err != nil { return err } - pods := *podsPtr matchingPods := ByCreationTime{} pIndex := 0 for _, p := range filteredPods.Items { @@ -286,18 +314,16 @@ func getPodNames(namespace, deploymentName *string, podsPtr *[]string, kubeCtx * return nil } -func PortForward(namespace, deploymentName *string, targetPort string, fwdWaitGroup *sync.WaitGroup, stopChan <-chan struct{}, kubecontext *string) (*[]string, error) { - getClients(namespace, kubecontext) - +func (k *KubeService) PortForward(namespace, deploymentName string, targetPort string, fwdWaitGroup *sync.WaitGroup, stopChan <-chan struct{}) (*[]string, error) { clientMutex.RLock() - deployment, err := deploymentsClient.Get(context.Background(), *deploymentName, metav1.GetOptions{}) + deployment, err := deploymentsClient.Get(context.Background(), deploymentName, metav1.GetOptions{}) clientMutex.RUnlock() if err != nil { return nil, err } podNames := make([]string, *deployment.Spec.Replicas) - err = getPodNames(namespace, deploymentName, &podNames, kubecontext) + err = k.getPodNames(deploymentName, podNames) fwdWaitGroup.Add(int(*deployment.Spec.Replicas)) if err != nil { @@ -317,9 +343,9 @@ func PortForward(namespace, deploymentName *string, targetPort string, fwdWaitGr for i, podName := range podNames { readyChan := make(chan struct{}, 1) ports := []string{fmt.Sprintf("%s:%s", sourcePorts[i], targetPort)} - serverURL := getPortForwardURL(getKubeConfig(kubecontext), *namespace, podName) + serverURL := getPortForwardURL(k.config, namespace, podName) - transport, upgrader, err := spdy.RoundTripperFor(getKubeConfig(kubecontext)) + transport, upgrader, err := spdy.RoundTripperFor(k.config) if err != nil { return nil, err } diff --git a/pkg/k8s/exposer.go b/pkg/k8s/exposer.go index d464107..33e2be0 100644 --- a/pkg/k8s/exposer.go +++ b/pkg/k8s/exposer.go @@ -24,8 +24,8 @@ var supportedSchemes = map[string]v12.Protocol{ "grpc-web": v12.ProtocolTCP, } -func ExposeAsService( - namespace, name *string, +func (k *KubeService) ExposeAsService( + namespace, name string, tunnelPort int, scheme string, rawPorts []string, @@ -40,13 +40,13 @@ func ExposeAsService( podTolerations []v12.Toleration, cert, key string, serviceType string, - kubecontext *string, + kubecontext string, cpuReq, cpuLimit, memReq, memLimit int64, ) error { // Initialize resource tracker - tracker := NewResourceTracker(*namespace) - getClients(namespace, kubecontext) - + cfg := GetKubeConfig(kubecontext) + clients := GetClients(cfg, namespace) + tracker := NewResourceTracker(namespace, clients) ports := make([]v12.ServicePort, len(rawPorts)) ctrPorts := make([]v12.ContainerPort, len(ports)) protocol, ok := supportedSchemes[scheme] @@ -81,8 +81,8 @@ func ExposeAsService( } deployment := newDeployment( - *namespace, - *name, + namespace, + name, tunnelPort, image, ctrPorts, @@ -98,12 +98,12 @@ func ExposeAsService( memLimit, ) - service := newService(*namespace, *name, ports, v12.ServiceType(serviceType)) + service := newService(namespace, name, ports, v12.ServiceType(serviceType)) var d *appsv1.Deployment var err error deploymentCreated := false - existingDeployment, err := deploymentsClient.Get(context.Background(), *name, v1.GetOptions{}) + existingDeployment, err := deploymentsClient.Get(context.Background(), name, v1.GetOptions{}) if err != nil && apierrors.IsNotFound(err) { d, err = deploymentsClient.Create(context.Background(), deployment, v1.CreateOptions{ TypeMeta: v1.TypeMeta{}, @@ -114,7 +114,7 @@ func ExposeAsService( return err } deploymentCreated = true - tracker.AddDeployment(*name) + tracker.AddDeployment(name) tracker.StartCleanupOnSignal() } if !deploymentCreated && Reuse { @@ -128,7 +128,7 @@ func ExposeAsService( if err != nil { return err } - d, err = deploymentsClient.Patch(context.Background(), *name, types.MergePatchType, patch, v1.PatchOptions{ + d, err = deploymentsClient.Patch(context.Background(), name, types.MergePatchType, patch, v1.PatchOptions{ TypeMeta: v1.TypeMeta{}, DryRun: nil, FieldManager: "", @@ -149,7 +149,7 @@ func ExposeAsService( if !DeploymentOnly { var newSvc *v12.Service serviceCreated := false - existingService, err := svcClient.Get(context.Background(), *name, v1.GetOptions{}) + existingService, err := svcClient.Get(context.Background(), name, v1.GetOptions{}) if err != nil && apierrors.IsNotFound(err) { newSvc, err = svcClient.Create(context.Background(), service, v1.CreateOptions{ @@ -162,7 +162,7 @@ func ExposeAsService( return err } serviceCreated = true - tracker.AddService(*name) + tracker.AddService(name) } if !serviceCreated && Reuse { // Copy labels and selectors to prevent PATCH issue with immutable fields @@ -173,7 +173,7 @@ func ExposeAsService( if err != nil { return err } - newSvc, err = svcClient.Patch(context.Background(), *name, types.MergePatchType, patch, v1.PatchOptions{ + newSvc, err = svcClient.Patch(context.Background(), name, types.MergePatchType, patch, v1.PatchOptions{ TypeMeta: v1.TypeMeta{}, DryRun: nil, FieldManager: "", @@ -196,17 +196,16 @@ func ExposeAsService( return nil } -func TeardownExposedService(namespace, name string, kubecontext *string, DeploymentOnly bool) error { - getClients(&namespace, kubecontext) +func (k *KubeService) TeardownExposedService(name string, DeploymentOnly bool) error { if !DeploymentOnly { log.Infof("Deleting service %s", name) - err := svcClient.Delete(context.Background(), name, v1.DeleteOptions{}) + err := k.clients.Services.Delete(context.Background(), name, v1.DeleteOptions{}) if err != nil { return err } } log.Infof("Deleting deployment %s", name) - err := deploymentsClient.Delete(context.Background(), name, v1.DeleteOptions{}) + err := k.clients.Deployments.Delete(context.Background(), name, v1.DeleteOptions{}) if err != nil { return err } diff --git a/pkg/k8s/injector.go b/pkg/k8s/injector.go index 215e0dd..bc776b9 100644 --- a/pkg/k8s/injector.go +++ b/pkg/k8s/injector.go @@ -37,15 +37,14 @@ func injectToDeployment(o *appsv1.Deployment, c *apiv1.Container, image string, return true, nil } -func InjectSidecar(namespace, objectName *string, port *int, image string, cert string, key string, readyChan chan<- bool, kubecontext *string) (bool, error) { +func (k *KubeService) InjectSidecar(namespace, objectName *string, port *int, image string, cert string, key string, readyChan chan<- bool, kubecontext *string) (bool, error) { log.Infof("Injecting tunnel sidecar to %s/%s", *namespace, *objectName) - getClients(namespace, kubecontext) cpuReq := int64(100) // in milli-cpu cpuLimit := int64(500) memReq := int64(100) // in mega-bytes memLimit := int64(1000) co := newContainer(*port, image, []apiv1.ContainerPort{}, cert, key, cpuReq, cpuLimit, memReq, memLimit) - obj, err := deploymentsClient.Get(context.Background(), *objectName, metav1.GetOptions{}) + obj, err := k.clients.Deployments.Get(context.Background(), *objectName, metav1.GetOptions{}) if err != nil { return false, err } @@ -80,10 +79,9 @@ func removeFromSpec(s *apiv1.PodSpec, image string) (bool, error) { } } -func RemoveSidecar(namespace, objectName *string, image string, readyChan chan<- bool, kubecontext *string) (bool, error) { +func (k *KubeService) RemoveSidecar(namespace, objectName *string, image string, readyChan chan<- bool, kubecontext *string) (bool, error) { log.Infof("Removing tunnel sidecar from %s/%s", *namespace, *objectName) - getClients(namespace, kubecontext) - obj, err := deploymentsClient.Get(context.Background(), *objectName, metav1.GetOptions{}) + obj, err := k.clients.Deployments.Get(context.Background(), *objectName, metav1.GetOptions{}) if err != nil { return false, err } @@ -91,7 +89,7 @@ func RemoveSidecar(namespace, objectName *string, image string, readyChan chan<- if err != nil { return false, err } - u, updateErr := deploymentsClient.Update(context.Background(), obj, metav1.UpdateOptions{ + u, updateErr := k.clients.Deployments.Update(context.Background(), obj, metav1.UpdateOptions{ TypeMeta: metav1.TypeMeta{}, DryRun: nil, FieldManager: "", diff --git a/pkg/k8s/injector_test.go b/pkg/k8s/injector_test.go index 2c2029f..1876f6b 100644 --- a/pkg/k8s/injector_test.go +++ b/pkg/k8s/injector_test.go @@ -21,31 +21,6 @@ type TestCase struct { ErrResult error } -func createMockClient(kubecontext *string) { - namespace := "default" - fakeClient := testclient.NewSimpleClientset() - deploymentsClient = fakeClient.AppsV1().Deployments(namespace) - podsClient = fakeClient.CoreV1().Pods(namespace) - // Set up a mock kubeconfig - kubeconfig = &rest.Config{ - Host: "https://fake.example.com", - } - getClients(&namespace, kubecontext) // Squeeze the initialization from the tested functions and override the clients - deploymentsClient = fakeClient.AppsV1().Deployments(namespace) - podsClient = fakeClient.CoreV1().Pods(namespace) - - setClients( - fakeClient.AppsV1().Deployments(namespace), - fakeClient.CoreV1().Pods(namespace), - fakeClient.CoreV1().Services(namespace), - ) - - // Set up a mock kubeconfig - kubeconfig = &rest.Config{ - Host: "https://fake.example.com", - } -} - func createDeployment(c v1.DeploymentInterface, name string, replicas int32, containers *[]v14.Container) error { d := v12.Deployment{ ObjectMeta: metav1.ObjectMeta{ @@ -326,6 +301,4 @@ func Test_removeFromSpec(t *testing.T) { } }) } - - createMockClient(nil) }