Add subnet-len configuration option. - #70
Conversation
By default flannel chops the configured cidr in /24 subnets that are assigned to each node, this allows kubelet to run up to 254 hosts, for clusters where the machines are large enough to host more than 254 pods or have a large number of create-destroy pod operations (e.g. a CI/CD pipeline) would produce an starvation of available IP addresses. This configuration option will allow flannel to be configured with a different size for each subnet. When this configuration option changes the cni0 bridge is destroyed and flannel restarted. Fixes [lp:1930087](https://bugs.launchpad.net/charm-flannel/+bug/1930087)
|
I was giving some rounds of testing to this patch and I realize my approach is susceptible of a race condition, since I'm using whatever is stored in etcd to determine if the SubnetLen changed, I should simply rely on Another approach I was giving some thoughts is to make the leader do the "etcdctl set" and then do a leader-set to make the peers react and restart flannel, I believe it will be more clean and less prone to issues (e.g. many units doing the "etcdctl set" concurrently). |
|
I'm confused in what would be the best approach to force the |
addyess
left a comment
There was a problem hiding this comment.
I don't know precisely what this changes in flannel, but i don't understand why we're only setting SubnetLen to 24?
Maybe I'm reading the if statement incorrectly. Can you confirm this PR is still necessary?
| # the subnet-len configured is 24 which will be the case for environments | ||
| # upgrading the charm and in those situations we don't want to add | ||
| # disruption restating flannel without need. | ||
| if current_config.get("SubnetLen") != config("subnet-len") \ |
There was a problem hiding this comment.
readability suggestion:
| if current_config.get("SubnetLen") != config("subnet-len") \ | |
| current_subnet = current_config.get("SubnetLen") | |
| target_subnet = config("subnet-len") | |
| if (current_subnet != target_subnet) and (current_subnet is not None) and (target_subnet == 24): |
@freyes why would you only apply this when subnet-len is 24?
|
Is there any movement on this? We've had some decent downtime attributed to Juju defaulting /24 in a large production cluster. There's also a bug posted in launchpad with no movement in over a year. |
By default flannel chops the configured cidr in /24 subnets that are
assigned to each node, this allows kubelet to run up to 254 hosts, for
clusters where the machines are large enough to host more than 254 pods
or have a large number of create-destroy pod operations (e.g. a CI/CD
pipeline) would produce an starvation of available IP addresses.
This configuration option will allow flannel to be configured with
a different size for each subnet. When this configuration option
changes the cni0 bridge is destroyed and flannel restarted.
Fixes lp:1930087