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

add node-internal-dns/node-external-dns address pass-through support #10852

Merged
merged 9 commits into from
Sep 6, 2024

Conversation

arnemileswinter
Copy link
Contributor

@arnemileswinter arnemileswinter commented Sep 6, 2024

Proposed Changes

Add support for setting NodeInternalDNS and NodeExternalDNS addresses via stub cloud provider

Types of Changes

enhancement

Verification

k3s server --node-external-dns node.example.com

now yields:

image

As you can see it correctly sets the ExternalDNS address.

Testing

Linked Issues

User-Facing Change

Further Comments

@arnemileswinter arnemileswinter requested a review from a team as a code owner September 6, 2024 18:22
Signed-off-by: Arne Winter <[email protected]>
@cwayne18
Copy link
Collaborator

cwayne18 commented Sep 6, 2024

/trivy

Copy link
Contributor

github-actions bot commented Sep 6, 2024

pkg/agent/config/config.go Outdated Show resolved Hide resolved
pkg/agent/run.go Outdated Show resolved Hide resolved
pkg/agent/run.go Outdated Show resolved Hide resolved
@brandond brandond changed the title add --node-external-dns add node-internal-dns/node-external-dns address pass-through support Sep 6, 2024
pkg/agent/config/config.go Outdated Show resolved Hide resolved
pkg/agent/run.go Outdated Show resolved Hide resolved
pkg/daemons/config/types.go Outdated Show resolved Hide resolved
@arnemileswinter
Copy link
Contributor Author

arnemileswinter commented Sep 6, 2024

Thank you for your guidance @brandond
admittedly the flannel lines were mere copypasta as you've spotted :)
(I implemented this feature with a CTRL+F on NodeExternalIP and adjusted all the places to support NodeExternalDNS.)

I have compiled the artifact and both external and internal dns entries are now populated:

kubectl get nodes -o yaml
apiVersion: v1
items:
- apiVersion: v1
  kind: Node
  metadata:
    annotations:
# leaving flannel lines out
      k3s.io/external-dns: node.example.com
      k3s.io/external-ip: 192.168.178.23
      k3s.io/hostname: thinkpad-t440p
      k3s.io/internal-dns: internal.example.com
      k3s.io/internal-ip: 192.168.178.23
      k3s.io/node-args: '["server","--docker","--node-external-dns","node.example.com","--node-internal-dns","internal.example.com"]'
# i am leaving these lines out
  status:
    addresses:
    - address: 192.168.178.23
      type: InternalIP
    - address: 192.168.178.23
      type: ExternalIP
    - address: internal.example.com
      type: InternalDNS
    - address: node.example.com
      type: ExternalDNS
    - address: thinkpad-t440p
      type: Hostname

@brandond
Copy link
Contributor

brandond commented Sep 6, 2024

It LGTM but you added some unnecessary fields to the AgentConfig. Once those comments are addressed i think we're set. Thanks!

Signed-off-by: Arne Winter <[email protected]>
@arnemileswinter
Copy link
Contributor Author

hey @brandond i applied ur suggestions
(had to rebuild again and it takes a while on my PC, sorry for leaving you hanging)

I could also verify that settings multiple --external-node-dns flags works :)

Copy link
Contributor

@brandond brandond left a comment

Choose a reason for hiding this comment

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

last nit

pkg/cloudprovider/instances.go Outdated Show resolved Hide resolved
pkg/cloudprovider/instances.go Outdated Show resolved Hide resolved
arnemileswinter and others added 2 commits September 6, 2024 21:57
Co-authored-by: Brad Davidson <[email protected]>
Signed-off-by: Arne Winter <[email protected]>
Co-authored-by: Brad Davidson <[email protected]>
Signed-off-by: Arne Winter <[email protected]>
@brandond
Copy link
Contributor

brandond commented Sep 6, 2024

we can merge this to master, but today is the last day before code freeze for the September releases.. so I'm scheduling it to wait until next month to hit the release branches.

Copy link

codecov bot commented Sep 6, 2024

Codecov Report

Attention: Patch coverage is 33.33333% with 16 lines in your changes missing coverage. Please review.

Project coverage is 43.94%. Comparing base (216c367) to head (3345d8d).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
pkg/agent/run.go 25.00% 2 Missing and 4 partials ⚠️
pkg/cloudprovider/instances.go 0.00% 4 Missing and 2 partials ⚠️
pkg/agent/config/config.go 50.00% 2 Missing and 2 partials ⚠️

❗ There is a different number of reports uploaded between BASE (216c367) and HEAD (3345d8d). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (216c367) HEAD (3345d8d)
e2etests 7 6
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10852      +/-   ##
==========================================
- Coverage   49.98%   43.94%   -6.04%     
==========================================
  Files         178      178              
  Lines       14777    14801      +24     
==========================================
- Hits         7386     6505     -881     
- Misses       6048     7091    +1043     
+ Partials     1343     1205     -138     
Flag Coverage Δ
e2etests 36.45% <33.33%> (-9.73%) ⬇️
inttests 19.72% <25.00%> (-17.02%) ⬇️
unittests 13.55% <0.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@brandond brandond merged commit c4c11e5 into k3s-io:master Sep 6, 2024
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants