mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-06 07:57:35 +00:00
Remove validation for Capacity as it got moved from Spec to Status.
Also fix breakage from ExternalID validation: Default ExternalID to node name when not specified.
This commit is contained in:
@@ -108,6 +108,11 @@ func init() {
|
||||
obj.Phase = NamespaceActive
|
||||
}
|
||||
},
|
||||
func(obj *Node) {
|
||||
if obj.Spec.ExternalID == "" {
|
||||
obj.Spec.ExternalID = obj.Name
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -182,3 +182,14 @@ func TestSetDefaultPodSpecHostNetwork(t *testing.T) {
|
||||
t.Errorf("Expected container port to be defaulted, was made %d instead of %d", hostPortNum, portNum)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSetDefaultNodeExternalID(t *testing.T) {
|
||||
name := "node0"
|
||||
n := ¤t.Node{}
|
||||
n.Name = name
|
||||
obj2 := roundTrip(t, runtime.Object(n))
|
||||
n2 := obj2.(*current.Node)
|
||||
if n2.Spec.ExternalID != name {
|
||||
t.Errorf("Expected default External ID: %s, got: %s", name, n2.Spec.ExternalID)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -999,7 +999,7 @@ type NodeSpec struct {
|
||||
// PodCIDR represents the pod IP range assigned to the node
|
||||
PodCIDR string `json:"podCIDR,omitempty" description:"pod IP range assigned to the node"`
|
||||
// External ID of the node assigned by some machine database (e.g. a cloud provider)
|
||||
ExternalID string `json:"externalID,omitempty" description:"external ID assigned to the node by some machine database (e.g. a cloud provider)"`
|
||||
ExternalID string `json:"externalID,omitempty" description:"external ID assigned to the node by some machine database (e.g. a cloud provider). Defaults to node name when empty."`
|
||||
// Unschedulable controls node schedulability of new pods. By default node is schedulable.
|
||||
Unschedulable bool `json:"unschedulable,omitempty" description:"disable pod scheduling on the node"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user