Skip to content

Commit 49caeb9

Browse files
committed
Add multi shoot
1 parent 032632b commit 49caeb9

1 file changed

Lines changed: 24 additions & 4 deletions

File tree

pkg/controller/infrastructure/actuator_reconcile.go

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,23 +108,43 @@ func (a *actuator) applyPrefixes(ctx context.Context, ironcoreClient client.Clie
108108
var servicePrefix *ipamv1alpha1.Prefix
109109
if slices.Contains(cluster.Shoot.Spec.Networking.IPFamilies, v1beta1.IPFamilyIPv6) {
110110
// TODO: Get overlay IPv6 Block from Malte
111-
nodesIPV6Prefix, err := netip.ParsePrefix("2a10:afc0:e010:cafe::/64")
111+
rootPrefix, err := netip.ParsePrefix("2a10:afc0:e010:cafe::/64")
112112
if err != nil {
113113
return nil, nil, fmt.Errorf("failed to parse IPv6 prefix: %w", err)
114114
}
115-
prefixIPV6 := &ipamv1alpha1.Prefix{
115+
rootPrefixIPv6 := &ipamv1alpha1.Prefix{
116116
TypeMeta: metav1.TypeMeta{
117117
Kind: "Prefix",
118118
APIVersion: "ipam.ironcore.dev/v1alpha1",
119119
},
120120
ObjectMeta: metav1.ObjectMeta{
121121
Namespace: namespace,
122-
Name: generateResourceNameFromCluster(cluster) + "-v6",
122+
Name: "root-prefix-v6-all-shoots",
123123
},
124124
Spec: ipamv1alpha1.PrefixSpec{
125125
IPFamily: corev1.IPv6Protocol,
126126
Prefix: &commonv1alpha1.IPPrefix{
127-
Prefix: nodesIPV6Prefix,
127+
Prefix: rootPrefix,
128+
},
129+
},
130+
}
131+
if _, err := controllerutil.CreateOrPatch(ctx, ironcoreClient, rootPrefixIPv6, nil); err != nil {
132+
return nil, nil, fmt.Errorf("failed to apply root prefix %s: %w", client.ObjectKeyFromObject(rootPrefixIPv6), err)
133+
}
134+
prefixIPV6 := &ipamv1alpha1.Prefix{
135+
TypeMeta: metav1.TypeMeta{
136+
Kind: "Prefix",
137+
APIVersion: "ipam.ironcore.dev/v1alpha1",
138+
},
139+
ObjectMeta: metav1.ObjectMeta{
140+
Namespace: namespace,
141+
Name: generateResourceNameFromCluster(cluster) + "-v6",
142+
},
143+
Spec: ipamv1alpha1.PrefixSpec{
144+
IPFamily: corev1.IPv6Protocol,
145+
PrefixLength: 96,
146+
ParentRef: &corev1.LocalObjectReference{
147+
Name: rootPrefixIPv6.Name,
128148
},
129149
},
130150
}

0 commit comments

Comments
 (0)