Skip to content

Commit

Permalink
feat: kubelet dualstack support
Browse files Browse the repository at this point in the history
Enable cloud Dual-Stack with --node-ip support since Kubernetes 1.29 release.

Signed-off-by: Serge Logvinov <serge.logvinov@sinextra.dev>
  • Loading branch information
sergelogvinov committed Feb 16, 2024
1 parent de55986 commit a752d10
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/proxmox/instances.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,12 @@ func (i *instances) InstanceMetadata(_ context.Context, node *v1.Node) (*cloudpr
}
}

addresses := []v1.NodeAddress{{Type: v1.NodeInternalIP, Address: providedIP}}
addresses := []v1.NodeAddress{}

for _, ip := range strings.Split(providedIP, ",") {
addresses = append(addresses, v1.NodeAddress{Type: v1.NodeInternalIP, Address: ip})
}

addresses = append(addresses, v1.NodeAddress{Type: v1.NodeHostName, Address: node.Name})

instanceType, err := i.getInstanceType(vmRef, region)
Expand Down
31 changes: 31 additions & 0 deletions pkg/proxmox/instances_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,37 @@ func (ts *ccmTestSuite) TestInstanceMetadata() {
Zone: "pve-1",
},
},
{
msg: "NodeExistsDualstack",
node: &v1.Node{
ObjectMeta: metav1.ObjectMeta{
Name: "cluster-1-node-1",
Annotations: map[string]string{
cloudproviderapi.AnnotationAlphaProvidedIPAddr: "1.2.3.4,2001::1",
},
},
},
expected: &cloudprovider.InstanceMetadata{
ProviderID: "proxmox://cluster-1/100",
NodeAddresses: []v1.NodeAddress{
{
Type: v1.NodeInternalIP,
Address: "1.2.3.4",
},
{
Type: v1.NodeInternalIP,
Address: "2001::1",
},
{
Type: v1.NodeHostName,
Address: "cluster-1-node-1",
},
},
InstanceType: "4VCPU-10GB",
Region: "cluster-1",
Zone: "pve-1",
},
},
{
msg: "NodeExistsCluster2",
node: &v1.Node{
Expand Down

0 comments on commit a752d10

Please sign in to comment.