@@ -20,6 +20,7 @@ import (
20
20
"os"
21
21
"os/exec"
22
22
"path/filepath"
23
+ "strconv"
23
24
"sync"
24
25
"text/template"
25
26
@@ -73,7 +74,7 @@ fips_mode_enabled = {{.FipsEnabled -}}
73
74
74
75
# Define the port range that the TLS tunnel will choose from
75
76
port_range_lower_bound = 20049
76
- port_range_upper_bound = 21049
77
+ port_range_upper_bound = {{.PortRangeUpperBound}}
77
78
78
79
# Optimize read_ahead_kb for Linux 5.4+
79
80
optimize_readahead = true
@@ -179,9 +180,10 @@ type execWatchdog struct {
179
180
}
180
181
181
182
type efsUtilsConfig struct {
182
- EfsClientSource string
183
- Region string
184
- FipsEnabled string
183
+ EfsClientSource string
184
+ Region string
185
+ FipsEnabled string
186
+ PortRangeUpperBound string
185
187
}
186
188
187
189
func newExecWatchdog (efsUtilsCfgPath , efsUtilsStaticFilesPath , cmd string , arg ... string ) Watchdog {
@@ -284,7 +286,12 @@ func (w *execWatchdog) updateConfig(efsClientSource string) error {
284
286
// used on Fargate, IMDS queries suffice otherwise
285
287
region := os .Getenv ("AWS_DEFAULT_REGION" )
286
288
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 }
288
295
if err = efsCfgTemplate .Execute (f , efsCfg ); err != nil {
289
296
return fmt .Errorf ("cannot update config %s for efs-utils. Error: %v" , w .efsUtilsCfgPath , err )
290
297
}
0 commit comments