Support ChainInsertMode config option for Calico Networking

This commit is contained in:
Adam Smith 2020-09-15 15:53:14 +01:00
parent ecac8c5f14
commit 2fb1a4ecd2
8 changed files with 25 additions and 1 deletions

View File

@ -2116,6 +2116,9 @@ spec:
calico:
description: CalicoNetworkingSpec declares that we want Calico networking
properties:
chainInsertMode:
description: 'ChainInsertMode controls whether Felix inserts rules to the top of iptables chains, or appends to the bottom. Leaving the default option is safest to prevent accidentally breaking connectivity. Default: ''insert'' (other options: ''append'')'
type: string
cpuRequest:
anyOf:
- type: integer

View File

@ -100,6 +100,10 @@ type FlannelNetworkingSpec struct {
// CalicoNetworkingSpec declares that we want Calico networking
type CalicoNetworkingSpec struct {
// ChainInsertMode controls whether Felix inserts rules to the top of iptables chains, or
// appends to the bottom. Leaving the default option is safest to prevent accidentally
// breaking connectivity. Default: 'insert' (other options: 'append')
ChainInsertMode string `json:"chainInsertMode,omitempty"`
// CPURequest CPU request of Calico container. Default: 100m
CPURequest *resource.Quantity `json:"cpuRequest,omitempty"`
// CrossSubnet enables Calico's cross-subnet mode when set to true

View File

@ -100,6 +100,10 @@ type FlannelNetworkingSpec struct {
// CalicoNetworkingSpec declares that we want Calico networking
type CalicoNetworkingSpec struct {
// ChainInsertMode controls whether Felix inserts rules to the top of iptables chains, or
// appends to the bottom. Leaving the default option is safest to prevent accidentally
// breaking connectivity. Default: 'insert' (other options: 'append')
ChainInsertMode string `json:"chainInsertMode,omitempty"`
// CPURequest CPU request of Calico container. Default: 100m
CPURequest *resource.Quantity `json:"cpuRequest,omitempty"`
// CrossSubnet enables Calico's cross-subnet mode when set to true

View File

@ -1305,6 +1305,7 @@ func Convert_kops_CNINetworkingSpec_To_v1alpha2_CNINetworkingSpec(in *kops.CNINe
}
func autoConvert_v1alpha2_CalicoNetworkingSpec_To_kops_CalicoNetworkingSpec(in *CalicoNetworkingSpec, out *kops.CalicoNetworkingSpec, s conversion.Scope) error {
out.ChainInsertMode = in.ChainInsertMode
out.CPURequest = in.CPURequest
out.CrossSubnet = in.CrossSubnet
out.LogSeverityScreen = in.LogSeverityScreen
@ -1330,6 +1331,7 @@ func Convert_v1alpha2_CalicoNetworkingSpec_To_kops_CalicoNetworkingSpec(in *Cali
}
func autoConvert_kops_CalicoNetworkingSpec_To_v1alpha2_CalicoNetworkingSpec(in *kops.CalicoNetworkingSpec, out *CalicoNetworkingSpec, s conversion.Scope) error {
out.ChainInsertMode = in.ChainInsertMode
out.CPURequest = in.CPURequest
out.CrossSubnet = in.CrossSubnet
out.LogSeverityScreen = in.LogSeverityScreen

View File

@ -957,6 +957,11 @@ func validateNetworkingCalico(v *kops.CalicoNetworkingSpec, e kops.EtcdClusterSp
}
}
if v.ChainInsertMode != "" {
valid := []string{"insert", "append"}
allErrs = append(allErrs, IsValidValue(fldPath.Child("chainInsertMode"), &v.ChainInsertMode, valid)...)
}
if v.IptablesBackend != "" {
valid := []string{"Auto", "Legacy", "NFT"}
allErrs = append(allErrs, IsValidValue(fldPath.Child("iptablesBackend"), &v.IptablesBackend, valid)...)

View File

@ -12837,6 +12837,9 @@ spec:
value: "true"
# kops additions
# Controls whether Felix inserts rules to the top of iptables chains, or appends to the bottom
- name: FELIX_CHAININSERTMODE
value: "{{- or .Networking.Calico.ChainInsertMode "insert" }}"
# Set Felix iptables binary variant, Legacy or NFT
- name: FELIX_IPTABLESBACKEND
value: "{{- or .Networking.Calico.IptablesBackend "Auto" }}"

View File

@ -3875,6 +3875,9 @@ spec:
value: "true"
# kops additions
# Controls whether Felix inserts rules to the top of iptables chains, or appends to the bottom
- name: FELIX_CHAININSERTMODE
value: "{{- or .Networking.Calico.ChainInsertMode "insert" }}"
# Set Felix iptables binary variant, Legacy or NFT
- name: FELIX_IPTABLESBACKEND
value: "{{- or .Networking.Calico.IptablesBackend "Auto" }}"

View File

@ -815,7 +815,7 @@ func (b *BootstrapChannelBuilder) buildAddons(c *fi.ModelBuilderContext) (*chann
"k8s-1.7": "2.6.12-kops.1",
"k8s-1.7-v3": "3.8.0-kops.2",
"k8s-1.12": "3.9.6-kops.1",
"k8s-1.16": "3.16.1-kops.1",
"k8s-1.16": "3.16.1-kops.2",
}
{