-
Notifications
You must be signed in to change notification settings - Fork 210
Commit
This adds endpointslice synchronization testing inside a clustermesh. It does that by checking that we can get a DNS answer with a global headless service with endpointslice synchronization enabled across two clusters. Testing it via DNS ensures that the created EndpointSlice are correctly linked to the headless service. Signed-off-by: Arthur Outhenin-Chalandre <[email protected]>
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// Copyright Authors of Cilium | ||
|
||
package builder | ||
|
||
import ( | ||
"github.com/cilium/cilium-cli/connectivity/check" | ||
"github.com/cilium/cilium-cli/connectivity/tests" | ||
"github.com/cilium/cilium-cli/utils/features" | ||
) | ||
|
||
type endpointSliceClusterMeshSync struct{} | ||
|
||
func (t endpointSliceClusterMeshSync) build(ct *check.ConnectivityTest, _ map[string]string) { | ||
newTest("endpointslice-clustermesh-sync", ct). | ||
WithFeatureRequirements(features.RequireEnabled(features.ClusterMeshEnableEndpointSync)). | ||
WithScenarios(tests.EndpointSliceClusterMeshSync()) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// Copyright Authors of Cilium | ||
|
||
package tests | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/cilium/cilium-cli/connectivity/check" | ||
"github.com/cilium/cilium-cli/utils/features" | ||
|
||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
func EndpointSliceClusterMeshSync() check.Scenario { | ||
return &endpointSliceClusterMeshSync{} | ||
Check failure on line 17 in connectivity/tests/endpointslice-clustermesh-sync.go GitHub Actions / Create Release (dry-run)
Check failure on line 17 in connectivity/tests/endpointslice-clustermesh-sync.go GitHub Actions / build
Check failure on line 17 in connectivity/tests/endpointslice-clustermesh-sync.go GitHub Actions / build
Check failure on line 17 in connectivity/tests/endpointslice-clustermesh-sync.go GitHub Actions / Kind Installation and Connectivity Test
Check failure on line 17 in connectivity/tests/endpointslice-clustermesh-sync.go GitHub Actions / Kind Helm Upgrade Clustermesh
|
||
} | ||
|
||
type endpointSliceClusterMeshSync struct{} | ||
|
||
func (s *endpointSliceClusterMeshSync) Name() string { | ||
return "endpointslice-clustermesh-sync" | ||
} | ||
|
||
func (s *endpointSliceMesh) Run(ctx context.Context, t *check.Test) { | ||
Check failure on line 26 in connectivity/tests/endpointslice-clustermesh-sync.go GitHub Actions / Create Release (dry-run)
Check failure on line 26 in connectivity/tests/endpointslice-clustermesh-sync.go GitHub Actions / build
Check failure on line 26 in connectivity/tests/endpointslice-clustermesh-sync.go GitHub Actions / build
Check failure on line 26 in connectivity/tests/endpointslice-clustermesh-sync.go GitHub Actions / Kind Installation and Connectivity Test
|
||
ct := t.Context() | ||
|
||
i := 0 | ||
for _, client := range ct.ClientPods() { | ||
client := client // copy to avoid memory aliasing when using reference | ||
|
||
kubeService, err := ct.K8sClient().GetService(ctx, ct.Params().TestNamespace, "echo-other-node-headless", metav1.GetOptions{}) | ||
if err != nil { | ||
t.Fatal("Cannot get echo-other-node-headless service") | ||
} | ||
service := check.Service{Service: kubeService} | ||
|
||
t.NewAction(s, fmt.Sprintf("dig-%d", i), &client, service, features.IPFamilyV4).Run(func(a *check.Action) { | ||
a.ExecInPod(ctx, ct.DigCommandService(service)) | ||
}) | ||
i++ | ||
} | ||
} |