Skip to content

Commit

Permalink
clustermesh: setup fix and CI
Browse files Browse the repository at this point in the history
ClusterMesh connectivity tests setup fixed to support test-concurrency
param. Kind workflow (clustermesh part) updated with test-concurrency.

Signed-off-by: viktor-kurchenko <[email protected]>
  • Loading branch information
viktor-kurchenko authored and michi-covalent committed May 16, 2024
1 parent fd66a28 commit 1855f6c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
26 changes: 17 additions & 9 deletions .github/workflows/kind.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ jobs:
name: Kind Installation and Connectivity Test
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
include:
# run connectivity tests explicitly without concurrency
Expand Down Expand Up @@ -201,6 +200,13 @@ jobs:
helm-upgrade-clustermesh:
name: Kind Helm Upgrade Clustermesh
runs-on: ubuntu-22.04
strategy:
matrix:
include:
# run connectivity tests explicitly without concurrency
- test-concurrency: 1
# run connectivity tests concurrently
- test-concurrency: 5
timeout-minutes: 50

env:
Expand Down Expand Up @@ -326,19 +332,21 @@ jobs:
#
# Dispatch interval is set to 100ms, b/c otherwise (default is 0), the flow validation might time out.
cilium connectivity test --context $CLUSTER1 --multi-cluster $CLUSTER2 --debug \
--test-concurrency=${{ matrix.test-concurrency }} \
--conn-disrupt-dispatch-interval 100ms \
--include-conn-disrupt-test --conn-disrupt-test-setup
cilium connectivity test --context $CLUSTER1 --multi-cluster $CLUSTER2 --debug \
--test-concurrency=${{ matrix.test-concurrency }} \
--include-unsafe-tests --include-conn-disrupt-test \
--collect-sysdump-on-failure --junit-file cilium-junit-clustermesh-1.xml \
--collect-sysdump-on-failure --junit-file cilium-junit-clustermesh-1-concurrency-${{ matrix.test-concurrency }}.xml \
--junit-property mode=clustermesh --junit-property type=ipsec
- name: Upload JUnit
if: ${{ always() }}
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
name: cilium-junits-helm-upgrade-clustermesh
name: cilium-junits-helm-upgrade-clustermesh-concurrency-${{ matrix.test-concurrency }}
path: cilium-junit*.xml
retention-days: 2

Expand All @@ -347,24 +355,24 @@ jobs:
run: |
cilium --context $CLUSTER1 status
kubectl --context $CLUSTER1 get pods --all-namespaces -o wide
cilium --context $CLUSTER1 sysdump --output-filename cilium-sysdump-out-c1
cilium --context $CLUSTER1 sysdump --output-filename cilium-sysdump-out-c1-concurrency-${{ matrix.test-concurrency }}
cilium --context $CLUSTER2 status
kubectl --context $CLUSTER2 get pods --all-namespaces -o wide
cilium --context $CLUSTER2 sysdump --output-filename cilium-sysdump-out-c2
cilium --context $CLUSTER2 sysdump --output-filename cilium-sysdump-out-c2-concurrency-${{ matrix.test-concurrency }}
shell: bash {0} # Disable default fail-fast behaviour so that all commands run independently

- name: Upload sysdump from cluster 1
if: ${{ !success() }}
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
name: cilium-sysdump-out-c1.zip
path: cilium-sysdump-out-c1.zip
name: cilium-sysdump-out-c1-concurrency-${{ matrix.test-concurrency }}.zip
path: cilium-sysdump-out-c1-concurrency-${{ matrix.test-concurrency }}.zip
retention-days: 5

- name: Upload sysdump from cluster 2
if: ${{ !success() }}
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
name: cilium-sysdump-out-c2.zip
path: cilium-sysdump-out-c2.zip
name: cilium-sysdump-out-c2-concurrency-${{ matrix.test-concurrency }}.zip
path: cilium-sysdump-out-c2-concurrency-${{ matrix.test-concurrency }}.zip
retention-days: 5
6 changes: 6 additions & 0 deletions connectivity/check/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,10 @@ func (ct *ConnectivityTest) modifyStaticRoutesForNodesWithoutCilium(ctx context.
return nil
}

// multiClusterClientLock protects K8S client instantiation (Scheme registration)
// for the cluster mesh setup in case of connectivity test concurrency > 1
var multiClusterClientLock = sync.Mutex{}

// initClients checks if Cilium is installed on the cluster, whether the cluster
// has multiple nodes, and whether or not monitor aggregation is enabled.
// TODO(timo): Split this up, it does a lot.
Expand Down Expand Up @@ -833,6 +837,8 @@ func (ct *ConnectivityTest) initClients(ctx context.Context) error {
ct.params.SingleNode = true
}
} else if ct.params.MultiCluster != "" {
multiClusterClientLock.Lock()
defer multiClusterClientLock.Unlock()
dst, err := k8s.NewClient(ct.params.MultiCluster, "", ct.params.CiliumNamespace)
if err != nil {
return fmt.Errorf("unable to create Kubernetes client for remote cluster %q: %w", ct.params.MultiCluster, err)
Expand Down

0 comments on commit 1855f6c

Please sign in to comment.