Skip to content

Commit

Permalink
Don't disable AWS src/dst checks in Calico IPv6
Browse files Browse the repository at this point in the history
  • Loading branch information
johngmyers committed Nov 26, 2022
1 parent c634928 commit b6970c4
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 13 deletions.
4 changes: 2 additions & 2 deletions k8s/crds/kops.k8s.io_clusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4430,8 +4430,8 @@ spec:
type: boolean
awsSrcDstCheck:
description: 'AWSSrcDstCheck enables/disables ENI source/destination
checks (AWS only) Options: Disable (default), Enable, or
DoNothing'
checks (AWS only) Options: Disable (default for IPv4), Enable,
or DoNothing (default for IPv6)'
type: string
bpfEnabled:
description: BPFEnabled enables the eBPF dataplane mode.
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/kops/networking.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ type CalicoNetworkingSpec struct {
// (default: false)
AllowIPForwarding bool `json:"allowIPForwarding,omitempty"`
// AWSSrcDstCheck enables/disables ENI source/destination checks (AWS only)
// Options: Disable (default), Enable, or DoNothing
// Options: Disable (default for IPv4), Enable, or DoNothing (default for IPv6)
AWSSrcDstCheck string `json:"awsSrcDstCheck,omitempty"`
// BPFEnabled enables the eBPF dataplane mode.
BPFEnabled bool `json:"bpfEnabled,omitempty"`
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/kops/v1alpha2/networking.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ type CalicoNetworkingSpec struct {
// (default: false)
AllowIPForwarding bool `json:"allowIPForwarding,omitempty"`
// AWSSrcDstCheck enables/disables ENI source/destination checks (AWS only)
// Options: Disable (default), Enable, or DoNothing
// Options: Disable (default for IPv4), Enable, or DoNothing (default for IPv6)
AWSSrcDstCheck string `json:"awsSrcDstCheck,omitempty"`
// BPFEnabled enables the eBPF dataplane mode.
BPFEnabled bool `json:"bpfEnabled,omitempty"`
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/kops/v1alpha3/networking.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ type CalicoNetworkingSpec struct {
// (default: false)
AllowIPForwarding bool `json:"allowIPForwarding,omitempty"`
// AWSSrcDstCheck enables/disables ENI source/destination checks (AWS only)
// Options: Disable (default), Enable, or DoNothing
// Options: Disable (default for IPv4), Enable, or DoNothing (default for IPv6)
AWSSrcDstCheck string `json:"awsSrcDstCheck,omitempty"`
// BPFEnabled enables the eBPF dataplane mode.
BPFEnabled bool `json:"bpfEnabled,omitempty"`
Expand Down
6 changes: 3 additions & 3 deletions pkg/model/iam/iam_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ func (r *NodeRoleAPIServer) BuildAWSPolicy(b *PolicyBuilder) (*Policy, error) {
addCiliumEniPermissions(p)
}

if b.Cluster.Spec.Networking != nil && b.Cluster.Spec.Networking.Calico != nil && b.Cluster.Spec.Networking.Calico.AWSSrcDstCheck != "DoNothing" {
if b.Cluster.Spec.Networking != nil && b.Cluster.Spec.Networking.Calico != nil && b.Cluster.Spec.Networking.Calico.AWSSrcDstCheck != "DoNothing" && (!b.Cluster.Spec.IsIPv6Only() || b.Cluster.Spec.Networking.Calico.AWSSrcDstCheck != "") {
addCalicoSrcDstCheckPermissions(p)
}

Expand Down Expand Up @@ -452,7 +452,7 @@ func (r *NodeRoleMaster) BuildAWSPolicy(b *PolicyBuilder) (*Policy, error) {
addCiliumEniPermissions(p)
}

if b.Cluster.Spec.Networking != nil && b.Cluster.Spec.Networking.Calico != nil && b.Cluster.Spec.Networking.Calico.AWSSrcDstCheck != "DoNothing" {
if b.Cluster.Spec.Networking != nil && b.Cluster.Spec.Networking.Calico != nil && b.Cluster.Spec.Networking.Calico.AWSSrcDstCheck != "DoNothing" && (!b.Cluster.Spec.IsIPv6Only() || b.Cluster.Spec.Networking.Calico.AWSSrcDstCheck != "") {
addCalicoSrcDstCheckPermissions(p)
}

Expand All @@ -478,7 +478,7 @@ func (r *NodeRoleNode) BuildAWSPolicy(b *PolicyBuilder) (*Policy, error) {
addAmazonVPCCNIPermissions(p)
}

if b.Cluster.Spec.Networking != nil && b.Cluster.Spec.Networking.Calico != nil && b.Cluster.Spec.Networking.Calico.AWSSrcDstCheck != "DoNothing" {
if b.Cluster.Spec.Networking != nil && b.Cluster.Spec.Networking.Calico != nil && b.Cluster.Spec.Networking.Calico.AWSSrcDstCheck != "DoNothing" && (!b.Cluster.Spec.IsIPv6Only() || b.Cluster.Spec.Networking.Calico.AWSSrcDstCheck != "") {
addCalicoSrcDstCheckPermissions(p)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@
"ec2:DescribeVolumes",
"ec2:DescribeVolumesModifications",
"ec2:DescribeVpcs",
"ec2:ModifyNetworkInterfaceAttribute",
"elasticloadbalancing:DescribeListeners",
"elasticloadbalancing:DescribeLoadBalancerAttributes",
"elasticloadbalancing:DescribeLoadBalancerPolicies",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"ec2:DescribeInstanceTypes",
"ec2:DescribeInstances",
"ec2:DescribeRegions",
"ec2:ModifyNetworkInterfaceAttribute",
"iam:GetServerCertificate",
"iam:ListServerCertificates",
"kms:GenerateRandom"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ spec:
version: 9.99.0
- id: k8s-1.25
manifest: networking.projectcalico.org/k8s-1.25.yaml
manifestHash: decc34a7f133bfc9bed78456047eccd399a67a4e17c49259e06f487a4b74092e
manifestHash: 87046f7e66df6437ddf0a74ce7871dad02e0961a4a47c36a0fd6fff6434aac41
name: networking.projectcalico.org
prune:
kinds:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4547,7 +4547,7 @@ spec:
- name: FELIX_HEALTHENABLED
value: "true"
- name: FELIX_AWSSRCDSTCHECK
value: Disable
value: DoNothing
- name: FELIX_BPFENABLED
value: "false"
- name: FELIX_BPFEXTERNALSERVICEMODE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4661,7 +4661,7 @@ spec:
# kops additions
# Enable source/destination checks for AWS
- name: FELIX_AWSSRCDSTCHECK
value: "{{- if eq GetCloudProvider "aws" -}}{{- or .Networking.Calico.AWSSrcDstCheck "Disable" -}}{{- else -}}DoNothing{{- end -}}"
value: "{{- if and (eq GetCloudProvider "aws") (not IsIPv6Only) -}}{{- or .Networking.Calico.AWSSrcDstCheck "Disable" -}}{{- else -}}DoNothing{{- end -}}"
# Enable eBPF dataplane mode
- name: FELIX_BPFENABLED
value: "{{ .Networking.Calico.BPFEnabled }}"
Expand Down

0 comments on commit b6970c4

Please sign in to comment.