Skip to content
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

remove deprecated ExternalID #61877

Merged
merged 4 commits into from
Apr 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/openapi-spec/swagger.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions api/swagger-spec/v1.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions cmd/kubeadm/app/util/apiclient/init_dryrun.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,6 @@ func (idr *InitDryRunGetter) handleGetNode(action core.GetAction) (bool, runtime
"kubernetes.io/hostname": idr.masterName,
},
},
Spec: v1.NodeSpec{
ExternalID: idr.masterName,
},
}, nil
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/kubeadm/app/util/apiclient/init_dryrun_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func TestHandleGetAction(t *testing.T) {
{
action: core.NewRootGetAction(schema.GroupVersionResource{Version: "v1", Resource: "nodes"}, masterName),
expectedHandled: true,
expectedObjectJSON: []byte(`{"metadata":{"name":"master-foo","creationTimestamp":null,"labels":{"kubernetes.io/hostname":"master-foo"}},"spec":{"externalID":"master-foo"},"status":{"daemonEndpoints":{"kubeletEndpoint":{"Port":0}},"nodeInfo":{"machineID":"","systemUUID":"","bootID":"","kernelVersion":"","osImage":"","containerRuntimeVersion":"","kubeletVersion":"","kubeProxyVersion":"","operatingSystem":"","architecture":""}}}`),
expectedObjectJSON: []byte(`{"metadata":{"name":"master-foo","creationTimestamp":null,"labels":{"kubernetes.io/hostname":"master-foo"}},"spec":{},"status":{"daemonEndpoints":{"kubeletEndpoint":{"Port":0}},"nodeInfo":{"machineID":"","systemUUID":"","bootID":"","kernelVersion":"","osImage":"","containerRuntimeVersion":"","kubeletVersion":"","kubeProxyVersion":"","operatingSystem":"","architecture":""}}}`),
expectedErr: false,
},
{
Expand Down
14 changes: 7 additions & 7 deletions docs/api-reference/v1/definitions.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions pkg/apis/core/fuzzer/fuzzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -469,10 +469,6 @@ var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
ss.SessionAffinityConfig = nil
}
},
func(n *core.Node, c fuzz.Continue) {
c.FuzzNoCustom(n)
n.Spec.ExternalID = "external"
},
func(s *core.NodeStatus, c fuzz.Continue) {
c.FuzzNoCustom(s)
s.Allocatable = s.Capacity
Expand Down
9 changes: 5 additions & 4 deletions pkg/apis/core/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -3228,10 +3228,6 @@ type NodeSpec struct {
// +optional
PodCIDR string

// External ID of the node assigned by some machine database (e.g. a cloud provider)
// +optional
ExternalID string

// ID of the node assigned by the cloud provider
// Note: format is "<ProviderName>://<ProviderSpecificNodeID>"
// +optional
Expand All @@ -3249,6 +3245,11 @@ type NodeSpec struct {
// The DynamicKubeletConfig feature gate must be enabled for the Kubelet to use this field
// +optional
ConfigSource *NodeConfigSource

// Deprecated. Not all kubelets will set this field. Remove field after 1.13.
// see: https://issues.k8s.io/61966
// +optional
DoNotUse_ExternalID string
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand Down
5 changes: 0 additions & 5 deletions pkg/apis/core/v1/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,11 +296,6 @@ func SetDefaults_NamespaceStatus(obj *v1.NamespaceStatus) {
obj.Phase = v1.NamespaceActive
}
}
func SetDefaults_Node(obj *v1.Node) {
if obj.Spec.ExternalID == "" {
obj.Spec.ExternalID = obj.Name
}
}
func SetDefaults_NodeStatus(obj *v1.NodeStatus) {
if obj.Allocatable == nil && obj.Capacity != nil {
obj.Allocatable = make(v1.ResourceList, len(obj.Capacity))
Expand Down
14 changes: 0 additions & 14 deletions pkg/apis/core/v1/defaults_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1033,20 +1033,6 @@ func TestSetDefaultPodSpecHostNetwork(t *testing.T) {
}
}

func TestSetDefaultNodeExternalID(t *testing.T) {
name := "node0"
n := &v1.Node{}
n.Name = name
obj2 := roundTrip(t, runtime.Object(n))
n2 := obj2.(*v1.Node)
if n2.Spec.ExternalID != name {
t.Errorf("Expected default External ID: %s, got: %s", name, n2.Spec.ExternalID)
}
if n2.Spec.ProviderID != "" {
t.Errorf("Expected empty default Cloud Provider ID, got: %s", n2.Spec.ProviderID)
}
}

func TestSetDefaultNodeStatusAllocatable(t *testing.T) {
capacity := v1.ResourceList{
v1.ResourceCPU: resource.MustParse("1000m"),
Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/core/v1/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion pkg/apis/core/v1/zz_generated.defaults.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions pkg/apis/core/validation/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -3973,11 +3973,6 @@ func ValidateNode(node *core.Node) field.ErrorList {
// That said, if specified, we need to ensure they are valid.
allErrs = append(allErrs, ValidateNodeResources(node)...)

// external ID is required.
if len(node.Spec.ExternalID) == 0 {
allErrs = append(allErrs, field.Required(field.NewPath("spec", "externalID"), ""))
}

// Only allow Node.Spec.ConfigSource to be set if the DynamicKubeletConfig feature gate is enabled
if node.Spec.ConfigSource != nil && !utilfeature.DefaultFeatureGate.Enabled(features.DynamicKubeletConfig) {
allErrs = append(allErrs, field.Forbidden(field.NewPath("spec", "configSource"), "configSource may only be set if the DynamicKubeletConfig feature gate is enabled)"))
Expand Down
49 changes: 2 additions & 47 deletions pkg/apis/core/validation/validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9364,9 +9364,6 @@ func TestValidateNode(t *testing.T) {
core.ResourceName("hugepages-1Gi"): resource.MustParse("0"),
},
},
Spec: core.NodeSpec{
ExternalID: "external",
},
},
{
ObjectMeta: metav1.ObjectMeta{
Expand All @@ -9381,9 +9378,6 @@ func TestValidateNode(t *testing.T) {
core.ResourceName(core.ResourceMemory): resource.MustParse("0"),
},
},
Spec: core.NodeSpec{
ExternalID: "external",
},
},
{
ObjectMeta: metav1.ObjectMeta{
Expand All @@ -9399,7 +9393,6 @@ func TestValidateNode(t *testing.T) {
},
},
Spec: core.NodeSpec{
ExternalID: "external",
// Add a valid taint to a node
Taints: []core.Taint{{Key: "GPU", Value: "true", Effect: "NoSchedule"}},
},
Expand Down Expand Up @@ -9437,9 +9430,6 @@ func TestValidateNode(t *testing.T) {
core.ResourceName(core.ResourceMemory): resource.MustParse("0"),
},
},
Spec: core.NodeSpec{
ExternalID: "external",
},
},
{
ObjectMeta: metav1.ObjectMeta{
Expand All @@ -9455,8 +9445,7 @@ func TestValidateNode(t *testing.T) {
},
},
Spec: core.NodeSpec{
ExternalID: "external",
PodCIDR: "192.168.0.0/16",
PodCIDR: "192.168.0.0/16",
},
},
}
Expand All @@ -9479,9 +9468,6 @@ func TestValidateNode(t *testing.T) {
core.ResourceName(core.ResourceMemory): resource.MustParse("10G"),
},
},
Spec: core.NodeSpec{
ExternalID: "external",
},
},
"invalid-labels": {
ObjectMeta: metav1.ObjectMeta{
Expand All @@ -9494,28 +9480,12 @@ func TestValidateNode(t *testing.T) {
core.ResourceName(core.ResourceMemory): resource.MustParse("10G"),
},
},
Spec: core.NodeSpec{
ExternalID: "external",
},
},
"missing-external-id": {
ObjectMeta: metav1.ObjectMeta{
Name: "abc-123",
Labels: validSelector,
},
Status: core.NodeStatus{
Capacity: core.ResourceList{
core.ResourceName(core.ResourceCPU): resource.MustParse("10"),
core.ResourceName(core.ResourceMemory): resource.MustParse("10G"),
},
},
},
"missing-taint-key": {
ObjectMeta: metav1.ObjectMeta{
Name: "dedicated-node1",
},
Spec: core.NodeSpec{
ExternalID: "external",
// Add a taint with an empty key to a node
Taints: []core.Taint{{Key: "", Value: "special-user-1", Effect: "NoSchedule"}},
},
Expand All @@ -9525,7 +9495,6 @@ func TestValidateNode(t *testing.T) {
Name: "dedicated-node1",
},
Spec: core.NodeSpec{
ExternalID: "external",
// Add a taint with an invalid key to a node
Taints: []core.Taint{{Key: "NoUppercaseOrSpecialCharsLike=Equals", Value: "special-user-1", Effect: "NoSchedule"}},
},
Expand All @@ -9544,7 +9513,6 @@ func TestValidateNode(t *testing.T) {
},
},
Spec: core.NodeSpec{
ExternalID: "external",
// Add a taint with a bad value to a node
Taints: []core.Taint{{Key: "dedicated", Value: "some\\bad\\value", Effect: "NoSchedule"}},
},
Expand All @@ -9563,7 +9531,6 @@ func TestValidateNode(t *testing.T) {
},
},
Spec: core.NodeSpec{
ExternalID: "external",
// Add a taint with an empty effect to a node
Taints: []core.Taint{{Key: "dedicated", Value: "special-user-3", Effect: ""}},
},
Expand All @@ -9582,7 +9549,6 @@ func TestValidateNode(t *testing.T) {
},
},
Spec: core.NodeSpec{
ExternalID: "external",
// Add a taint with NoExecute effect to a node
Taints: []core.Taint{{Key: "dedicated", Value: "special-user-3", Effect: "NoScheduleNoAdmit"}},
},
Expand All @@ -9592,7 +9558,6 @@ func TestValidateNode(t *testing.T) {
Name: "dedicated-node1",
},
Spec: core.NodeSpec{
ExternalID: "external",
// Add two taints to the node with the same key and effect; should be rejected.
Taints: []core.Taint{
{Key: "dedicated", Value: "special-user-1", Effect: "NoSchedule"},
Expand Down Expand Up @@ -9622,9 +9587,6 @@ func TestValidateNode(t *testing.T) {
core.ResourceName(core.ResourceMemory): resource.MustParse("0"),
},
},
Spec: core.NodeSpec{
ExternalID: "external",
},
},
"invalid-podController": {
ObjectMeta: metav1.ObjectMeta{
Expand Down Expand Up @@ -9657,9 +9619,6 @@ func TestValidateNode(t *testing.T) {
core.ResourceName(core.ResourceMemory): resource.MustParse("0"),
},
},
Spec: core.NodeSpec{
ExternalID: "external",
},
},
"multiple-pre-allocated-hugepages": {
ObjectMeta: metav1.ObjectMeta{
Expand All @@ -9678,9 +9637,6 @@ func TestValidateNode(t *testing.T) {
core.ResourceName("hugepages-1Gi"): resource.MustParse("10Gi"),
},
},
Spec: core.NodeSpec{
ExternalID: "external",
},
},
"invalid-pod-cidr": {
ObjectMeta: metav1.ObjectMeta{
Expand All @@ -9696,8 +9652,7 @@ func TestValidateNode(t *testing.T) {
},
},
Spec: core.NodeSpec{
ExternalID: "external",
PodCIDR: "192.168.0.0",
PodCIDR: "192.168.0.0",
},
},
}
Expand Down