Skip to content

Commit 63247a9

Browse files
committed
chore: squash commits
feat: add portRangeUpperBound to be exposed in the helm chart feat: add portRangeUpperBound to be exposed in the helm chart
1 parent a416c3d commit 63247a9

File tree

7 files changed

+23
-6
lines changed

7 files changed

+23
-6
lines changed

charts/aws-efs-csi-driver/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: v2
22
name: aws-efs-csi-driver
33
version: 3.1.1
4-
appVersion: 2.1.0
4+
appVersion: 2.1.1
55
kubeVersion: ">=1.17.0-0"
66
description: "A Helm chart for AWS EFS CSI Driver"
77
home: https://github.com/kubernetes-sigs/aws-efs-csi-driver

charts/aws-efs-csi-driver/templates/controller-deployment.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ spec:
9393
- name: AWS_USE_FIPS_ENDPOINT
9494
value: "true"
9595
{{- end }}
96+
- name: PORT_RANGE_UPPER_BOUND
97+
value: "{{ .Values.portRangeUpperBound }}"
9698
{{- with .Values.controller.env }}
9799
{{- toYaml . | nindent 12 }}
98100
{{- end }}

charts/aws-efs-csi-driver/templates/node-daemonset.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ spec:
9191
- name: AWS_USE_FIPS_ENDPOINT
9292
value: "true"
9393
{{- end }}
94+
- name: PORT_RANGE_UPPER_BOUND
95+
value: "{{ .Values.portRangeUpperBound }}"
9496
{{- with .Values.node.env }}
9597
{{- toYaml . | nindent 12 }}
9698
{{- end }}

charts/aws-efs-csi-driver/values.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ fullnameOverride: ""
77

88
useFIPS: false
99

10+
portRangeUpperBound: "21049"
11+
1012
image:
1113
repository: public.ecr.aws/efs-csi-driver/amazon/aws-efs-csi-driver
1214
tag: "v2.1.0"

deploy/kubernetes/base/controller-deployment.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ spec:
5151
valueFrom:
5252
fieldRef:
5353
fieldPath: spec.nodeName
54+
- name: PORT_RANGE_UPPER_BOUND
55+
value: "21049"
5456
volumeMounts:
5557
- name: socket-dir
5658
mountPath: /var/lib/csi/sockets/pluginproxy/

deploy/kubernetes/base/node-daemonset.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ spec:
6464
valueFrom:
6565
fieldRef:
6666
fieldPath: spec.nodeName
67+
- name: PORT_RANGE_UPPER_BOUND
68+
value: "21049"
6769
volumeMounts:
6870
- name: kubelet-dir
6971
mountPath: /var/lib/kubelet

pkg/driver/efs_watch_dog.go

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"os"
2121
"os/exec"
2222
"path/filepath"
23+
"strconv"
2324
"sync"
2425
"text/template"
2526

@@ -73,7 +74,7 @@ fips_mode_enabled = {{.FipsEnabled -}}
7374
7475
# Define the port range that the TLS tunnel will choose from
7576
port_range_lower_bound = 20049
76-
port_range_upper_bound = 21049
77+
port_range_upper_bound = {{.PortRangeUpperBound}}
7778
7879
# Optimize read_ahead_kb for Linux 5.4+
7980
optimize_readahead = true
@@ -179,9 +180,10 @@ type execWatchdog struct {
179180
}
180181

181182
type efsUtilsConfig struct {
182-
EfsClientSource string
183-
Region string
184-
FipsEnabled string
183+
EfsClientSource string
184+
Region string
185+
FipsEnabled string
186+
PortRangeUpperBound string
185187
}
186188

187189
func newExecWatchdog(efsUtilsCfgPath, efsUtilsStaticFilesPath, cmd string, arg ...string) Watchdog {
@@ -284,7 +286,12 @@ func (w *execWatchdog) updateConfig(efsClientSource string) error {
284286
// used on Fargate, IMDS queries suffice otherwise
285287
region := os.Getenv("AWS_DEFAULT_REGION")
286288
fipsEnabled := os.Getenv("FIPS_ENABLED")
287-
efsCfg := efsUtilsConfig{EfsClientSource: efsClientSource, Region: region, FipsEnabled: fipsEnabled}
289+
portRangeUpperBound := os.Getenv("PORT_RANGE_UPPER_BOUND")
290+
val, err := strconv.Atoi(portRangeUpperBound)
291+
if err != nil || val < 21049 {
292+
portRangeUpperBound = "21049"
293+
}
294+
efsCfg := efsUtilsConfig{EfsClientSource: efsClientSource, Region: region, FipsEnabled: fipsEnabled, PortRangeUpperBound: portRangeUpperBound}
288295
if err = efsCfgTemplate.Execute(f, efsCfg); err != nil {
289296
return fmt.Errorf("cannot update config %s for efs-utils. Error: %v", w.efsUtilsCfgPath, err)
290297
}

0 commit comments

Comments
 (0)