projectcalico/calico

Support /64 per node in IPv6 mode

オープン

#5,202 opened on 2020/11/25

 (8 件のコメント) (0 件のリアクション) (0 人の担当者)Go (1,594 件のフォーク)auto 404
help wantedkind/enhancementtriage/eternal

Repository metrics

Stars
 (7,292 個のスター)
PR merge metrics
 (PR metrics pending)

説明

I’m not sure I’m reporting this at the correct place, but anyway…

Expected Behavior

In Kubernetes, when a pod is scheduled on a node, the CNI plugin should be able to create an IPAMBlock and assign an IPv6 address from the newly created block.

Current Behavior

The CNI plugin is unable to assign a IPv6 address because the IPAMBlock is created with an empty unallocated field and NumFreeAddresses then returns 0.

The CNI plugin loops on creating new IPAMBlocks, and finding 0 available IPv6 addresses:

2020-11-25 22:26:05.177 [INFO][29627] ipam.go 462: Ran out of existing affine blocks for host host="worker01"
2020-11-25 22:26:05.178 [INFO][29627] ipam.go 477: No more affine blocks, but need to claim more block -- allocate another block host="worker01"
2020-11-25 22:26:05.178 [INFO][29627] ipam.go 480: Looking for an unclaimed block host="worker01"
2020-11-25 22:26:05.183 [INFO][29627] ipam_block_reader_writer.go 124: Found free block: fd01:0:0:f78a::/64
2020-11-25 22:26:05.183 [INFO][29627] ipam.go 492: Found unclaimed block host="worker01" subnet=fd01:0:0:f78a::/64
2020-11-25 22:26:05.183 [INFO][29627] ipam_block_reader_writer.go 137: Trying to create affinity in pending state host="worker01" subnet=fd01:0:0:f78a::/64
2020-11-25 22:26:05.187 [INFO][29627] ipam_block_reader_writer.go 167: Successfully created pending affinity for block host="worker01" subnet=fd01:0:0:f78a::/64
2020-11-25 22:26:05.187 [INFO][29627] ipam.go 140: Attempting to load block cidr=fd01:0:0:f78a::/64 host="worker01"
2020-11-25 22:26:05.189 [INFO][29627] ipam.go 145: The referenced block doesn't exist, trying to create it cidr=fd01:0:0:f78a::/64 host="worker01"
2020-11-25 22:26:05.193 [INFO][29627] ipam.go 152: Wrote affinity as pending cidr=fd01:0:0:f78a::/64 host="worker01"
2020-11-25 22:26:05.194 [INFO][29627] ipam.go 161: Attempting to claim the block cidr=fd01:0:0:f78a::/64 host="worker01"
2020-11-25 22:26:05.194 [INFO][29627] ipam_block_reader_writer.go 189: Attempting to create a new block host="worker01" subnet=fd01:0:0:f78a::/64
2020-11-25 22:26:05.197 [INFO][29627] ipam_block_reader_writer.go 230: Successfully created block
2020-11-25 22:26:05.197 [INFO][29627] ipam_block_reader_writer.go 241: Confirming affinity host="worker01" subnet=fd01:0:0:f78a::/64
2020-11-25 22:26:05.202 [INFO][29627] ipam_block_reader_writer.go 256: Successfully confirmed affinity host="worker01" subnet=fd01:0:0:f78a::/64
2020-11-25 22:26:05.202 [ERROR][29627] ipam.go 530: Block 'fd01:0:0:f78a::/64' has 0 free ips which is less than 1 ips required. host="worker01" subnet=fd01:0:0:f78a::/64
2020-11-25 22:26:05.202 [ERROR][29627] ipam.go 121: Error assigning IPV6 addresses: Block 'fd01:0:0:f78a::/64' has 0 free ips which is less than 1 ips required.

Possible Solution

Stop storing unallocated addresses in IPAMBlock (it’ll be a mess in IPv6) and compute NumFreeAddresses with something like subnet size - allocated IP addresses.

Steps to Reproduce (for bugs)

  1. Spin a dual-stack k8s cluster
  2. Create a pod
  3. ???
  4. Profit

Context

Your Environment

  • libcalico-go version: Don’t know, but I’m using the calico/node:v3.16.4 image.
  • Operating System and version: Debian

コントリビューターガイド