diff --git a/.github/in-cluster-test-scripts/gke.sh b/.github/in-cluster-test-scripts/gke.sh index 8bde50ca60..5b51694217 100644 --- a/.github/in-cluster-test-scripts/gke.sh +++ b/.github/in-cluster-test-scripts/gke.sh @@ -25,7 +25,7 @@ sleep 10s [[ $(pgrep -f "cilium.*hubble.*port-forward|kubectl.*port-forward.*hubble-relay" | wc -l) == 2 ]] # Run connectivity test -cilium connectivity test --debug --all-flows --collect-sysdump-on-failure --external-target google.com. +cilium connectivity test --test-concurrency=5 --debug --all-flows --collect-sysdump-on-failure --external-target google.com. # Run performance test cilium connectivity perf --duration 1s diff --git a/.github/workflows/gke.yaml b/.github/workflows/gke.yaml index 4982f52a96..a8c2ea6cce 100644 --- a/.github/workflows/gke.yaml +++ b/.github/workflows/gke.yaml @@ -14,9 +14,9 @@ on: # will disappear from the PR checks: please provide a direct link to the # successful workflow run (can be found from Actions tab) in a comment. # - # pull_request: {} + pull_request: {} ### - pull_request_target: {} + # pull_request_target: {} # Run every 6 hours schedule: - cron: '0 2/6 * * *' diff --git a/cli/connectivity.go b/cli/connectivity.go index ba0ff55139..808f2791f4 100644 --- a/cli/connectivity.go +++ b/cli/connectivity.go @@ -125,7 +125,7 @@ func newCmdConnectivityTest(hooks api.Hooks) *cobra.Command { cmd.Flags().BoolVarP(¶ms.Timestamp, "timestamp", "t", false, "Show timestamp in messages") cmd.Flags().BoolVarP(¶ms.PauseOnFail, "pause-on-fail", "p", false, "Pause execution on test failure") cmd.Flags().StringVar(¶ms.ExternalTarget, "external-target", "one.one.one.one.", "Domain name to use as external target in connectivity tests") - cmd.Flags().StringVar(¶ms.ExternalTargetCANamespace, "external-target-ca-namespace", defaults.ConnectivityCheckNamespace, "Namespace of the CA secret for the external target. Used by client-egress-l7-tls test cases.") + cmd.Flags().StringVar(¶ms.ExternalTargetCANamespace, "external-target-ca-namespace", "", "Namespace of the CA secret for the external target. Used by client-egress-l7-tls test cases.") cmd.Flags().StringVar(¶ms.ExternalTargetCAName, "external-target-ca-name", "cabundle", "Name of the CA secret for the external target. Used by client-egress-l7-tls test cases.") cmd.Flags().StringVar(¶ms.ExternalCIDR, "external-cidr", "1.0.0.0/8", "CIDR to use as external target in connectivity tests") cmd.Flags().StringVar(¶ms.ExternalIP, "external-ip", "1.1.1.1", "IP to use as external target in connectivity tests") @@ -228,6 +228,9 @@ func newConnectivityTests(params check.Parameters, logger *check.ConcurrentLogge params.TestConcurrency = 1 } if params.TestConcurrency < 2 { + if params.ExternalTargetCANamespace == "" { + params.ExternalTargetCANamespace = defaults.ConnectivityCheckNamespace + } cc, err := check.NewConnectivityTest(k8sClient, params, defaults.CLIVersion, logger) if err != nil { return nil, err @@ -238,9 +241,10 @@ func newConnectivityTests(params check.Parameters, logger *check.ConcurrentLogge connTests := make([]*check.ConnectivityTest, 0, params.TestConcurrency) for i := 0; i < params.TestConcurrency; i++ { params := params - ns := fmt.Sprintf("%s-%d", params.TestNamespace, i+1) - params.TestNamespace = ns - params.ExternalTargetCANamespace = ns + params.TestNamespace = fmt.Sprintf("%s-%d", params.TestNamespace, i+1) + if params.ExternalTargetCANamespace == "" { + params.ExternalTargetCANamespace = params.TestNamespace + } params.ExternalDeploymentPort += i params.EchoServerHostPort += i params.JunitFile = junit.NamespacedFileName(params.TestNamespace, params.JunitFile) diff --git a/cli/connectivity_test.go b/cli/connectivity_test.go index 532dfed967..2788abbe7c 100644 --- a/cli/connectivity_test.go +++ b/cli/connectivity_test.go @@ -14,18 +14,30 @@ import ( func TestNewConnectivityTests(t *testing.T) { testCases := []struct { - params check.Parameters - expectedCount int - expectedTestNamespaces []string + params check.Parameters + expectedCount int + expectedTestNamespaces []string + expectedExternalTargetCANamespace []string }{ + { + params: check.Parameters{ + FlowValidation: check.FlowValidationModeDisabled, + TestNamespace: "cilium-test", + ExternalTargetCANamespace: "", + }, + expectedCount: 1, + expectedTestNamespaces: []string{"cilium-test"}, + expectedExternalTargetCANamespace: []string{"cilium-test"}, + }, { params: check.Parameters{ FlowValidation: check.FlowValidationModeDisabled, TestNamespace: "cilium-test", ExternalTargetCANamespace: "cilium-test", }, - expectedCount: 1, - expectedTestNamespaces: []string{"cilium-test"}, + expectedCount: 1, + expectedTestNamespaces: []string{"cilium-test"}, + expectedExternalTargetCANamespace: []string{"cilium-test"}, }, { params: check.Parameters{ @@ -34,8 +46,20 @@ func TestNewConnectivityTests(t *testing.T) { ExternalTargetCANamespace: "cilium-test", TestConcurrency: -1, }, - expectedCount: 1, - expectedTestNamespaces: []string{"cilium-test"}, + expectedCount: 1, + expectedTestNamespaces: []string{"cilium-test"}, + expectedExternalTargetCANamespace: []string{"cilium-test"}, + }, + { + params: check.Parameters{ + FlowValidation: check.FlowValidationModeDisabled, + TestNamespace: "cilium-test", + ExternalTargetCANamespace: "", + TestConcurrency: 3, + }, + expectedCount: 3, + expectedTestNamespaces: []string{"cilium-test-1", "cilium-test-2", "cilium-test-3"}, + expectedExternalTargetCANamespace: []string{"cilium-test-1", "cilium-test-2", "cilium-test-3"}, }, { params: check.Parameters{ @@ -44,8 +68,9 @@ func TestNewConnectivityTests(t *testing.T) { ExternalTargetCANamespace: "cilium-test", TestConcurrency: 3, }, - expectedCount: 3, - expectedTestNamespaces: []string{"cilium-test-1", "cilium-test-2", "cilium-test-3"}, + expectedCount: 3, + expectedTestNamespaces: []string{"cilium-test-1", "cilium-test-2", "cilium-test-3"}, + expectedExternalTargetCANamespace: []string{"cilium-test"}, }, } for _, tt := range testCases { @@ -56,6 +81,8 @@ func TestNewConnectivityTests(t *testing.T) { require.Equal(t, tt.expectedCount, len(actual)) for i, n := range tt.expectedTestNamespaces { require.Equal(t, n, actual[i].Params().TestNamespace) + } + for i, n := range tt.expectedExternalTargetCANamespace { require.Equal(t, n, actual[i].Params().ExternalTargetCANamespace) } }