-
Notifications
You must be signed in to change notification settings - Fork 210
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
connectivity: add endpointslice clustermesh sync test
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
1 parent
8b0f423
commit f825bf6
Showing
7 changed files
with
115 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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{} | ||
} | ||
|
||
type endpointSliceClusterMeshSync struct{} | ||
|
||
func (s *endpointSliceClusterMeshSync) Name() string { | ||
return "endpointslice-clustermesh-sync" | ||
} | ||
|
||
func (s *endpointSliceClusterMeshSync) Run(ctx context.Context, t *check.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++ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters