-
Notifications
You must be signed in to change notification settings - Fork 113
Tests for containerstatus and livenssprobe #1347
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
Conversation
* Returns all pods in the given namespace with the given label. | ||
*/ | ||
func GetPodsWithLabel(clientset *kubernetes.Clientset, namespace string, labelKey string, labelValue string) ([]corev1.Pod, error) { | ||
podList, err := clientset.CoreV1().Pods(namespace).List(context.TODO(), metav1.ListOptions{ |
Check notice
Code scanning / devskim
A "TODO" or similar was left in source code, possibly indicating incomplete functionality
func CheckIfAllPodsScheduleOnNodes(clientset *kubernetes.Clientset, namespace, labelKey string, labelValue string, osLabel string) error { | ||
|
||
// Get list of all nodes | ||
nodes, err := clientset.CoreV1().Nodes().List(context.TODO(), metav1.ListOptions{}) |
Check notice
Code scanning / devskim
A "TODO" or similar was left in source code, possibly indicating incomplete functionality
for _, node := range nodes.Items { | ||
if node.Labels["beta.kubernetes.io/os"] == osLabel { | ||
// Get list of pods scheduled on this node | ||
pods, err := clientset.CoreV1().Pods(namespace).List(context.TODO(), metav1.ListOptions{ |
Check notice
Code scanning / devskim
A "TODO" or similar was left in source code, possibly indicating incomplete functionality
func CheckIfAllPodsScheduleOnSpecificNodesLabels(clientset *kubernetes.Clientset, namespace, labelKey string, labelValue string, nodeLabelKey string, nodeLabelValue string) error { | ||
|
||
// Get list of all nodes | ||
nodes, err := clientset.CoreV1().Nodes().List(context.TODO(), metav1.ListOptions{}) |
Check notice
Code scanning / devskim
A "TODO" or similar was left in source code, possibly indicating incomplete functionality
if value, ok := node.Labels[nodeLabelKey]; ok && value == nodeLabelValue { | ||
|
||
// Get list of pods scheduled on this node | ||
pods, err := clientset.CoreV1().Pods(namespace).List(context.TODO(), metav1.ListOptions{ |
Check notice
Code scanning / devskim
A "TODO" or similar was left in source code, possibly indicating incomplete functionality
This PR is stale because it has been open 7 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
This PR was closed because it has been stalled for 12 days with no activity. |
This PR is the part-1 of end-to-end test automation framework. In this PR, I have added tests for containerstatus and livenessprobe. The changes are similar to Prometheus tests.
ToDo:
Add tests for LAW queries.
Add a readme file.
Tests:
Tested the changes on the local cluster and ci-cd cluster with a test pipeline.