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

NodeLocal DNSCache #8780

Merged
merged 5 commits into from
Apr 10, 2020
Merged

Conversation

mazzy89
Copy link
Contributor

@mazzy89 mazzy89 commented Mar 21, 2020

Signed-off-by: Salvatore Mazzarino dev@mazzarino.cz

From k8s 1.18 NodeLocal DNSCache is GA.

This PR aims to implement NodeLocal DNSCache as an addon and enable it only when CoreDNS is enabled too.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Mar 21, 2020
@k8s-ci-robot
Copy link
Contributor

Hi @mazzy89. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Mar 21, 2020
@mazzy89 mazzy89 mentioned this pull request Mar 21, 2020
pkg/model/components/kubedns.go Show resolved Hide resolved
pkg/model/components/kubelet.go Outdated Show resolved Hide resolved
@rifelpet
Copy link
Member

/ok-to-test

My only thought on the new api fields is that it might be more intuitive to have an Enabled field rather than a Disabled field

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Mar 22, 2020
@mazzy89
Copy link
Contributor Author

mazzy89 commented Mar 22, 2020

@rifelpet going to change the condition to Enabled because indeed more intutive.

@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. area/documentation and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Mar 23, 2020
@mazzy89
Copy link
Contributor Author

mazzy89 commented Mar 23, 2020

/retest

pkg/model/components/kubedns.go Show resolved Hide resolved
pkg/model/components/kubedns.go Outdated Show resolved Hide resolved
pkg/model/components/kubelet.go Outdated Show resolved Hide resolved
upup/pkg/fi/cloudup/bootstrapchannelbuilder.go Outdated Show resolved Hide resolved
docs/cluster_spec.md Show resolved Hide resolved
pkg/apis/kops/validation/legacy.go Show resolved Hide resolved
@olemarkus
Copy link
Member

The nodes start now, but ends up in this error:
plugin/forward: /etc/Corefile:10 - Error during parsing: Wrong argument count or unexpected line ending after '.'

Is there any way of testing if this works? Like prometheus counters or something?

@mazzy89
Copy link
Contributor Author

mazzy89 commented Mar 27, 2020

I guess you are using it in iptables mode. in that case then ClusterIP is an empty string and the template then is probably parsed with an empty space which cause the parsing failing.

I guess then we need to check if the ClusterIP is set.

@mazzy89
Copy link
Contributor Author

mazzy89 commented Mar 27, 2020

Let me wire here a change and see if it works.

@olemarkus
Copy link
Member

Now I get

error building tasks: error reading manifest addons/nodelocaldns.addons.k8s.io/k8s-1.12.yaml: error opening resource: error executing resource template "addons/nodelocaldns.addons.k8s.io/k8s-1.12.yaml": error parsing template "addons/nodelocaldns.addons.k8s.io/k8s-1.12.yaml": template: addons/nodelocaldns.addons.k8s.io/k8s-1.12.yaml:75: unexpected {{else}}

Could you maybe try to deploy a cluster with this before submitting the next commits?

@mazzy89
Copy link
Contributor Author

mazzy89 commented Mar 27, 2020

Now I get


error building tasks: error reading manifest addons/nodelocaldns.addons.k8s.io/k8s-1.12.yaml: error opening resource: error executing resource template "addons/nodelocaldns.addons.k8s.io/k8s-1.12.yaml": error parsing template "addons/nodelocaldns.addons.k8s.io/k8s-1.12.yaml": template: addons/nodelocaldns.addons.k8s.io/k8s-1.12.yaml:75: unexpected {{else}}

Could you maybe try to deploy a cluster with this before submitting the next commits?

Unfortunately dont have anywhere where to test this change quickly

@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Mar 30, 2020
@mazzy89
Copy link
Contributor Author

mazzy89 commented Mar 30, 2020

Added unit tests here. It should now be easier to tests and make sure that the different scenarios are now covered.

@mazzy89
Copy link
Contributor Author

mazzy89 commented Apr 2, 2020

Ready here to be picked up for a review.

mazzy89 and others added 4 commits April 10, 2020 10:44
Signed-off-by: Salvatore Mazzarino <dev@mazzarino.cz>
Signed-off-by: Salvatore Mazzarino <dev@mazzarino.cz>
Signed-off-by: Salvatore Mazzarino <dev@mazzarino.cz>
@olemarkus
Copy link
Member

/test pull-kops-e2e-kubernetes-aws

@123BLiN
Copy link

123BLiN commented Apr 10, 2020

Sorry to bother, but will it be possible to use this with Kops 1.15/1.16 and kubernetes v1.15 or this change is only for furutre 1.18 release?

@mazzy89
Copy link
Contributor Author

mazzy89 commented Apr 10, 2020

At the moment the change has been planned for kops 1.18


// @ check that NodeLocalDNS addon is configured correctly
if c.Spec.KubeDNS.NodeLocalDNS != nil && c.Spec.KubeDNS.NodeLocalDNS.Enabled {
if c.Spec.KubeDNS.Provider != "CoreDNS" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we actually need the "raw" DNS provider to be CoreDNS? I didn't think it was required?

@@ -705,3 +714,9 @@ func validateKubelet(k *kops.KubeletConfigSpec, c *kops.Cluster, kubeletPath *fi
}
return allErrs
}

func isExperimentalClusterDNS(k *kops.KubeletConfigSpec, dns *kops.KubeDNSConfig) bool {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I'm not clear why this function is called "isExperimentalClusterDNS". Maybe isValidClusterDNS ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is just because when this one returns true, one needs the ExperimentalClusterDNS featureflag on. I am not really sure this feature flag makes sense. As in it doesn't really guard a feature.

One option would certainly be to remove the feature flag and only consider "valid" configurations.

// NodeLocalDNSConfig are options of the node-local-dns
type NodeLocalDNSConfig struct {
// Disable indicates we do not wish to run the node-local-dns addon
Enabled bool `json:"enabled,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we actually should make this Enabled *bool, because we want to differentiate between:

nodeLocalDNSConfig:
  enabled: false
  localIP: 10.0.0.1

and

nodeLocalDNSConfig:
  localIP: 10.0.0.1

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose this could be a change we do if we consider enabling this by default. If not, we don't really need to distinguish between the two now.

@justinsb
Copy link
Member

Thanks @mazzy89

A few small nits, and the enabled one is actually pretty important I think. But we can also do them in follow on PRs, so...

/approve
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 10, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: justinsb, mazzy89

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 10, 2020
@k8s-ci-robot k8s-ci-robot merged commit d0dea75 into kubernetes:master Apr 10, 2020
@k8s-ci-robot k8s-ci-robot added this to the v1.18 milestone Apr 10, 2020
justinsb added a commit to justinsb/kops that referenced this pull request Apr 17, 2020
As discussed in kubernetes#8780 so we differentiate between false and not-set.
Also tweak the comment.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/api area/documentation cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants