Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Add Cilium as CNI Option #1346

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 122 additions & 0 deletions pkg/cloud/services/networking/securitygroups_rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,66 @@ func getSGControlPlaneCalico(remoteGroupIDSelf, secWorkerGroupID string) []infra
}
}

// Permit traffic for cilium.
func getSGControlPlaneCilium(remoteGroupIDSelf, secWorkerGroupID string) []infrav1.SecurityGroupRule {
return []infrav1.SecurityGroupRule{
{
Description: "HealthChecks (cilium)",
Direction: "ingress",
EtherType: "IPv4",
PortRangeMin: 4240,
PortRangeMax: 4240,
Protocol: "tcp",
RemoteGroupID: remoteGroupIDSelf,
},
{
Description: "HealthChecks (cilium)",
Direction: "ingress",
EtherType: "IPv4",
PortRangeMin: 4240,
PortRangeMax: 4240,
Protocol: "tcp",
RemoteGroupID: secWorkerGroupID,
},
{
Description: "VXLAN (cilium)",
Direction: "ingress",
EtherType: "IPv4",
PortRangeMin: 8472,
PortRangeMax: 8472,
Protocol: "udp",
RemoteGroupID: remoteGroupIDSelf,
},
{
Description: "VXLAN (cilium)",
Direction: "ingress",
EtherType: "IPv4",
PortRangeMin: 8472,
PortRangeMax: 8472,
Protocol: "udp",
RemoteGroupID: secWorkerGroupID,
},
{
Description: "ICMP HealthCheck (cilium)",
Direction: "ingress",
EtherType: "IPv4",
PortRangeMin: 8,
PortRangeMax: 0,
Protocol: "icmp",
RemoteGroupID: remoteGroupIDSelf,
},
{
Description: "ICMP HealthCheck (cilium)",
Direction: "ingress",
EtherType: "IPv4",
PortRangeMin: 8,
PortRangeMax: 0,
Protocol: "icmp",
RemoteGroupID: secWorkerGroupID,
},
}
}

// Permit traffic for kubelet.
func getSGWorkerCommon(remoteGroupIDSelf, secControlPlaneGroupID string) []infrav1.SecurityGroupRule {
return []infrav1.SecurityGroupRule{
Expand Down Expand Up @@ -177,6 +237,66 @@ func getSGWorkerCalico(remoteGroupIDSelf, secControlPlaneGroupID string) []infra
}
}

// Permit traffic for cilium.
func getSGWorkerCilium(remoteGroupIDSelf, secControlPlaneGroupID string) []infrav1.SecurityGroupRule {
return []infrav1.SecurityGroupRule{
{
Description: "HealthChecks (cilium)",
Direction: "ingress",
EtherType: "IPv4",
PortRangeMin: 4240,
PortRangeMax: 4240,
Protocol: "tcp",
RemoteGroupID: remoteGroupIDSelf,
},
{
Description: "HealthChecks (cilium)",
Direction: "ingress",
EtherType: "IPv4",
PortRangeMin: 4240,
PortRangeMax: 4240,
Protocol: "tcp",
RemoteGroupID: secControlPlaneGroupID,
},
{
Description: "VXLAN (cilium)",
Direction: "ingress",
EtherType: "IPv4",
PortRangeMin: 8472,
PortRangeMax: 8472,
Protocol: "udp",
RemoteGroupID: remoteGroupIDSelf,
},
{
Description: "VXLAN (cilium)",
Direction: "ingress",
EtherType: "IPv4",
PortRangeMin: 8472,
PortRangeMax: 8472,
Protocol: "udp",
RemoteGroupID: secControlPlaneGroupID,
},
{
Description: "ICMP HealthCheck (cilium)",
Direction: "ingress",
EtherType: "IPv4",
PortRangeMin: 8,
PortRangeMax: 0,
Protocol: "icmp",
RemoteGroupID: remoteGroupIDSelf,
},
{
Description: "ICMP HealthCheck (cilium)",
Direction: "ingress",
EtherType: "IPv4",
PortRangeMin: 8,
PortRangeMax: 0,
Protocol: "icmp",
RemoteGroupID: secControlPlaneGroupID,
},
}
}

// Permit traffic for ssh control plane.
func GetSGControlPlaneSSH(secBastionGroupID string) []infrav1.SecurityGroupRule {
return []infrav1.SecurityGroupRule{
Expand Down Expand Up @@ -287,12 +407,14 @@ func GetSGControlPlaneGeneral(remoteGroupIDSelf, secWorkerGroupID string) []infr
controlPlaneRules := []infrav1.SecurityGroupRule{}
controlPlaneRules = append(controlPlaneRules, getSGControlPlaneCommon(remoteGroupIDSelf, secWorkerGroupID)...)
controlPlaneRules = append(controlPlaneRules, getSGControlPlaneCalico(remoteGroupIDSelf, secWorkerGroupID)...)
controlPlaneRules = append(controlPlaneRules, getSGControlPlaneCilium(remoteGroupIDSelf, secWorkerGroupID)...)
return controlPlaneRules
}

func GetSGWorkerGeneral(remoteGroupIDSelf, secControlPlaneGroupID string) []infrav1.SecurityGroupRule {
workerRules := []infrav1.SecurityGroupRule{}
workerRules = append(workerRules, getSGWorkerCommon(remoteGroupIDSelf, secControlPlaneGroupID)...)
workerRules = append(workerRules, getSGWorkerCalico(remoteGroupIDSelf, secControlPlaneGroupID)...)
workerRules = append(workerRules, getSGWorkerCilium(remoteGroupIDSelf, secControlPlaneGroupID)...)
return workerRules
}