diff --git a/test/integration/controller_test.go b/test/integration/controller_test.go index ae93f2a1d7..d18d37b485 100644 --- a/test/integration/controller_test.go +++ b/test/integration/controller_test.go @@ -28,9 +28,6 @@ func TestHealthEndpoint(t *testing.T) { } func TestMetricsEndpoint(t *testing.T) { - if useLegacyKIC() { - t.Skip("metrics endpoint test does not apply to legacy KIC") - } assert.Eventually(t, func() bool { metricsURL := fmt.Sprintf("http://localhost:%v/metrics", manager.MetricsPort) resp, err := httpc.Get(metricsURL) @@ -58,9 +55,6 @@ func TestMetricsEndpoint(t *testing.T) { } func TestProfilingEndpoint(t *testing.T) { - if useLegacyKIC() { - t.Skip("profiling endpoint behaves differently in legacy KIC") - } assert.Eventually(t, func() bool { profilingURL := fmt.Sprintf("http://localhost:%v/debug/pprof/", manager.DiagnosticsPort) resp, err := httpc.Get(profilingURL) @@ -74,9 +68,6 @@ func TestProfilingEndpoint(t *testing.T) { } func TestConfigEndpoint(t *testing.T) { - if useLegacyKIC() { - t.Skip("config endpoint not available in legacy KIC") - } assert.Eventually(t, func() bool { successURL := fmt.Sprintf("http://localhost:%v/debug/config/successful", manager.DiagnosticsPort) failURL := fmt.Sprintf("http://localhost:%v/debug/config/failed", manager.DiagnosticsPort) diff --git a/test/integration/ingress_test.go b/test/integration/ingress_test.go index 854c1fbc1d..32ad783a60 100644 --- a/test/integration/ingress_test.go +++ b/test/integration/ingress_test.go @@ -308,9 +308,6 @@ func TestIngressClassNameSpec(t *testing.T) { } func TestIngressNamespaces(t *testing.T) { - if useLegacyKIC() { - t.Skip("support for distinct namespace watches is not supported in legacy KIC") - } ctx := context.Background() // ensure the alternative namespace is created diff --git a/test/integration/knative_test.go b/test/integration/knative_test.go index dca505500b..cdd81cd446 100644 --- a/test/integration/knative_test.go +++ b/test/integration/knative_test.go @@ -33,10 +33,6 @@ const ( ) func TestKnativeIngress(t *testing.T) { - if useLegacyKIC() { - t.Skip("knative is supported in KIC 1.3.x and skip in legacy KIC") - } - cluster := env.Cluster() proxy := proxyURL.Hostname() assert.NotEmpty(t, proxy) diff --git a/test/integration/suite_test.go b/test/integration/suite_test.go index 08c7d15ef7..a19d732abd 100644 --- a/test/integration/suite_test.go +++ b/test/integration/suite_test.go @@ -6,7 +6,6 @@ import ( "bytes" "context" "fmt" - "io" "io/ioutil" "net/http" "net/url" @@ -63,9 +62,6 @@ const ( // ----------------------------------------------------------------------------- var ( - // LegacyControllerEnvVar indicates the environment variable which can be used to trigger tests against the legacy KIC controller-manager - LegacyControllerEnvVar = "KONG_LEGACY_CONTROLLER" - // httpc is the default HTTP client to use for tests httpc = http.Client{Timeout: httpcTimeout} @@ -223,14 +219,6 @@ func TestMain(m *testing.M) { os.Exit(code) } -// ----------------------------------------------------------------------------- -// Testing Helper Functions -// ----------------------------------------------------------------------------- - -func useLegacyKIC() bool { - return os.Getenv(LegacyControllerEnvVar) != "" -} - // ----------------------------------------------------------------------------- // Testing Main - Controller Deployment // ----------------------------------------------------------------------------- @@ -245,7 +233,7 @@ var crds = []string{ knativeCrds, } -// deployControllers ensures that relevant CRDs and controllers are deployed to the test cluster and supports legacy (KIC 1.x) clusters as well. +// deployControllers ensures that relevant CRDs and controllers are deployed to the test cluster func deployControllers(ctx context.Context, namespace string) error { // ensure the controller namespace is created ns := &corev1.Namespace{ObjectMeta: metav1.ObjectMeta{Name: namespace}} @@ -285,86 +273,42 @@ func deployControllers(ctx context.Context, namespace string) error { } } - // if set, allow running the legacy controller for the tests instead of the current controller - var cmd *exec.Cmd - if useLegacyKIC() { - cmd = buildLegacyCommand(ctx, kubeconfig.Name()) - stdout, stderr := new(bytes.Buffer), new(bytes.Buffer) - cmd.Stdout = io.MultiWriter(stdout, os.Stdout) - cmd.Stderr = io.MultiWriter(stderr, os.Stderr) - if err := cmd.Run(); err != nil { - fmt.Fprintln(os.Stdout, stdout.String()) - panic(fmt.Errorf("%s: %w", stderr.String(), err)) - } - } else { - config := manager.Config{} - flags := config.FlagSet() - if err := flags.Parse([]string{ - fmt.Sprintf("--kong-admin-url=http://%s:8001", proxyAdminURL.Hostname()), - fmt.Sprintf("--kubeconfig=%s", kubeconfig.Name()), - "--controller-kongstate=enabled", - "--controller-ingress-networkingv1=enabled", - "--controller-ingress-networkingv1beta1=enabled", - "--controller-ingress-extensionsv1beta1=enabled", - "--controller-tcpingress=enabled", - "--controller-kongingress=enabled", - "--controller-knativeingress=enabled", - "--controller-kongclusterplugin=enabled", - "--controller-kongplugin=enabled", - "--controller-kongconsumer=disabled", - "--dump-config", - "--election-id=integrationtests.konghq.com", - "--publish-service=kong-system/ingress-controller-kong-proxy", - fmt.Sprintf("--watch-namespace=%s", watchNamespaces), - fmt.Sprintf("--ingress-class=%s", ingressClass), - "--log-level=trace", - "--log-format=text", - "--debug-log-reduce-redundancy", - "--admission-webhook-listen=172.17.0.1:49023", - fmt.Sprintf("--admission-webhook-cert=%s", admissionWebhookCert), - fmt.Sprintf("--admission-webhook-key=%s", admissionWebhookKey), - "--profiling", - }); err != nil { - panic(fmt.Errorf("could not parse controller manager flags: %w", err)) - } - fmt.Fprintf(os.Stderr, "config: %+v\n", config) + config := manager.Config{} + flags := config.FlagSet() + if err := flags.Parse([]string{ + fmt.Sprintf("--kong-admin-url=http://%s:8001", proxyAdminURL.Hostname()), + fmt.Sprintf("--kubeconfig=%s", kubeconfig.Name()), + "--controller-kongstate=enabled", + "--controller-ingress-networkingv1=enabled", + "--controller-ingress-networkingv1beta1=enabled", + "--controller-ingress-extensionsv1beta1=enabled", + "--controller-tcpingress=enabled", + "--controller-kongingress=enabled", + "--controller-knativeingress=enabled", + "--controller-kongclusterplugin=enabled", + "--controller-kongplugin=enabled", + "--controller-kongconsumer=disabled", + "--dump-config", + "--election-id=integrationtests.konghq.com", + "--publish-service=kong-system/ingress-controller-kong-proxy", + fmt.Sprintf("--watch-namespace=%s", watchNamespaces), + fmt.Sprintf("--ingress-class=%s", ingressClass), + "--log-level=trace", + "--log-format=text", + "--debug-log-reduce-redundancy", + "--admission-webhook-listen=172.17.0.1:49023", + fmt.Sprintf("--admission-webhook-cert=%s", admissionWebhookCert), + fmt.Sprintf("--admission-webhook-key=%s", admissionWebhookKey), + "--profiling", + }); err != nil { + panic(fmt.Errorf("could not parse controller manager flags: %w", err)) + } + fmt.Fprintf(os.Stderr, "config: %+v\n", config) - if err := rootcmd.Run(ctx, &config); err != nil { - panic(fmt.Errorf("controller manager exited with error: %w", err)) - } + if err := rootcmd.Run(ctx, &config); err != nil { + panic(fmt.Errorf("controller manager exited with error: %w", err)) } }() return nil } - -func buildLegacyCommand(ctx context.Context, kubeconfigPath string) *exec.Cmd { - fmt.Fprintln(os.Stderr, "WARNING: deploying legacy Kong Kubernetes Ingress Controller (KIC)") - - // get the proxy pod - podList, err := env.Cluster().Client().CoreV1().Pods("kong-system").List(ctx, metav1.ListOptions{ - LabelSelector: "app.kubernetes.io/component=app,app.kubernetes.io/instance=ingress-controller,app.kubernetes.io/name=kong", - }) - if err != nil { - panic(err) - } - if len(podList.Items) != 1 { - panic(fmt.Errorf("expected 1 result, found %d", len(podList.Items))) - } - proxyPod := podList.Items[0].Name - - // custom command for the legacy controller as there are several differences in flags. - cmd := exec.CommandContext(ctx, "go", "run", "../../../cli/ingress-controller/", - "--publish-service", "kong-system/ingress-controller-kong-proxy", - "--kubeconfig", kubeconfigPath, - "--kong-admin-url", fmt.Sprintf("http://%s:8001", proxyAdminURL.Hostname()), - "--ingress-class", ingressClass) - - // set the environment according to the legacy controller's needs - cmd.Env = append(os.Environ(), - "POD_NAMESPACE=kong-system", - fmt.Sprintf("POD_NAME=%s", proxyPod), - ) - - return cmd -} diff --git a/test/integration/udpingress_test.go b/test/integration/udpingress_test.go index 67823d17b7..2176d24c95 100644 --- a/test/integration/udpingress_test.go +++ b/test/integration/udpingress_test.go @@ -26,11 +26,6 @@ import ( const testUDPIngressNamespace = "udpingress" func TestUDPIngressEssentials(t *testing.T) { - // TODO: once KIC 2.0 lands and pre v2 is gone, we can remove this check - if useLegacyKIC() { - t.Skip("legacy KIC does not support UDPIngress, skipping") - } - testName := "minudp" ctx, cancel := context.WithTimeout(context.Background(), ingressWait) defer cancel() diff --git a/test/integration/webhook_test.go b/test/integration/webhook_test.go index d34cf52cc7..e20d87e2b1 100644 --- a/test/integration/webhook_test.go +++ b/test/integration/webhook_test.go @@ -20,9 +20,6 @@ import ( const defaultNs = "default" func TestValidationWebhook(t *testing.T) { - if useLegacyKIC() { - t.Skip("not testing validation webhook for KIC 1.x") - } ctx := context.Background() const webhookSvcName = "validations"