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

Fix pretty-printing of coredns and nodelocaldns configmaps #11694

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

VannTen
Copy link
Contributor

@VannTen VannTen commented Nov 7, 2024

What type of PR is this?
/kind bug

What this PR does / why we need it:
When using

dns_upstream_forward_extra_opts:
  prefer_udp: "" # the option as no value so use empty string to just
                 # put the key

This is rendered in the dns configmap as ($ for end-of-line)

...
prefer_udp $
...

Note the trailing space.
This triggers kubernetes/kubernetes#36222,
which makes the configmap hardly readable when editing them manually or
simply putting them in a yaml file for inspection.

Trim the concatenation of option + value to get rid of any trailing
space.
Example of kubectl edit on such a configmap:

  Corefile: ".:53 {\n    errors {\n    }\n    health {\n        lameduck 5s\n    }\n
    \   rewrite name suffix <redacted> cluster.local answer auto\n    ready\n    kubernetes
    cluster.local in-addr.arpa ip6.arpa {\n      pods insecure\n      fallthrough
    in-addr.arpa ip6.arpa\n    }\n    prometheus :9153\n    forward . <redacted>
    <redacted> {\n      prefer_udp\n      max_concurrent 1000\n      prefer_udp
    \n    }\n    cache 30\n\n    loop\n    reload\n    loadbalance\n}\n"

Special notes for your reviewer:
This is pretty minor, but pretty annoying !

Does this PR introduce a user-facing change?:

Fix pretty-printing (in kubectl) of nodelocaldns and coredns configmap when using `dns_upstream_forward_extra_opts` with an empty value option.

When using
dns_upstream_forward_extra_opts:
  prefer_udp: "" # the option as no value so use empty string to just
                 # put the key

This is rendered in the dns configmap as ($ for end-of-line)

...
  prefer_udp $
...

Note the trailing space.
This triggers kubernetes/kubernetes#36222,
which makes the configmap hardly readable when editing them manually or
simply putting them in a yaml file for inspection.

Trim the concatenation of option + value to get rid of any trailing
space.
@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Nov 7, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: VannTen

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 approved Indicates a PR has been approved by an approver from all required OWNERS files. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Nov 7, 2024
@VannTen
Copy link
Contributor Author

VannTen commented Nov 7, 2024

/ok-to-test

@k8s-ci-robot k8s-ci-robot added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Nov 7, 2024
@VannTen
Copy link
Contributor Author

VannTen commented Nov 7, 2024

/cherrypick release-2.26
/cherrypick release-2.25
/cherrypick release-2.24

@k8s-infra-cherrypick-robot

@VannTen: once the present PR merges, I will cherry-pick it on top of release-2.24, release-2.25, release-2.26 in new PRs and assign them to you.

In response to this:

/cherrypick release-2.26
/cherrypick release-2.25
/cherrypick release-2.24

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-sigs/prow repository.

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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants