-
Notifications
You must be signed in to change notification settings - Fork 40k
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
[kubeadm]: Remove the deprecated kube-dns as an option in kubeadm #99646
Conversation
thanks for the PR @rajansandeep /approve |
/remove-priority important-longterm |
looks like ./hack/update-vendor.sh |
@@ -141,9 +141,6 @@ type DNSAddOnType string | |||
const ( | |||
// CoreDNS add-on type | |||
CoreDNS DNSAddOnType = "CoreDNS" | |||
|
|||
// KubeDNS add-on type | |||
KubeDNS DNSAddOnType = "kube-dns" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just to double check.
what happens if the user passes kube-dns
as the type after this change:
https://github.com/kubernetes/kubernetes/blob/700047303c5414b5fe9b0d1240602cb680274ca1/cmd/kubeadm/app/apis/kubeadm/v1beta2/types.go#L93
is it a NOOP now?
if so, i think we must reflect that in the release note with an additional sentence.
The "kube-dns" type is no longer recognized if passed to ClusterConfiguration.dns.type.
should we error out if anything other than "CoreDNS" is used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we error out if anything other than "CoreDNS" is used?
i cannot find validation for ClusterConfiguration.DNS.Type.
in EnsureDNSAddon() we just check if Type
is coredns first and if not it uses kube-dns.
https://github.com/kubernetes/kubernetes/blob/master/cmd/kubeadm/app/phases/addons/dns/dns.go#L103-L114
this validation should have been originally in:
https://github.com/kubernetes/kubernetes/blob/master/cmd/kubeadm/app/apis/kubeadm/validation/validation.go#L59
so...we can instead do this in the release note:
kubeadm: the deprecated kube-dns is no longer supported as an option. Given kubeadm now only supports CoreDNS as the DNS addon, the value of the field "ClusterConfiguration.dns.type" is ignored.
instead of adding the validation in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. I updated the release notes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the value of the field "ClusterConfiguration.dns.type" is ignored
That's surprising to me... was that field validated in 1.20? If so, we should error rather than silently accept a config that explicitly requests kube-dns and previously worked and not honor it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
apparently the field was never validated after the API was converted to internal type...
and during runtime the check was if type == "CoreDNS" { // install coredns } else { // install kube-dns }
.
having the validation seems better to me overall, but i didn't want to introduce it now.
if we are going it introduce it, it would look like this:
add this:
// ValidateDNS validates the DNS object and collects all encountered errors
func ValidateDNS(dns *kubeadm.DNS, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{}
if dns.Type != kubeadm.CoreDNS {
allErrs = append(allErrs, field.Invalid(fldPath, dns.Type, fmt.Sprintf("only DNS type %q is supported", kubeadm.CoreDNS)))
}
return allErrs
}
it should be called like so:
allErrs = append(allErrs, ValidateDNS(&c.DNS, field.NewPath("dns"))...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this means that we need to keep the kube-dns type constant and related issues open with a TODO.
Seems like you could inline it as "kube-dns" with a comment that this value is no longer supported. Not sure why you'd need to remove or adjust it in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, it can be inlined.
since i logged this ticket to remove the "type" field in v1beta3.
kubernetes/kubeadm#2398
i guess we will have to remove this validation too...EDIT: actually it should be removed with v1beta2 i guess.
@rajansandeep please let me know if you have any questions for this update.
// ValidateDNS validates the DNS object and collects all encountered errors
func ValidateDNS(dns *kubeadm.DNS, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{}
const kubeDNSType = "kube-dns"
if dns.Type == kubeDNSType {
allErrs = append(allErrs, field.Invalid(fldPath, dns.Type, fmt.Sprintf("DNS type %q is no longer supported", kubeDNSType)))
}
return allErrs
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rajansandeep
we also need to change the release note to:
kubeadm: the deprecated kube-dns is no longer supported as an option. If "ClusterConfiguration.dns.type" is set to "kube-dns" kubeadm will now throw an error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added the validation and changed the release notes.
Please let me know if I should squash the commits or leave it as is...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks.
/lgtm |
gofmt has a minor complaint here: |
92d6a50
to
8901a9b
Compare
/lgtm |
/hold cancel |
looks like ./hack/update-gofmt.sh is required |
gofmt seems okay, it seems to be a flaky test fail |
/test pull-kubernetes-integration |
@neolit123: GitHub didn't allow me to assign the following users: liggit. Note that only kubernetes members, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
go.mod change lgtm, one comment about ignoring a config that explicitly requests kube-dns |
/lgtm |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: liggitt, neolit123, rajansandeep The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
👋 Hello! I am from the Bug Triage team! Friendly reminder that code freeze is starting March 9th, 2021 (about 1 week from now)! |
What type of PR is this?
/kind cleanup
/kind deprecation
What this PR does / why we need it:
This PR removes the deprecated kube-dns as an option in kubeadm
Which issue(s) this PR fixes:
Fixes kubernetes/kubeadm#1943
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: