Skip to content

Commit ead0d6e

Browse files
author
Rahul Sharma
committed
add vpc support for capl clusters
1 parent 915bce5 commit ead0d6e

File tree

6 files changed

+58
-0
lines changed

6 files changed

+58
-0
lines changed

controller/linodemachine_controller.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,14 @@ func (r *LinodeMachineReconciler) reconcileCreate(
327327
return nil, err
328328
}
329329

330+
// add public interface to linode (eth0)
331+
iface := &linodego.InstanceConfigInterfaceCreateOptions{
332+
Purpose: linodego.InterfacePurposePublic,
333+
Primary: true,
334+
}
335+
createOpts.Interfaces = append(createOpts.Interfaces, *iface)
336+
337+
// if vpc, attach additional interface to linode (eth1)
330338
if machineScope.LinodeCluster.Spec.VPCRef != nil {
331339
iface, err := r.getVPCInterfaceConfig(ctx, machineScope, createOpts.Interfaces, logger)
332340
if err != nil {

templates/addons/cilium/cilium.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,17 @@ spec:
1515
wait: true
1616
timeout: 5m
1717
valuesTemplate: |
18+
routingMode: native
19+
kubeProxyReplacement: true
20+
ipv4NativeRoutingCIDR: 10.0.0.0/8
21+
tunnelProtocol: ""
22+
enableIPv4Masquerade: true
1823
ipam:
1924
mode: kubernetes
25+
ipv4:
26+
enabled: true
27+
ipv6:
28+
enabled: false
2029
k8s:
2130
requireIPv4PodCIDR: true
2231
hubble:

templates/flavors/base/kustomization.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1
22
kind: Kustomization
33
resources:
44
- cluster.yaml
5+
- linodeVPC.yaml
56
- linodeCluster.yaml
67
- linodeMachineTemplate.yaml
78
- machineDeployment.yaml

templates/flavors/base/linodeCluster.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,8 @@ metadata:
55
name: ${CLUSTER_NAME}
66
spec:
77
region: ${LINODE_REGION}
8+
vpcRef:
9+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
10+
kind: LinodeVPC
11+
name: vpc-${CLUSTER_NAME}
12+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
3+
kind: LinodeVPC
4+
metadata:
5+
name: vpc-${CLUSTER_NAME}
6+
spec:
7+
region: ${LINODE_REGION}
8+
subnets:
9+
- ipv4: 10.0.0.0/8
10+
label: default
11+

templates/flavors/rke2/rke2ControlPlane.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,30 @@ spec:
2121
name: linode-${CLUSTER_NAME}-crs-0
2222
owner: root:root
2323
path: /var/lib/rancher/rke2/server/manifests/linode-token-region.yaml
24+
- path: /var/lib/rancher/rke2/server/manifests/rke2-cilium-config.yaml
25+
owner: root:root
26+
permissions: "0640"
27+
content: |
28+
apiVersion: helm.cattle.io/v1
29+
kind: HelmChartConfig
30+
metadata:
31+
name: rke2-cilium
32+
namespace: kube-system
33+
spec:
34+
valuesContent: |-
35+
routingMode: native
36+
kubeProxyReplacement: true
37+
ipv4NativeRoutingCIDR: 10.0.0.0/8
38+
tunnelProtocol: ""
39+
enableIPv4Masquerade: true
40+
ipam:
41+
mode: kubernetes
42+
ipv4:
43+
enabled: true
44+
ipv6:
45+
enabled: false
46+
k8s:
47+
requireIPv4PodCIDR: true
2448
serverConfig:
2549
cni: cilium
2650
cloudProviderName: external

0 commit comments

Comments
 (0)