- [X] APISnoop org-flow : CoreV1Node.org
- [X] test approval issue : kubernetes/kubernetes#90348
- [ ] test pr : kuberenetes/kubernetes#?
- [ ] two weeks soak start date : testgrid-link
- [ ] two weeks soak end date :
- [ ] test promotion pr : kubernetes/kubernetes#?
According to this APIsnoop query, there are still some remaining Node endpoints which are untested.
SELECT
operation_id,
-- k8s_action,
-- path,
-- description,
kind
FROM untested_stable_core_endpoints
-- FROM untested_stable_endpoints
where path not like '%volume%'
and kind like 'Node'
-- and operation_id ilike '%%'
ORDER BY kind,operation_id desc
LIMIT 25
;
operation_id | kind
----------------------------+------
replaceCoreV1NodeStatus | Node
readCoreV1NodeStatus | Node
patchCoreV1NodeStatus | Node
deleteCoreV1Node | Node
deleteCoreV1CollectionNode | Node
createCoreV1Node | Node
(6 rows)
- Creating a Node
- Listing Node
- Find Node
- Deleting Node
package main
import (
// "encoding/json"
"fmt"
"flag"
"os"
v1 "k8s.io/api/core/v1"
// "k8s.io/client-go/dynamic"
// "k8s.io/apimachinery/pkg/runtime/schema"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
// "k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/tools/clientcmd"
)
func main() {
// uses the current context in kubeconfig
kubeconfig := flag.String("kubeconfig", fmt.Sprintf("%v/%v/%v", os.Getenv("HOME"), ".kube", "config"), "(optional) absolute path to the kubeconfig file")
flag.Parse()
config, err := clientcmd.BuildConfigFromFlags("", *kubeconfig)
if err != nil {
fmt.Println(err)
return
}
// make our work easier to find in the audit_event queries
config.UserAgent = "live-test-writing"
// creates the clientset
ClientSet, _ := kubernetes.NewForConfig(config)
// DynamicClientSet, _ := dynamic.NewForConfig(config)
// nodeResource := schema.GroupVersionResource{Group: "", Version: "v1", Resource: "nodes"}
// TEST BEGINS HERE
testNodeName := "test-node"
// testNodeImage := "nginx"
// testNamespaceName := "default"
fmt.Println("creating a Node")
testNode := v1.Node{
ObjectMeta: metav1.ObjectMeta{
Name: testNodeName,
Labels: map[string]string{"test-node-static": "true"},
},
// Spec: v1.NodeSpec{
// Containers: []v1.Container{{
// Name: testNodeName,
// Image: testNodeImage,
// }},
// },
}
_, err = ClientSet.CoreV1().Nodes().Create(&testNode)
if err != nil {
fmt.Println(err, "failed to create Node")
return
}
fmt.Println("listing Nodes")
nodes, err := ClientSet.CoreV1().Nodes().List(metav1.ListOptions{LabelSelector: "test-node-static=true"})
if err != nil {
fmt.Println(err, "failed to list Nodes")
return
}
nodeCount := len(nodes.Items)
if nodeCount == 0 {
fmt.Println("there are no Nodes found")
return
}
fmt.Println(nodeCount, "Node(s) found")
fmt.Println("deleting Node")
err = ClientSet.CoreV1().Nodes().Delete(testNodeName, &metav1.DeleteOptions{})
if err != nil {
fmt.Println(err, "failed to delete the Node")
return
}
// TEST ENDS HERE
fmt.Println("[status] complete")
}
Discover useragents:
select distinct useragent from audit_event where bucket='apisnoop' and useragent not like 'kube%' and useragent not like 'coredns%' and useragent not like 'kindnetd%' and useragent like 'live%';
useragent
-------------------
live-test-writing
(1 row)
List endpoints hit by the test:
select * from endpoints_hit_by_new_test where useragent like 'live%';
useragent | operation_id | hit_by_ete | hit_by_new_test
-------------------+------------------+------------+-----------------
live-test-writing | createCoreV1Node | f | 2
live-test-writing | deleteCoreV1Node | f | 2
live-test-writing | listCoreV1Node | t | 2
(3 rows)
Display endpoint coverage change:
select * from projected_change_in_coverage;
category | total_endpoints | old_coverage | new_coverage | change_in_number
---------------+-----------------+--------------+--------------+------------------
test_coverage | 445 | 192 | 194 | 2
(1 row)
If a test with these calls gets merged, **test coverage will go up by 2 points**
This test is also created with the goal of conformance promotion.
/sig testing
/sig architecture
/area conformance