From e7a7c5e097f2802d62462a65e0f81c4ca2bf663b Mon Sep 17 00:00:00 2001 From: Davanum Srinivas Date: Thu, 21 Dec 2023 21:11:24 -0500 Subject: [PATCH 1/4] create a common package Signed-off-by: Davanum Srinivas --- main.go | 3 +- pkg/client/check.go | 10 +++--- pkg/client/client.go | 6 ++-- pkg/client/download.go | 5 ++- pkg/client/pod_log.go | 6 ++-- pkg/{service => common}/args.go | 2 +- pkg/{service => common}/const.go | 2 +- pkg/service/init.go | 57 ++++++++++++++++---------------- 8 files changed, 46 insertions(+), 45 deletions(-) rename pkg/{service => common}/args.go (99%) rename pkg/{service => common}/const.go (98%) diff --git a/main.go b/main.go index d93d152..77922da 100644 --- a/main.go +++ b/main.go @@ -17,6 +17,7 @@ limitations under the License. package main import ( + "github.com/dims/hydrophone/pkg/common" "log" "os" @@ -27,7 +28,7 @@ import ( func main() { client := client.NewClient() - cfg, err := service.InitArgs() + cfg, err := common.InitArgs() if err != nil { log.Fatal("Error parsing arguments: ", err) } diff --git a/pkg/client/check.go b/pkg/client/check.go index a673eb6..a5e0ddd 100644 --- a/pkg/client/check.go +++ b/pkg/client/check.go @@ -19,10 +19,10 @@ package client import ( "context" "fmt" + "github.com/dims/hydrophone/pkg/common" "log" "time" - "github.com/dims/hydrophone/pkg/service" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/wait" @@ -49,7 +49,7 @@ func (c *Client) PrintE2ELogs() { informerFactory.WaitForCacheSync(wait.NeverStop) for { - pod, _ := podInformer.Lister().Pods(service.Namespace).Get(service.PodName) + pod, _ := podInformer.Lister().Pods(common.Namespace).Get(common.PodName) if pod.Status.Phase == v1.PodRunning { var err error stream := streamLogs{ @@ -86,7 +86,7 @@ func (c *Client) PrintE2ELogs() { // Wait for pod to be in terminated state and get the exit code func (c *Client) podExitCode(pod *v1.Pod) { // Watching the pod's status - watchInterface, err := c.ClientSet.CoreV1().Pods(service.Namespace).Watch(context.TODO(), metav1.ListOptions{ + watchInterface, err := c.ClientSet.CoreV1().Pods(common.Namespace).Watch(context.TODO(), metav1.ListOptions{ FieldSelector: fmt.Sprintf("metadata.name=%s", pod.Name), }) if err != nil { @@ -105,7 +105,7 @@ func (c *Client) podExitCode(pod *v1.Pod) { if pod.Status.Phase == v1.PodSucceeded || pod.Status.Phase == v1.PodFailed { log.Println("Pod terminated.") for _, containerStatus := range pod.Status.ContainerStatuses { - if containerStatus.Name == service.ConformanceContainer && containerStatus.State.Terminated != nil { + if containerStatus.Name == common.ConformanceContainer && containerStatus.State.Terminated != nil { c.ExitCode = int(containerStatus.State.Terminated.ExitCode) } } @@ -116,7 +116,7 @@ func (c *Client) podExitCode(pod *v1.Pod) { if containerStatus.State.Terminated != nil { terminated = true log.Printf("container %s terminated.\n", containerStatus.Name) - if containerStatus.Name == service.ConformanceContainer { + if containerStatus.Name == common.ConformanceContainer { c.ExitCode = int(containerStatus.State.Terminated.ExitCode) } } diff --git a/pkg/client/client.go b/pkg/client/client.go index 8b5b7e2..6a81138 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -18,7 +18,7 @@ package client import ( "context" - "github.com/dims/hydrophone/pkg/service" + "github.com/dims/hydrophone/pkg/common" "k8s.io/client-go/rest" "log" "os" @@ -43,7 +43,7 @@ func (c *Client) FetchFiles(config *rest.Config, clientset *kubernetes.Clientset log.Fatalf("unable to create e2e.log: %v\n", err) } defer e2eLogFile.Close() - err = downloadFile(config, clientset, service.PodName, service.OutputContainer, "/tmp/results/e2e.log", e2eLogFile) + err = downloadFile(config, clientset, common.PodName, common.OutputContainer, "/tmp/results/e2e.log", e2eLogFile) if err != nil { log.Fatalf("unable to download e2e.log: %v\n", err) } @@ -53,7 +53,7 @@ func (c *Client) FetchFiles(config *rest.Config, clientset *kubernetes.Clientset log.Fatalf("unable to create junit_01.xml: %v\n", err) } defer junitXMLFile.Close() - err = downloadFile(config, clientset, service.PodName, service.OutputContainer, "/tmp/results/junit_01.xml", junitXMLFile) + err = downloadFile(config, clientset, common.PodName, common.OutputContainer, "/tmp/results/junit_01.xml", junitXMLFile) if err != nil { log.Fatalf("unable to download junit_01.xml: %v\n", err) } diff --git a/pkg/client/download.go b/pkg/client/download.go index 1561d52..88e2bcc 100644 --- a/pkg/client/download.go +++ b/pkg/client/download.go @@ -18,6 +18,7 @@ package client import ( "context" + "github.com/dims/hydrophone/pkg/common" "io" corev1 "k8s.io/api/core/v1" @@ -25,8 +26,6 @@ import ( "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" "k8s.io/client-go/tools/remotecommand" - - "github.com/dims/hydrophone/pkg/service" ) func downloadFile(config *rest.Config, clientset *kubernetes.Clientset, @@ -36,7 +35,7 @@ func downloadFile(config *rest.Config, clientset *kubernetes.Clientset, req := clientset.CoreV1().RESTClient().Post(). Resource("pods"). Name(podName). - Namespace(service.Namespace). + Namespace(common.Namespace). SubResource("exec"). Param("container", containerName) diff --git a/pkg/client/pod_log.go b/pkg/client/pod_log.go index 62a4212..1a5d565 100644 --- a/pkg/client/pod_log.go +++ b/pkg/client/pod_log.go @@ -18,8 +18,8 @@ package client import ( "bufio" + "github.com/dims/hydrophone/pkg/common" - "github.com/dims/hydrophone/pkg/service" v1 "k8s.io/api/core/v1" "k8s.io/client-go/kubernetes" ) @@ -27,11 +27,11 @@ import ( // List pod resource with the given namespace func getPodLogs(clientset *kubernetes.Clientset, stream streamLogs) { podLogOpts := v1.PodLogOptions{ - Container: service.ConformanceContainer, + Container: common.ConformanceContainer, Follow: true, } - req := clientset.CoreV1().Pods(service.Namespace).GetLogs(service.PodName, &podLogOpts) + req := clientset.CoreV1().Pods(common.Namespace).GetLogs(common.PodName, &podLogOpts) podLogs, err := req.Stream(ctx) if err != nil { stream.errCh <- err diff --git a/pkg/service/args.go b/pkg/common/args.go similarity index 99% rename from pkg/service/args.go rename to pkg/common/args.go index 31c48d4..ac3dbcc 100644 --- a/pkg/service/args.go +++ b/pkg/common/args.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package service +package common import ( "flag" diff --git a/pkg/service/const.go b/pkg/common/const.go similarity index 98% rename from pkg/service/const.go rename to pkg/common/const.go index ee64ef2..44000b8 100644 --- a/pkg/service/const.go +++ b/pkg/common/const.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package service +package common const ( containerImage = "registry.k8s.io/conformance:v1.28.0" diff --git a/pkg/service/init.go b/pkg/service/init.go index 8c420d9..9613227 100644 --- a/pkg/service/init.go +++ b/pkg/service/init.go @@ -19,6 +19,7 @@ package service import ( "context" "fmt" + "github.com/dims/hydrophone/pkg/common" "log" "os" "path/filepath" @@ -38,7 +39,7 @@ var ( ) // Initializes the kube config clientset -func Init(cfg *ArgConfig) (*rest.Config, *kubernetes.Clientset) { +func Init(cfg *common.ArgConfig) (*rest.Config, *kubernetes.Clientset) { config, err := rest.InClusterConfig() if err != nil { kubeconfig := getKubeConfig(cfg.Kubeconfig) @@ -74,10 +75,10 @@ func getKubeConfig(kubeconfig string) string { return kubeconfig } -func RunE2E(clientset *kubernetes.Clientset, cfg *ArgConfig) { +func RunE2E(clientset *kubernetes.Clientset, cfg *common.ArgConfig) { conformanceNS := v1.Namespace{ ObjectMeta: metav1.ObjectMeta{ - Name: Namespace, + Name: common.Namespace, }, } @@ -86,7 +87,7 @@ func RunE2E(clientset *kubernetes.Clientset, cfg *ArgConfig) { Labels: map[string]string{ "component": "conformance", }, - Name: ServiceAccountName, + Name: common.ServiceAccountName, Namespace: "conformance", }, } @@ -96,7 +97,7 @@ func RunE2E(clientset *kubernetes.Clientset, cfg *ArgConfig) { Labels: map[string]string{ "component": "conformance", }, - Name: ClusterRoleName, + Name: common.ClusterRoleName, }, Rules: []rbac.PolicyRule{ { @@ -116,7 +117,7 @@ func RunE2E(clientset *kubernetes.Clientset, cfg *ArgConfig) { Labels: map[string]string{ "component": "conformance", }, - Name: ClusterRoleBindingName, + Name: common.ClusterRoleBindingName, }, RoleRef: rbac.RoleRef{ APIGroup: "rbac.authorization.k8s.io", @@ -140,7 +141,7 @@ func RunE2E(clientset *kubernetes.Clientset, cfg *ArgConfig) { Spec: v1.PodSpec{ Containers: []v1.Container{ { - Name: ConformanceContainer, + Name: common.ConformanceContainer, Image: cfg.ConformanceImage, ImagePullPolicy: v1.PullIfNotPresent, Env: []v1.EnvVar{ @@ -177,7 +178,7 @@ func RunE2E(clientset *kubernetes.Clientset, cfg *ArgConfig) { }, }, { - Name: OutputContainer, + Name: common.OutputContainer, Image: cfg.BusyboxImage, Command: []string{"/bin/sh", "-c", "sleep infinity"}, VolumeMounts: []v1.VolumeMount{ @@ -204,7 +205,7 @@ func RunE2E(clientset *kubernetes.Clientset, cfg *ArgConfig) { ns, err := clientset.CoreV1().Namespaces().Create(ctx, &conformanceNS, metav1.CreateOptions{}) if err != nil { if errors.IsAlreadyExists(err) { - log.Printf("namespace already exist %s", PodName) + log.Printf("namespace already exist %s", common.PodName) } else { log.Fatal(err) } @@ -214,7 +215,7 @@ func RunE2E(clientset *kubernetes.Clientset, cfg *ArgConfig) { sa, err := clientset.CoreV1().ServiceAccounts(ns.Name).Create(ctx, &conformanceSA, metav1.CreateOptions{}) if err != nil { if errors.IsAlreadyExists(err) { - log.Printf("serviceaccount already exist %s", PodName) + log.Printf("serviceaccount already exist %s", common.PodName) } else { log.Fatal(err) } @@ -224,7 +225,7 @@ func RunE2E(clientset *kubernetes.Clientset, cfg *ArgConfig) { clusterRole, err := clientset.RbacV1().ClusterRoles().Create(ctx, &conformanceClusterRole, metav1.CreateOptions{}) if err != nil { if errors.IsAlreadyExists(err) { - log.Printf("clusterrole already exist %s", PodName) + log.Printf("clusterrole already exist %s", common.PodName) } else { log.Fatal(err) } @@ -234,7 +235,7 @@ func RunE2E(clientset *kubernetes.Clientset, cfg *ArgConfig) { clusterRoleBinding, err := clientset.RbacV1().ClusterRoleBindings().Create(ctx, &conformanceClusterRoleBinding, metav1.CreateOptions{}) if err != nil { if errors.IsAlreadyExists(err) { - log.Printf("clusterrolebinding already exist %s", PodName) + log.Printf("clusterrolebinding already exist %s", common.PodName) } else { log.Fatal(err) } @@ -244,7 +245,7 @@ func RunE2E(clientset *kubernetes.Clientset, cfg *ArgConfig) { pod, err := clientset.CoreV1().Pods(ns.Name).Create(ctx, &conformancePod, metav1.CreateOptions{}) if err != nil { if errors.IsAlreadyExists(err) { - log.Printf("pod already exist %s", PodName) + log.Printf("pod already exist %s", common.PodName) } else { log.Fatal(err) } @@ -253,53 +254,53 @@ func RunE2E(clientset *kubernetes.Clientset, cfg *ArgConfig) { } func Cleanup(clientset *kubernetes.Clientset) { - err := clientset.CoreV1().Pods(Namespace).Delete(ctx, PodName, metav1.DeleteOptions{}) + err := clientset.CoreV1().Pods(common.Namespace).Delete(ctx, common.PodName, metav1.DeleteOptions{}) if err != nil { if errors.IsNotFound(err) { - log.Printf("pod %s doesn't exist\n", PodName) + log.Printf("pod %s doesn't exist\n", common.PodName) } else { log.Fatal(err) } } - log.Printf("pod deleted %s\n", PodName) + log.Printf("pod deleted %s\n", common.PodName) - err = clientset.RbacV1().ClusterRoleBindings().Delete(ctx, ClusterRoleBindingName, metav1.DeleteOptions{}) + err = clientset.RbacV1().ClusterRoleBindings().Delete(ctx, common.ClusterRoleBindingName, metav1.DeleteOptions{}) if err != nil { if errors.IsNotFound(err) { - log.Printf("clusterrolebinding %s doesn't exist\n", ClusterRoleBindingName) + log.Printf("clusterrolebinding %s doesn't exist\n", common.ClusterRoleBindingName) } else { log.Fatal(err) } } - log.Printf("clusterrolebinding deleted %s\n", ClusterRoleBindingName) + log.Printf("clusterrolebinding deleted %s\n", common.ClusterRoleBindingName) - err = clientset.RbacV1().ClusterRoles().Delete(ctx, ClusterRoleName, metav1.DeleteOptions{}) + err = clientset.RbacV1().ClusterRoles().Delete(ctx, common.ClusterRoleName, metav1.DeleteOptions{}) if err != nil { if errors.IsNotFound(err) { - log.Printf("clusterrole %s doesn't exist\n", ClusterRoleName) + log.Printf("clusterrole %s doesn't exist\n", common.ClusterRoleName) } else { log.Fatal(err) } } - log.Printf("clusterrole deleted %s\n", ClusterRoleName) + log.Printf("clusterrole deleted %s\n", common.ClusterRoleName) - err = clientset.CoreV1().ServiceAccounts(Namespace).Delete(ctx, ServiceAccountName, metav1.DeleteOptions{}) + err = clientset.CoreV1().ServiceAccounts(common.Namespace).Delete(ctx, common.ServiceAccountName, metav1.DeleteOptions{}) if err != nil { if errors.IsNotFound(err) { - log.Printf("serviceaccount %s doesn't exist\n", ServiceAccountName) + log.Printf("serviceaccount %s doesn't exist\n", common.ServiceAccountName) } else { log.Fatal(err) } } - log.Printf("serviceaccount deleted %s\n", ServiceAccountName) + log.Printf("serviceaccount deleted %s\n", common.ServiceAccountName) - err = clientset.CoreV1().Namespaces().Delete(ctx, Namespace, metav1.DeleteOptions{}) + err = clientset.CoreV1().Namespaces().Delete(ctx, common.Namespace, metav1.DeleteOptions{}) if err != nil { if errors.IsNotFound(err) { - log.Printf("namespace %s doesn't exist\n", Namespace) + log.Printf("namespace %s doesn't exist\n", common.Namespace) } else { log.Fatal(err) } } - log.Printf("namespace deleted %s\n", Namespace) + log.Printf("namespace deleted %s\n", common.Namespace) } From f7051f5b64c3e5504ee6be9d9ed04c59b341f908 Mon Sep 17 00:00:00 2001 From: Davanum Srinivas Date: Thu, 21 Dec 2023 21:15:00 -0500 Subject: [PATCH 2/4] move validation to common package Signed-off-by: Davanum Srinivas --- main.go | 22 ++-------------------- pkg/common/args.go | 26 ++++++++++++++++++++++++++ pkg/common/const.go | 1 + 3 files changed, 29 insertions(+), 20 deletions(-) diff --git a/main.go b/main.go index 77922da..047ca2c 100644 --- a/main.go +++ b/main.go @@ -36,31 +36,13 @@ func main() { config, clientSet := service.Init(cfg) client.ClientSet = clientSet - serverVersion, err := client.ClientSet.ServerVersion() - if err != nil { - log.Fatal("Error fetching server version: ", err) - } - log.Printf("API endpoint : %s", config.Host) - log.Printf("Server version : %#v", *serverVersion) - log.Printf("Running tests : '%s'", cfg.Focus) - if cfg.Skip != "" { - log.Printf("Skipping tests : '%s'", cfg.Skip) - } - log.Printf("Using conformance image : '%s'", cfg.ConformanceImage) - log.Printf("Using busybox image : '%s'", cfg.BusyboxImage) - log.Printf("Test framework will start '%d' threads and use verbosity '%d'", - cfg.Parallel, cfg.Verbosity) - - if _, err := os.Stat(cfg.OutputDir); os.IsNotExist(err) { - if err = os.MkdirAll(cfg.OutputDir, 0755); err != nil { - log.Fatalf("Error creating output directory [%s] : %v", cfg.OutputDir, err) - } - } + common.ValidateArgs(err, client, config, cfg) service.RunE2E(client.ClientSet, cfg) client.PrintE2ELogs() client.FetchFiles(config, clientSet, cfg.OutputDir) service.Cleanup(client.ClientSet) + log.Println("Exiting with code: ", client.ExitCode) os.Exit(client.ExitCode) } diff --git a/pkg/common/args.go b/pkg/common/args.go index ac3dbcc..0960cdc 100644 --- a/pkg/common/args.go +++ b/pkg/common/args.go @@ -19,6 +19,9 @@ package common import ( "flag" "fmt" + "github.com/dims/hydrophone/pkg/client" + "k8s.io/client-go/rest" + "log" "os" ) @@ -79,3 +82,26 @@ func InitArgs() (*ArgConfig, error) { return &cfg, nil } + +func ValidateArgs(err error, client *client.Client, config *rest.Config, cfg *ArgConfig) { + serverVersion, err := client.ClientSet.ServerVersion() + if err != nil { + log.Fatal("Error fetching server version: ", err) + } + log.Printf("API endpoint : %s", config.Host) + log.Printf("Server version : %#v", *serverVersion) + log.Printf("Running tests : '%s'", cfg.Focus) + if cfg.Skip != "" { + log.Printf("Skipping tests : '%s'", cfg.Skip) + } + log.Printf("Using conformance image : '%s'", cfg.ConformanceImage) + log.Printf("Using busybox image : '%s'", cfg.BusyboxImage) + log.Printf("Test framework will start '%d' threads and use verbosity '%d'", + cfg.Parallel, cfg.Verbosity) + + if _, err := os.Stat(cfg.OutputDir); os.IsNotExist(err) { + if err = os.MkdirAll(cfg.OutputDir, 0755); err != nil { + log.Fatalf("Error creating output directory [%s] : %v", cfg.OutputDir, err) + } + } +} diff --git a/pkg/common/const.go b/pkg/common/const.go index 44000b8..bc45930 100644 --- a/pkg/common/const.go +++ b/pkg/common/const.go @@ -26,4 +26,5 @@ const ( ServiceAccountName = "conformance-serviceaccount" ConformanceContainer = "conformance-container" OutputContainer = "output-container" + conformanceTest = "\\[Conformance\\]" ) From 2443b2a3eab15839a8942a4d7cdbc7a8792c0dde Mon Sep 17 00:00:00 2001 From: Davanum Srinivas Date: Thu, 21 Dec 2023 21:30:33 -0500 Subject: [PATCH 3/4] support for a first class parameter for conformance tests Signed-off-by: Davanum Srinivas --- .github/workflows/periodic_e2e.yml | 2 +- README.md | 2 ++ main.go | 2 +- pkg/common/args.go | 22 ++++++++++++++++------ 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/.github/workflows/periodic_e2e.yml b/.github/workflows/periodic_e2e.yml index 9c92a6c..9e1552f 100644 --- a/.github/workflows/periodic_e2e.yml +++ b/.github/workflows/periodic_e2e.yml @@ -49,4 +49,4 @@ jobs: - name: Run full conformance test run: | - bin/hydrophone --focus "\[Conformance\]" + bin/hydrophone --conformance diff --git a/README.md b/README.md index 66deda5..9e3e265 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,8 @@ $ bin/hydrophone --help Usage of bin/hydrophone: -busybox-image string image let's you select an alternate busybox container image. (default "registry.k8s.io/e2e-test-images/busybox:1.36.1-1") + -conformance + run conformance tests. -conformance-image string image let's you select your conformance container image of your choice. (default "registry.k8s.io/conformance:v1.28.0") -focus string diff --git a/main.go b/main.go index 047ca2c..18727d2 100644 --- a/main.go +++ b/main.go @@ -36,7 +36,7 @@ func main() { config, clientSet := service.Init(cfg) client.ClientSet = clientSet - common.ValidateArgs(err, client, config, cfg) + common.ValidateArgs(client.ClientSet, config, cfg) service.RunE2E(client.ClientSet, cfg) client.PrintE2ELogs() diff --git a/pkg/common/args.go b/pkg/common/args.go index 0960cdc..fcf48c6 100644 --- a/pkg/common/args.go +++ b/pkg/common/args.go @@ -19,10 +19,11 @@ package common import ( "flag" "fmt" - "github.com/dims/hydrophone/pkg/client" - "k8s.io/client-go/rest" "log" "os" + + "k8s.io/client-go/kubernetes" + "k8s.io/client-go/rest" ) // ArgConfig stores the argument passed when running the program @@ -53,6 +54,9 @@ type ArgConfig struct { // OutputDir is where the e2e.log and junit_01.xml is saved OutputDir string + + // Conformance to indicate whether we want to run conformance tests + ConformanceTests bool } func InitArgs() (*ArgConfig, error) { @@ -73,21 +77,27 @@ func InitArgs() (*ArgConfig, error) { flag.IntVar(&cfg.Parallel, "parallel", 1, "number of parallel threads in test framework.") flag.IntVar(&cfg.Verbosity, "verbosity", 4, "verbosity of test framework.") flag.StringVar(&cfg.OutputDir, "output-dir", outputDir, "directory for logs.") + flag.BoolVar(&cfg.ConformanceTests, "conformance", false, "run conformance tests.") flag.Parse() - if cfg.Focus == "" { - return nil, fmt.Errorf("missing --focus argument (use '[Conformance]' to run all conformance tests)") + if cfg.ConformanceTests == (cfg.Focus != "") { + return nil, fmt.Errorf("specify either --conformance or --focus arguments, not both") } return &cfg, nil } -func ValidateArgs(err error, client *client.Client, config *rest.Config, cfg *ArgConfig) { - serverVersion, err := client.ClientSet.ServerVersion() +func ValidateArgs(clientSet *kubernetes.Clientset, config *rest.Config, cfg *ArgConfig) { + serverVersion, err := clientSet.ServerVersion() if err != nil { log.Fatal("Error fetching server version: ", err) } + + if cfg.ConformanceTests { + cfg.Focus = "\\[Conformance\\]" + } + log.Printf("API endpoint : %s", config.Host) log.Printf("Server version : %#v", *serverVersion) log.Printf("Running tests : '%s'", cfg.Focus) From c66239568dca8e4e707e5a401f20b8d1a1dd81c0 Mon Sep 17 00:00:00 2001 From: Davanum Srinivas Date: Thu, 21 Dec 2023 21:37:28 -0500 Subject: [PATCH 4/4] fix imports Signed-off-by: Davanum Srinivas --- main.go | 2 +- pkg/client/check.go | 3 ++- pkg/client/client.go | 5 +++-- pkg/client/download.go | 3 ++- pkg/client/pod_log.go | 3 ++- pkg/common/const.go | 1 - pkg/service/init.go | 5 +++-- 7 files changed, 13 insertions(+), 9 deletions(-) diff --git a/main.go b/main.go index 18727d2..6343883 100644 --- a/main.go +++ b/main.go @@ -17,11 +17,11 @@ limitations under the License. package main import ( - "github.com/dims/hydrophone/pkg/common" "log" "os" "github.com/dims/hydrophone/pkg/client" + "github.com/dims/hydrophone/pkg/common" "github.com/dims/hydrophone/pkg/service" ) diff --git a/pkg/client/check.go b/pkg/client/check.go index a5e0ddd..6f5274f 100644 --- a/pkg/client/check.go +++ b/pkg/client/check.go @@ -19,7 +19,6 @@ package client import ( "context" "fmt" - "github.com/dims/hydrophone/pkg/common" "log" "time" @@ -28,6 +27,8 @@ import ( "k8s.io/apimachinery/pkg/util/wait" "k8s.io/client-go/informers" "k8s.io/client-go/tools/cache" + + "github.com/dims/hydrophone/pkg/common" ) // Contains all the necessary channels to transfer data diff --git a/pkg/client/client.go b/pkg/client/client.go index 6a81138..f6639fd 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -18,13 +18,14 @@ package client import ( "context" - "github.com/dims/hydrophone/pkg/common" - "k8s.io/client-go/rest" "log" "os" "path/filepath" "k8s.io/client-go/kubernetes" + "k8s.io/client-go/rest" + + "github.com/dims/hydrophone/pkg/common" ) var ( diff --git a/pkg/client/download.go b/pkg/client/download.go index 88e2bcc..36b776d 100644 --- a/pkg/client/download.go +++ b/pkg/client/download.go @@ -18,7 +18,6 @@ package client import ( "context" - "github.com/dims/hydrophone/pkg/common" "io" corev1 "k8s.io/api/core/v1" @@ -26,6 +25,8 @@ import ( "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" "k8s.io/client-go/tools/remotecommand" + + "github.com/dims/hydrophone/pkg/common" ) func downloadFile(config *rest.Config, clientset *kubernetes.Clientset, diff --git a/pkg/client/pod_log.go b/pkg/client/pod_log.go index 1a5d565..5a711c5 100644 --- a/pkg/client/pod_log.go +++ b/pkg/client/pod_log.go @@ -18,10 +18,11 @@ package client import ( "bufio" - "github.com/dims/hydrophone/pkg/common" v1 "k8s.io/api/core/v1" "k8s.io/client-go/kubernetes" + + "github.com/dims/hydrophone/pkg/common" ) // List pod resource with the given namespace diff --git a/pkg/common/const.go b/pkg/common/const.go index bc45930..44000b8 100644 --- a/pkg/common/const.go +++ b/pkg/common/const.go @@ -26,5 +26,4 @@ const ( ServiceAccountName = "conformance-serviceaccount" ConformanceContainer = "conformance-container" OutputContainer = "output-container" - conformanceTest = "\\[Conformance\\]" ) diff --git a/pkg/service/init.go b/pkg/service/init.go index 9613227..a100962 100644 --- a/pkg/service/init.go +++ b/pkg/service/init.go @@ -19,7 +19,6 @@ package service import ( "context" "fmt" - "github.com/dims/hydrophone/pkg/common" "log" "os" "path/filepath" @@ -32,13 +31,15 @@ import ( "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" "k8s.io/client-go/tools/clientcmd" + + "github.com/dims/hydrophone/pkg/common" ) var ( ctx = context.Background() ) -// Initializes the kube config clientset +// Init Initializes the kube config clientset func Init(cfg *common.ArgConfig) (*rest.Config, *kubernetes.Clientset) { config, err := rest.InClusterConfig() if err != nil {