mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-17 23:19:26 +00:00
Move Capacity from NodeSpec to NodeStatus
This commit is contained in:
@@ -1935,7 +1935,7 @@ func (kl *Kubelet) tryUpdateNodeStatus() error {
|
||||
node.Status.NodeInfo.MachineID = info.MachineID
|
||||
node.Status.NodeInfo.SystemUUID = info.SystemUUID
|
||||
node.Status.NodeInfo.BootID = info.BootID
|
||||
node.Spec.Capacity = CapacityFromMachineInfo(info)
|
||||
node.Status.Capacity = CapacityFromMachineInfo(info)
|
||||
}
|
||||
|
||||
currentTime := util.Now()
|
||||
|
@@ -3138,12 +3138,7 @@ func TestUpdateNewNodeStatus(t *testing.T) {
|
||||
mockCadvisor.On("MachineInfo").Return(machineInfo, nil)
|
||||
expectedNode := &api.Node{
|
||||
ObjectMeta: api.ObjectMeta{Name: "testnode"},
|
||||
Spec: api.NodeSpec{
|
||||
Capacity: api.ResourceList{
|
||||
api.ResourceCPU: *resource.NewMilliQuantity(2000, resource.DecimalSI),
|
||||
api.ResourceMemory: *resource.NewQuantity(1024, resource.BinarySI),
|
||||
},
|
||||
},
|
||||
Spec: api.NodeSpec{},
|
||||
Status: api.NodeStatus{
|
||||
Conditions: []api.NodeCondition{
|
||||
{
|
||||
@@ -3159,6 +3154,10 @@ func TestUpdateNewNodeStatus(t *testing.T) {
|
||||
SystemUUID: "abc",
|
||||
BootID: "1b3",
|
||||
},
|
||||
Capacity: api.ResourceList{
|
||||
api.ResourceCPU: *resource.NewMilliQuantity(2000, resource.DecimalSI),
|
||||
api.ResourceMemory: *resource.NewQuantity(1024, resource.BinarySI),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -3193,12 +3192,7 @@ func TestUpdateExistingNodeStatus(t *testing.T) {
|
||||
kubeClient.MinionsList = api.NodeList{Items: []api.Node{
|
||||
{
|
||||
ObjectMeta: api.ObjectMeta{Name: "testnode"},
|
||||
Spec: api.NodeSpec{
|
||||
Capacity: api.ResourceList{
|
||||
api.ResourceCPU: *resource.NewMilliQuantity(3000, resource.DecimalSI),
|
||||
api.ResourceMemory: *resource.NewQuantity(2048, resource.BinarySI),
|
||||
},
|
||||
},
|
||||
Spec: api.NodeSpec{},
|
||||
Status: api.NodeStatus{
|
||||
Conditions: []api.NodeCondition{
|
||||
{
|
||||
@@ -3209,6 +3203,10 @@ func TestUpdateExistingNodeStatus(t *testing.T) {
|
||||
LastTransitionTime: util.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
},
|
||||
},
|
||||
Capacity: api.ResourceList{
|
||||
api.ResourceCPU: *resource.NewMilliQuantity(3000, resource.DecimalSI),
|
||||
api.ResourceMemory: *resource.NewQuantity(2048, resource.BinarySI),
|
||||
},
|
||||
},
|
||||
},
|
||||
}}
|
||||
@@ -3222,12 +3220,7 @@ func TestUpdateExistingNodeStatus(t *testing.T) {
|
||||
mockCadvisor.On("MachineInfo").Return(machineInfo, nil)
|
||||
expectedNode := &api.Node{
|
||||
ObjectMeta: api.ObjectMeta{Name: "testnode"},
|
||||
Spec: api.NodeSpec{
|
||||
Capacity: api.ResourceList{
|
||||
api.ResourceCPU: *resource.NewMilliQuantity(2000, resource.DecimalSI),
|
||||
api.ResourceMemory: *resource.NewQuantity(1024, resource.BinarySI),
|
||||
},
|
||||
},
|
||||
Spec: api.NodeSpec{},
|
||||
Status: api.NodeStatus{
|
||||
Conditions: []api.NodeCondition{
|
||||
{
|
||||
@@ -3243,6 +3236,10 @@ func TestUpdateExistingNodeStatus(t *testing.T) {
|
||||
SystemUUID: "abc",
|
||||
BootID: "1b3",
|
||||
},
|
||||
Capacity: api.ResourceList{
|
||||
api.ResourceCPU: *resource.NewMilliQuantity(2000, resource.DecimalSI),
|
||||
api.ResourceMemory: *resource.NewQuantity(1024, resource.BinarySI),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user