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

Take IPFamily precedence based on order #8460

Merged
merged 2 commits into from
Sep 29, 2023

Conversation

manuelbuil
Copy link
Contributor

@manuelbuil manuelbuil commented Sep 27, 2023

Proposed Changes

This PR supports networking related config flags to follow the order in dual-stack. In that case, IPv6 address will be prioritized.

Note that flannel-cni is not supporting this and always prioritizes IPv4. I am investigating how to fix this but I wanted to create this PR first to address some of the comments in #8394

This PR includes two commits. The first one 067094a has its own PR and is being reviewed here: #8394

On a high level, the other commit does the following:

  • Turn some functions in pkg/util/net.go private
  • Move the default ListenAddress, clusterCIDR and serviceCIDR to pkg/util/net.go
  • Replace function GetFirstIP with GetDefaultAddresses which return the previous defaults depending on IPFamily
  • GetFirstIP function was taking a slice of IP addresses and prioritized IPv4 over IPv6. Places where this function was used are now picking the first IP address instead (index 0)
  • Flannel is not filling IPv4 network information if main cidr IP is IPv6 (but is filling the subnet_v4, so things will still work)
  • cluster-cidr-ipv6 is now allowed on nodes with dual-stack main interface (before, having a cluster-cidr-ipv6 meant ipv6-only)

Types of Changes

New feature

Verification

Deploy in dual-stack mode with cluster-cidr and service-cidr using order and verify that when listing services or pods, IPv6 addresses appear. Check that all have an IPv4 as well and that connectivity to both addresses is working

Testing

Linked Issues

#8467

User-Facing Change


Further Comments

@codecov
Copy link

codecov bot commented Sep 27, 2023

Codecov Report

Attention: 17 lines in your changes are missing coverage. Please review.

Comparison is base (fe18b1f) 47.16% compared to head (f2c7117) 49.49%.
Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8460      +/-   ##
==========================================
+ Coverage   47.16%   49.49%   +2.33%     
==========================================
  Files         143      143              
  Lines       14855    14817      -38     
==========================================
+ Hits         7006     7334     +328     
+ Misses       6718     6301     -417     
- Partials     1131     1182      +51     
Flag Coverage Δ
e2etests 48.74% <59.52%> (?)
inttests 41.00% <65.38%> (-3.51%) ⬇️
unittests 19.71% <0.00%> (-0.01%) ⬇️

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

Files Coverage Δ
pkg/agent/config/config.go 50.89% <100.00%> (+2.04%) ⬆️
pkg/agent/templates/templates_linux.go 62.50% <ø> (ø)
pkg/deploy/zz_generated_bindata.go 51.49% <ø> (ø)
pkg/server/server.go 58.01% <100.00%> (+1.27%) ⬆️
pkg/agent/run.go 42.53% <66.66%> (+0.04%) ⬆️
pkg/cluster/cluster.go 40.47% <0.00%> (+0.47%) ⬆️
pkg/daemons/config/types.go 84.44% <0.00%> (ø)
pkg/agent/flannel/setup.go 38.51% <0.00%> (-0.27%) ⬇️
pkg/cli/server/server.go 57.95% <78.57%> (+0.95%) ⬆️
pkg/util/net.go 57.48% <57.14%> (+10.16%) ⬆️

... and 43 files with indirect coverage changes

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

@manuelbuil manuelbuil force-pushed the dsOrderGood2 branch 2 times, most recently from fdabaa6 to 5123367 Compare September 27, 2023 10:09
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.

LGTM.

@rancher-max we should specifically test upgrades to this commit on dual-stack clusters. Should check the logs to make sure that the deploy controller doesn't get stuck in a loop trying to change the ClusterIPs in a way that is rejected by the apiserver.

@manuelbuil manuelbuil force-pushed the dsOrderGood2 branch 2 times, most recently from 81e1e96 to 7b09964 Compare September 28, 2023 18:04
if (serviceIPv6 != clusterIPv6) || (dualCluster != dualService) || (serviceIPv4 != clusterIPv4) {
return fmt.Errorf("cluster-cidr: %v and service-cidr: %v, must share the same IP version (IPv4, IPv6 or dual-stack)", nodeConfig.AgentConfig.ClusterCIDRs, nodeConfig.AgentConfig.ServiceCIDRs)
}
if (clusterIPv6 && !nodeIPv6) || (dualCluster && !dualNode) || (clusterIPv4 && !nodeIPv4) {
if (clusterIPv6 && !(nodeIPv6 || dualNode)) || (dualCluster && !dualNode) || (clusterIPv4 && !(nodeIPv4 || dualNode)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

this is getting comically complicated to follow!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, I'll add a comment

Signed-off-by: Manuel Buil <mbuil@suse.com>
Signed-off-by: Manuel Buil <mbuil@suse.com>
@manuelbuil
Copy link
Contributor Author

I squashed the utils commit. I will leave the coredns commit separately though

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.

3 participants