mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
Fix flaky test: Metrics should grab all metrics from kubelet /metrics/resource endpoint
Signed-off-by: carlory <baofa.fan@daocloud.io>
This commit is contained in:
parent
88dfcb225d
commit
7d7fc2d989
@ -188,10 +188,15 @@ func AddExtendedResource(ctx context.Context, clientSet clientset.Interface, nod
|
|||||||
extendedResourceList := v1.ResourceList{
|
extendedResourceList := v1.ResourceList{
|
||||||
extendedResource: extendedResourceQuantity,
|
extendedResource: extendedResourceQuantity,
|
||||||
}
|
}
|
||||||
patchPayload, err := json.Marshal(v1.Node{
|
|
||||||
Status: v1.NodeStatus{
|
// This is a workaround for the fact that we shouldn't marshal a Node struct to JSON
|
||||||
Capacity: extendedResourceList,
|
// because it wipes out some fields from node status like the daemonEndpoints and
|
||||||
Allocatable: extendedResourceList,
|
// nodeInfo which should not be changed at this time. We need to use a map instead.
|
||||||
|
// See https://github.com/kubernetes/kubernetes/issues/131229
|
||||||
|
patchPayload, err := json.Marshal(map[string]any{
|
||||||
|
"status": map[string]any{
|
||||||
|
"capacity": extendedResourceList,
|
||||||
|
"allocatable": extendedResourceList,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
framework.ExpectNoError(err, "Failed to marshal node JSON")
|
framework.ExpectNoError(err, "Failed to marshal node JSON")
|
||||||
|
Loading…
Reference in New Issue
Block a user