Skip to content

Commit c9e666c

Browse files
committed
azure: Disable Calico encapsulation for pod traffic
Signed-off-by: Ciprian Hacman <[email protected]>
1 parent 86434c4 commit c9e666c

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

pkg/apis/kops/validation/validation.go

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1559,15 +1559,17 @@ func validateNetworkingCalico(c *kops.ClusterSpec, v *kops.CalicoNetworkingSpec,
15591559
valid := []string{"ipip", "vxlan", "none"}
15601560
allErrs = append(allErrs, IsValidValue(fldPath.Child("encapsulationMode"), &v.EncapsulationMode, valid)...)
15611561

1562-
if v.EncapsulationMode != "none" && c.IsIPv6Only() {
1563-
// IPv6 doesn't support encapsulation and kops only uses the "none" networking backend.
1564-
// The bird networking backend could also be added in the future if there's any valid use case.
1565-
allErrs = append(allErrs, field.Forbidden(fldPath.Child("encapsulationMode"), "IPv6 requires an encapsulationMode of \"none\""))
1566-
} else if v.EncapsulationMode == "none" && !c.IsIPv6Only() {
1567-
// Don't tolerate "None" for now, which would disable encapsulation in the default IPPool
1568-
// object. Note that with no encapsulation, we'd need to select the "bird" networking
1569-
// backend in order to allow use of BGP to distribute routes for pod traffic.
1570-
allErrs = append(allErrs, field.Forbidden(fldPath.Child("encapsulationMode"), "encapsulationMode \"none\" is only supported for IPv6 clusters"))
1562+
if c.CloudProvider.Azure == nil {
1563+
if v.EncapsulationMode != "none" && c.IsIPv6Only() {
1564+
// IPv6 doesn't support encapsulation and kops only uses the "none" networking backend.
1565+
// The bird networking backend could also be added in the future if there's any valid use case.
1566+
allErrs = append(allErrs, field.Forbidden(fldPath.Child("encapsulationMode"), "IPv6 requires an encapsulationMode of \"none\""))
1567+
} else if v.EncapsulationMode == "none" && !c.IsIPv6Only() {
1568+
// Don't tolerate "None" for now, which would disable encapsulation in the default IPPool
1569+
// object. Note that with no encapsulation, we'd need to select the "bird" networking
1570+
// backend in order to allow use of BGP to distribute routes for pod traffic.
1571+
allErrs = append(allErrs, field.Forbidden(fldPath.Child("encapsulationMode"), "encapsulationMode \"none\" is only supported for IPv6 clusters"))
1572+
}
15711573
}
15721574
}
15731575

pkg/model/components/calico.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ func (b *CalicoOptionsBuilder) BuildOptions(o *kops.Cluster) error {
3636
}
3737

3838
c.EncapsulationMode = "ipip"
39+
if o.GetCloudProvider() == kops.CloudProviderAzure {
40+
c.EncapsulationMode = "none"
41+
}
3942
if clusterSpec.IsIPv6Only() {
4043
c.EncapsulationMode = "none"
4144
}

0 commit comments

Comments
 (0)