mirror of https://github.com/kubernetes/kops.git
Cilium: disable masquerade by default when in ENI IPAM mode
This commit is contained in:
parent
b29c612b9c
commit
3cf8234d01
|
@ -103,11 +103,19 @@ kops rolling-update cluster --yes
|
|||
|
||||
### Enabling Cilium ENI IPAM
|
||||
|
||||
This feature is in beta state as of kOps 1.18.
|
||||
{{ kops_feature_table(kops_added_default='1.18') }}
|
||||
|
||||
As of kOps 1.18, you can have Cilium provision AWS managed addresses and attach them directly to Pods much like Lyft VPC and AWS VPC. See [the Cilium docs for more information](https://docs.cilium.io/en/v1.6/concepts/ipam/eni/)
|
||||
This feature is in beta state.
|
||||
|
||||
When using ENI IPAM you need to disable masquerading in Cilium as well.
|
||||
You can have Cilium provision AWS managed addresses and attach them directly to Pods much like Lyft VPC and AWS VPC. See [the Cilium docs for more information](https://docs.cilium.io/en/v1.6/concepts/ipam/eni/)
|
||||
|
||||
```yaml
|
||||
networking:
|
||||
cilium:
|
||||
ipam: eni
|
||||
```
|
||||
|
||||
In kOps versions before 1.22, when using ENI IPAM you need to explicitly disable masquerading in Cilium as well.
|
||||
|
||||
```yaml
|
||||
networking:
|
||||
|
|
|
@ -396,7 +396,7 @@ type CiliumNetworkingSpec struct {
|
|||
// Setting this has no effect.
|
||||
LogstashProbeTimer uint32 `json:"logstashProbeTimer,omitempty"`
|
||||
// DisableMasquerade disables masquerading traffic to external destinations behind the node IP.
|
||||
DisableMasquerade bool `json:"disableMasquerade,omitempty"`
|
||||
DisableMasquerade *bool `json:"disableMasquerade,omitempty"`
|
||||
// Nat6Range is not implemented and may be removed in the future.
|
||||
// Setting this has no effect.
|
||||
Nat46Range string `json:"nat46Range,omitempty"`
|
||||
|
|
|
@ -394,7 +394,7 @@ type CiliumNetworkingSpec struct {
|
|||
// Setting this has no effect.
|
||||
LogstashProbeTimer uint32 `json:"logstashProbeTimer,omitempty"`
|
||||
// DisableMasquerade disables masquerading traffic to external destinations behind the node IP.
|
||||
DisableMasquerade bool `json:"disableMasquerade,omitempty"`
|
||||
DisableMasquerade *bool `json:"disableMasquerade,omitempty"`
|
||||
// Nat6Range is not implemented and may be removed in the future.
|
||||
// Setting this has no effect.
|
||||
Nat46Range string `json:"nat46Range,omitempty"`
|
||||
|
|
|
@ -531,6 +531,11 @@ func (in *CiliumNetworkingSpec) DeepCopyInto(out *CiliumNetworkingSpec) {
|
|||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
if in.DisableMasquerade != nil {
|
||||
in, out := &in.DisableMasquerade, &out.DisableMasquerade
|
||||
*out = new(bool)
|
||||
**out = **in
|
||||
}
|
||||
if in.EnableRemoteNodeIdentity != nil {
|
||||
in, out := &in.EnableRemoteNodeIdentity, &out.EnableRemoteNodeIdentity
|
||||
*out = new(bool)
|
||||
|
|
|
@ -855,7 +855,7 @@ func validateNetworkingCilium(cluster *kops.Cluster, v *kops.CiliumNetworkingSpe
|
|||
if c.CloudProvider != string(kops.CloudProviderAWS) {
|
||||
allErrs = append(allErrs, field.Forbidden(fldPath.Child("ipam"), "Cilum ENI IPAM is supported only in AWS"))
|
||||
}
|
||||
if !v.DisableMasquerade {
|
||||
if v.DisableMasquerade != nil && !*v.DisableMasquerade {
|
||||
allErrs = append(allErrs, field.Forbidden(fldPath.Child("disableMasquerade"), "Masquerade must be disabled when ENI IPAM is used"))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -790,7 +790,6 @@ func Test_Validate_Cilium(t *testing.T) {
|
|||
},
|
||||
{
|
||||
Cilium: kops.CiliumNetworkingSpec{
|
||||
DisableMasquerade: true,
|
||||
Ipam: "eni",
|
||||
},
|
||||
Spec: kops.ClusterSpec{
|
||||
|
@ -799,7 +798,7 @@ func Test_Validate_Cilium(t *testing.T) {
|
|||
},
|
||||
{
|
||||
Cilium: kops.CiliumNetworkingSpec{
|
||||
DisableMasquerade: true,
|
||||
DisableMasquerade: fi.Bool(true),
|
||||
Ipam: "eni",
|
||||
},
|
||||
Spec: kops.ClusterSpec{
|
||||
|
@ -814,6 +813,7 @@ func Test_Validate_Cilium(t *testing.T) {
|
|||
},
|
||||
{
|
||||
Cilium: kops.CiliumNetworkingSpec{
|
||||
DisableMasquerade: fi.Bool(false),
|
||||
Ipam: "eni",
|
||||
},
|
||||
Spec: kops.ClusterSpec{
|
||||
|
@ -823,7 +823,6 @@ func Test_Validate_Cilium(t *testing.T) {
|
|||
},
|
||||
{
|
||||
Cilium: kops.CiliumNetworkingSpec{
|
||||
DisableMasquerade: true,
|
||||
Ipam: "eni",
|
||||
},
|
||||
Spec: kops.ClusterSpec{
|
||||
|
|
|
@ -615,6 +615,11 @@ func (in *CiliumNetworkingSpec) DeepCopyInto(out *CiliumNetworkingSpec) {
|
|||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
if in.DisableMasquerade != nil {
|
||||
in, out := &in.DisableMasquerade, &out.DisableMasquerade
|
||||
*out = new(bool)
|
||||
**out = **in
|
||||
}
|
||||
if in.EnableRemoteNodeIdentity != nil {
|
||||
in, out := &in.EnableRemoteNodeIdentity, &out.EnableRemoteNodeIdentity
|
||||
*out = new(bool)
|
||||
|
|
|
@ -288,7 +288,7 @@ func TestSetClusterFields(t *testing.T) {
|
|||
Spec: kops.ClusterSpec{
|
||||
Networking: &kops.NetworkingSpec{
|
||||
Cilium: &kops.CiliumNetworkingSpec{
|
||||
DisableMasquerade: true,
|
||||
DisableMasquerade: fi.Bool(true),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -367,7 +367,7 @@ func TestSetCiliumFields(t *testing.T) {
|
|||
Cilium: &kops.CiliumNetworkingSpec{
|
||||
Ipam: "eni",
|
||||
EnableNodePort: true,
|
||||
DisableMasquerade: true,
|
||||
DisableMasquerade: fi.Bool(true),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
@ -85,6 +85,10 @@ func (b *CiliumOptionsBuilder) BuildOptions(o interface{}) error {
|
|||
}
|
||||
}
|
||||
|
||||
if c.DisableMasquerade == nil {
|
||||
c.DisableMasquerade = fi.Bool(c.Ipam == "eni")
|
||||
}
|
||||
|
||||
if c.Tunnel == "" {
|
||||
if c.Ipam == "eni" {
|
||||
c.Tunnel = "disabled"
|
||||
|
|
|
@ -149,7 +149,7 @@ data:
|
|||
# - auto (automatically detect the container runtime)
|
||||
#
|
||||
container-runtime: "{{ .ContainerRuntimeLabels }}"
|
||||
masquerade: "{{- if .DisableMasquerade -}}false{{- else -}}true{{- end -}}"
|
||||
masquerade: "{{- if WithDefaultBool .DisableMasquerade false -}}false{{- else -}}true{{- end -}}"
|
||||
install-iptables-rules: "{{- if .IPTablesRulesNoinstall -}}false{{- else -}}true{{- end -}}"
|
||||
auto-direct-node-routes: "{{ .AutoDirectNodeRoutes }}"
|
||||
{{ if .EnableHostReachableServices }}
|
||||
|
|
|
@ -170,7 +170,7 @@ data:
|
|||
# - auto (automatically detect the container runtime)
|
||||
#
|
||||
container-runtime: "{{ .ContainerRuntimeLabels }}"
|
||||
masquerade: "{{- if .DisableMasquerade -}}false{{- else -}}true{{- end -}}"
|
||||
masquerade: "{{- if WithDefaultBool .DisableMasquerade false -}}false{{- else -}}true{{- end -}}"
|
||||
install-iptables-rules: "{{- if .IPTablesRulesNoinstall -}}false{{- else -}}true{{- end -}}"
|
||||
auto-direct-node-routes: "{{ .AutoDirectNodeRoutes }}"
|
||||
{{ if .EnableHostReachableServices }}
|
||||
|
|
|
@ -170,7 +170,7 @@ data:
|
|||
# - auto (automatically detect the container runtime)
|
||||
#
|
||||
container-runtime: "{{ .ContainerRuntimeLabels }}"
|
||||
masquerade: "{{- if .DisableMasquerade -}}false{{- else -}}true{{- end -}}"
|
||||
masquerade: "{{- if WithDefaultBool .DisableMasquerade false -}}false{{- else -}}true{{- end -}}"
|
||||
install-iptables-rules: "{{- if .IPTablesRulesNoinstall -}}false{{- else -}}true{{- end -}}"
|
||||
auto-direct-node-routes: "{{ .AutoDirectNodeRoutes }}"
|
||||
{{ if .EnableHostReachableServices }}
|
||||
|
|
Loading…
Reference in New Issue