-
Notifications
You must be signed in to change notification settings - Fork 1k
Add k8s join and disjoin test cases #16141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
wangxin
merged 11 commits into
sonic-net:master
from
lixiaoyuner:dev/yunli1/add-k8s-join-disjoin-testcase
Dec 30, 2024
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
429483a
Add k8s join and disjoin test cases
lixiaoyuner aca9431
Fix the code check comment
lixiaoyuner ff1d0e5
Fix the code check reported issue
lixiaoyuner 91f4124
Improve the test case and add doc
lixiaoyuner a4962d6
Merge branch 'master' into dev/yunli1/add-k8s-join-disjoin-testcase
lixiaoyuner 9afe27b
Fix pre-commit checker comments
lixiaoyuner 9fb97f8
Refine the doc
lixiaoyuner 17d6a43
Fix typo
lixiaoyuner aff1ef9
Fix comments
lixiaoyuner 320c14c
Fix the timeout parameter
lixiaoyuner d0b2c0d
Ignore error for ctrmgrd status
lixiaoyuner File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,104 @@ | ||
| # KubeSonic Test Plan | ||
|
|
||
| ## Rev 0.1 | ||
|
|
||
| - [Revision](#revision) | ||
| - [Overview](#overview) | ||
| - [Scope](#scope) | ||
| - [Testbed](#testbed) | ||
| - [k8s version](#k8s-version) | ||
| - [Supported hwsku](#supported-hwsku) | ||
| - [Topology](#topology) | ||
| - [Test SONIC DUT join and disjoin from k8s cluster](#test-sonic-dut-join-and-disjoin-from-k8s-cluster) | ||
| - [Pre-requisite steps](#pre-requisite-steps) | ||
| - [Install Minikube and start Minikube](#install-minikube-and-start-minikube) | ||
| - [Update the server kernel parameter](#update-the-server-kernel-parameter) | ||
| - [Update the kubelet configmap](#update-the-kubelet-configmap) | ||
| - [Deploy the daemonset](#deploy-the-daemonset) | ||
| - [Prepare the cert](#prepare-the-cert) | ||
| - [Prepare Minikube VIP DNS](#prepare-minikube-vip-dns) | ||
| - [[Case-1] Join the SONIC DUT to the Minikube cluster and check](#case-1-join-the-sonic-dut-to-the-minikube-cluster-and-check) | ||
| - [[Case-2] Deploy daemonset pod on the SONIC DUT and check](#case-2-deploy-daemonset-pod-on-the-sonic-dut-and-check) | ||
| - [[Case-3] Remove daemonset pod from the SONIC DUT and check](#case-3-remove-daemonset-pod-from-the-sonic-dut-and-check) | ||
| - [[Case-4] Disjoin the SONIC DUT from the Minikube cluster and check](#case-4-disjoin-the-sonic-dut-from-the-minikube-cluster-and-check) | ||
| - [Teardown](#teardown) | ||
| - [Clean up](#clean-up) | ||
| - [Keep the Minikube cluster running](#keep-the-minikube-cluster-running) | ||
| - [File Lock to avoid Minikube cluster setup conflict](#file-lock-to-avoid-minikube-cluster-setup-conflict) | ||
|
|
||
|
|
||
| ## Revision | ||
|
|
||
| | Rev | Date | Author | Change Description | | ||
| |:---:|:-----------:|:---------------------:|:----------------------------------:| | ||
| | 0.1 | 12/25/2024 | Yun | Initial version | | ||
|
|
||
| ## Overview | ||
|
|
||
| The purpose is to test the functionality of k8s feature on the SONIC DUT. The tests expect that SONIC can join a k8s cluster and k8s daemonset pod can run on SONIC. | ||
|
|
||
| ## Scope | ||
|
|
||
| ### Testbed | ||
|
|
||
| The test is able to run on SONIC KVM testbed and SONIC DUT testbed | ||
|
|
||
| ### K8s version | ||
|
|
||
| This case only runs for k8s v1.22.2 | ||
|
|
||
| ### Supported hwsku | ||
|
|
||
| Arista-7060CX/Arista-7050QX/Arista-7050-Q16S64/Celestica-E1031-T48S4 is not supported, other hwskus should be supported | ||
|
|
||
| ## Topology | ||
|
|
||
| Supported any topology | ||
|
|
||
| ## Test SONIC DUT join and disjoin from k8s cluster | ||
|
|
||
| ### Pre-requisite steps | ||
|
|
||
| Use Minikube to startup a single master k8s cluster on the server where the ptf container and simulating neighbor containers are running on in the testbed. | ||
|
|
||
| #### Install Minikube and start Minikube | ||
| - Install Minikube and start Minikube on the server of the testbed by following the instructions in the [Minikube installation guide](https://minikube.sigs.k8s.io/docs/start/). | ||
|
|
||
| #### Update the server kernel parameter | ||
| - Update the server kernel parameter by running the following command ```sysctl fs.protected_regular=0```. [Check the issue here](https://github.com/kubernetes/minikube/issues/7053) | ||
|
|
||
| #### Update the kubelet configmap | ||
| - The Minikube cluster's pki cert root directory is `/var/lib/minikube/certs`, SONIC DUT's kubelet is using `/etc/kubernetes/pki` as the pki cert root directory. So need to update the kubelet configmap. | ||
|
|
||
| #### Deploy the daemonset | ||
| - Deploy the daemonset with nodeSelector `deployDaemonset=true` so that we can control whether the daemonset pod runs on the SONIC DUT by labeling node and unlabeling node. | ||
|
|
||
| #### Prepare the cert | ||
| - SONIC DUT will need a cert to join the k8s cluster, so need to prepare the cert for it. Copy the cert from the Minikube cluster to the SONIC DUT. | ||
|
|
||
| #### Prepare Minikube VIP DNS | ||
| - Minikube cluster's VIP is ```control-plane.minikube.internal```, SONIC DUT will not resolve this VIP by default, so need to add the VIP to the SONIC DUT's `/etc/hosts` file. | ||
|
|
||
| ### [Case-1] Join the SONIC DUT to the Minikube cluster and check | ||
|
|
||
| - ```sudo config kube server ip <server_ip> && sudo config kube server disable off``` to trigger the SONIC DUT to join the k8s cluster, check if the SONIC DUT is in the k8s cluster by running `kubectl get nodes` on the server. | ||
|
|
||
| ### [Case-2] Deploy daemonset pod on the SONIC DUT and check | ||
| - ```kubectl label node <node_name> deployDaemonset=true``` to control the k8s daemonset pod to run on the SONIC DUT, check if the pod is running on the SONIC DUT by running `kubectl get pods` on the server. | ||
|
|
||
| ### [Case-3] Remove daemonset pod from the SONIC DUT and check | ||
| - ```kubectl label node <node_name> deployDaemonset-``` to prevent the k8s daemonset pod from running on the SONIC DUT, check if the pod is removed from the SONIC DUT by running `kubectl get pods` on the server. | ||
|
|
||
| ### [Case-4] Disjoin the SONIC DUT from the Minikube cluster and check | ||
| - ```sudo config kube server disable on``` to trigger the SONIC DUT to disjoin the k8s cluster, check if the SONIC DUT is not in the k8s cluster by running `kubectl get nodes` on the server. | ||
|
|
||
| ### Teardown | ||
|
|
||
| #### Clean up | ||
| - Remove the Minikube cluster and restore all changes on the server of the testbed and the SONIC DUT. | ||
|
|
||
| #### Keep the Minikube cluster running | ||
| - If the server of testbed is shared with other tests, need keep the Minikube cluster running to avoid conflict. | ||
|
|
||
| ### File Lock to avoid Minikube cluster setup conflict | ||
| - When the server is shared with other testbed, need to lock the server when setup the Minikube cluster to avoid conflict, otherwise, two test plans may create the Minikube cluster on the same server at the same time which is not expected. When one test plan is creating the Minikube cluster, another test plan just need to wait and directly use the Minikube cluster after it's ready. In the setup step, require a file lock to setup the Minikube cluster, after the Minikube cluster is setup, release the file lock. When the test case trys to setup the Minikube cluster, check if the file lock is acquired. If yes, wait until the file lock is released. If the wait time is longer than max wait time, re-acquire the file lock and setup the Minikube cluster again. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Arista-7050-QX32/Arista-720DT-G48S4/Nexus-3132-GX-Q32 should be using slim image as well, right? is there any more generic way to figure out if the test is invoked against a slim images?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got this sku list from the firmware file, the sku are configured slim image certainly. For these 3 you mentioned, Arista-720DT-G48S4 is not using slim image. Arista-7050-QX32/Nexus-3132-GX-Q32 run old sonic versions, and I don't see any nightly test for this sku.