Skip to content

Commit

Permalink
Set FELIX_CHAININSERTMODE default to "append"
Browse files Browse the repository at this point in the history
  • Loading branch information
Ciprian Hacman committed Apr 3, 2020
1 parent ec42233 commit ba6aed0
Show file tree
Hide file tree
Showing 18 changed files with 69 additions and 15 deletions.
2 changes: 1 addition & 1 deletion cmd/kops/create_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ func (o *CreateClusterOptions) InitDefaults() {
o.Yes = false
o.Target = cloudup.TargetDirect
o.Models = strings.Join(cloudup.CloudupModels, ",")
o.Networking = "kubenet"
o.Networking = "calico"
o.Channel = api.DefaultChannel
o.Topology = api.TopologyPublic
o.DNSType = string(api.DNSTypePublic)
Expand Down
2 changes: 1 addition & 1 deletion docs/cli/kops_create_cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ kops create cluster [flags]
--master-zones strings Zones in which to run masters (must be an odd number)
--model string Models to apply (separate multiple models with commas) (default "proto,cloudup")
--network-cidr string Set to override the default network CIDR
--networking string Networking mode to use. kubenet (default), classic, external, kopeio-vxlan (or kopeio), weave, flannel-vxlan (or flannel), flannel-udp, calico, canal, kube-router, romana, amazon-vpc-routed-eni, cilium, cni. (default "kubenet")
--networking string Networking mode to use. kubenet (default), classic, external, kopeio-vxlan (or kopeio), weave, flannel-vxlan (or flannel), flannel-udp, calico, canal, kube-router, romana, amazon-vpc-routed-eni, cilium, cni. (default "calico")
--node-count int32 Set the number of nodes
--node-security-groups strings Add precreated additional security groups to nodes.
--node-size string Set instance size for nodes
Expand Down
9 changes: 9 additions & 0 deletions k8s/crds/kops.k8s.io_clusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2490,7 +2490,16 @@ 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
crossSubnet:
description: CrossSubnet enables Calico's cross-subnet mode
when set to true
type: boolean
ipipMode:
description: IPIPMode is mode for CALICO_IPV4POOL_IPIP
Expand Down
7 changes: 6 additions & 1 deletion pkg/apis/kops/networking.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,12 @@ type FlannelNetworkingSpec struct {

// CalicoNetworkingSpec declares that we want Calico networking
type CalicoNetworkingSpec struct {
CrossSubnet bool `json:"crossSubnet,omitempty"` // Enables Calico's cross-subnet mode when set to true
// 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"`
// CrossSubnet enables Calico's cross-subnet mode when set to true
CrossSubnet bool `json:"crossSubnet,omitempty"`
// LogSeverityScreen lets us set the desired log level. (Default: info)
LogSeverityScreen string `json:"logSeverityScreen,omitempty"`
// MTU to be set in the cni-network-config for calico.
Expand Down
7 changes: 6 additions & 1 deletion pkg/apis/kops/v1alpha2/networking.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,12 @@ type FlannelNetworkingSpec struct {

// CalicoNetworkingSpec declares that we want Calico networking
type CalicoNetworkingSpec struct {
CrossSubnet bool `json:"crossSubnet,omitempty"` // Enables Calico's cross-subnet mode when set to true
// 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"`
// CrossSubnet enables Calico's cross-subnet mode when set to true
CrossSubnet bool `json:"crossSubnet,omitempty"`
// LogSeverityScreen lets us set the desired log level. (Default: info)
LogSeverityScreen string `json:"logSeverityScreen,omitempty"`
// MTU to be set in the cni-network-config for calico.
Expand Down
2 changes: 2 additions & 0 deletions pkg/apis/kops/v1alpha2/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ spec:
name: a
memoryRequest: 100Mi
name: main
version: 3.2.24
- cpuRequest: 100m
etcdMembers:
- instanceGroup: master-us-test-1a
name: a
memoryRequest: 100Mi
name: events
version: 3.2.24
iam:
allowContainerRegistry: true
legacy: false
Expand All @@ -36,7 +38,8 @@ spec:
masterPublicName: api.complex.example.com
networkCIDR: 172.20.0.0/16
networking:
kubenet: {}
calico:
majorVersion: v3
nonMasqueradeCIDR: 100.64.0.0/10
sshAccess:
- 1.2.3.4/32
Expand Down
5 changes: 4 additions & 1 deletion tests/integration/create_cluster/ha/expected-v1alpha2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ spec:
name: c
memoryRequest: 100Mi
name: main
version: 3.2.24
- cpuRequest: 100m
etcdMembers:
- instanceGroup: master-us-test-1a
Expand All @@ -33,6 +34,7 @@ spec:
name: c
memoryRequest: 100Mi
name: events
version: 3.2.24
iam:
allowContainerRegistry: true
legacy: false
Expand All @@ -44,7 +46,8 @@ spec:
masterPublicName: api.ha.example.com
networkCIDR: 172.20.0.0/16
networking:
kubenet: {}
calico:
majorVersion: v3
nonMasqueradeCIDR: 100.64.0.0/10
sshAccess:
- 0.0.0.0/0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ spec:
name: c
memoryRequest: 100Mi
name: main
version: 3.2.24
- cpuRequest: 100m
etcdMembers:
- encryptedVolume: true
Expand All @@ -39,6 +40,7 @@ spec:
name: c
memoryRequest: 100Mi
name: events
version: 3.2.24
iam:
allowContainerRegistry: true
legacy: false
Expand All @@ -50,7 +52,8 @@ spec:
masterPublicName: api.ha.example.com
networkCIDR: 172.20.0.0/16
networking:
kubenet: {}
calico:
majorVersion: v3
nonMasqueradeCIDR: 100.64.0.0/10
sshAccess:
- 0.0.0.0/0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ spec:
name: c
memoryRequest: 100Mi
name: main
version: 3.2.24
- cpuRequest: 100m
etcdMembers:
- instanceGroup: master-us-test1-a
Expand All @@ -33,6 +34,7 @@ spec:
name: c
memoryRequest: 100Mi
name: events
version: 3.2.24
iam:
allowContainerRegistry: true
legacy: false
Expand All @@ -43,7 +45,8 @@ spec:
kubernetesVersion: v1.15.6-beta.1
masterPublicName: api.ha-gce.example.com
networking:
kubenet: {}
calico:
majorVersion: v3
nonMasqueradeCIDR: 100.64.0.0/10
project: testproject
sshAccess:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ spec:
name: a-3
memoryRequest: 100Mi
name: main
version: 3.2.24
- cpuRequest: 100m
etcdMembers:
- instanceGroup: master-us-test-1a-1
Expand All @@ -41,6 +42,7 @@ spec:
name: a-3
memoryRequest: 100Mi
name: events
version: 3.2.24
iam:
allowContainerRegistry: true
legacy: false
Expand All @@ -52,7 +54,8 @@ spec:
masterPublicName: api.ha.example.com
networkCIDR: 172.20.0.0/16
networking:
kubenet: {}
calico:
majorVersion: v3
nonMasqueradeCIDR: 100.64.0.0/10
sshAccess:
- 0.0.0.0/0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ spec:
name: a
memoryRequest: 100Mi
name: main
version: 3.2.24
- cpuRequest: 100m
etcdMembers:
- instanceGroup: master-us-test-1a
name: a
memoryRequest: 100Mi
name: events
version: 3.2.24
iam:
allowContainerRegistry: true
legacy: false
Expand All @@ -36,7 +38,8 @@ spec:
masterPublicName: api.minimal.example.com
networkCIDR: 172.20.0.0/16
networking:
kubenet: {}
calico:
majorVersion: v3
nonMasqueradeCIDR: 100.64.0.0/10
sshAccess:
- 0.0.0.0/0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ spec:
name: a
memoryRequest: 100Mi
name: main
version: 3.2.24
- cpuRequest: 100m
etcdMembers:
- instanceGroup: master-us-test-1a
name: a
memoryRequest: 100Mi
name: events
version: 3.2.24
iam:
allowContainerRegistry: true
legacy: false
Expand All @@ -36,7 +38,8 @@ spec:
masterPublicName: api.overrides.example.com
networkCIDR: 172.20.0.0/16
networking:
kubenet: {}
calico:
majorVersion: v3
nodePortAccess:
- 1.2.3.4/32
- 10.20.30.0/24
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ spec:
name: a
memoryRequest: 100Mi
name: main
version: 3.2.24
- cpuRequest: 100m
etcdMembers:
- instanceGroup: master-us-test-1a
name: a
memoryRequest: 100Mi
name: events
version: 3.2.24
iam:
allowContainerRegistry: true
legacy: false
Expand All @@ -37,7 +39,8 @@ spec:
networkCIDR: 10.0.0.0/12
networkID: vpc-12345678
networking:
kubenet: {}
calico:
majorVersion: v3
nonMasqueradeCIDR: 100.64.0.0/10
sshAccess:
- 0.0.0.0/0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ spec:
name: a
memoryRequest: 100Mi
name: main
version: 3.2.24
- cpuRequest: 100m
etcdMembers:
- instanceGroup: master-us-test-1a
name: a
memoryRequest: 100Mi
name: events
version: 3.2.24
iam:
allowContainerRegistry: true
legacy: false
Expand All @@ -37,7 +39,8 @@ spec:
networkCIDR: 10.0.0.0/12
networkID: vpc-12345678
networking:
kubenet: {}
calico:
majorVersion: v3
nonMasqueradeCIDR: 100.64.0.0/10
sshAccess:
- 0.0.0.0/0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ spec:
name: a
memoryRequest: 100Mi
name: main
version: 3.2.24
- cpuRequest: 100m
etcdMembers:
- instanceGroup: master-us-test-1a
name: a
memoryRequest: 100Mi
name: events
version: 3.2.24
iam:
allowContainerRegistry: true
legacy: false
Expand All @@ -37,7 +39,8 @@ spec:
networkCIDR: 10.0.0.0/12
networkID: vpc-12345678
networking:
kubenet: {}
calico:
majorVersion: v3
nonMasqueradeCIDR: 100.64.0.0/10
sshAccess:
- 0.0.0.0/0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,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 "append" }}"
# Set Felix iptables binary variant, Legacy or NFT
- name: FELIX_IPTABLESBACKEND
value: "{{- or .Networking.Calico.IptablesBackend "Auto" }}"
Expand Down
2 changes: 1 addition & 1 deletion upup/pkg/fi/cloudup/bootstrapchannelbuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ func (b *BootstrapChannelBuilder) buildAddons() *channelsapi.Addons {
"k8s-1.7": "2.6.12-kops.1",
"k8s-1.7-v3": "3.8.0-kops.2",
"k8s-1.12": "3.9.5-kops.1",
"k8s-1.16": "3.12.0-kops.1",
"k8s-1.16": "3.12.0-kops.2",
}

{
Expand Down

0 comments on commit ba6aed0

Please sign in to comment.