Skip to content

Commit

Permalink
Fix port range
Browse files Browse the repository at this point in the history
  • Loading branch information
lucacome authored Jul 2, 2020
1 parent 67fa84e commit d89b677
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions cmd/nginx-ingress/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ var (
nginxStatusAllowCIDRs = flag.String("nginx-status-allow-cidrs", "127.0.0.1", `Whitelist IPv4 IP/CIDR blocks to allow access to NGINX stub_status or the NGINX Plus API. Separate multiple IP/CIDR by commas.`)

nginxStatusPort = flag.Int("nginx-status-port", 8080,
"Set the port where the NGINX stub_status or the NGINX Plus API is exposed. [1023 - 65535]")
"Set the port where the NGINX stub_status or the NGINX Plus API is exposed. [1024 - 65535]")

nginxStatus = flag.Bool("nginx-status", true,
"Enable the NGINX stub_status, or the NGINX Plus API.")
Expand All @@ -127,7 +127,7 @@ var (
"Enable exposing NGINX or NGINX Plus metrics in the Prometheus format")

prometheusMetricsListenPort = flag.Int("prometheus-metrics-listen-port", 9113,
"Set the port where the Prometheus metrics are exposed. [1023 - 65535]")
"Set the port where the Prometheus metrics are exposed. [1024 - 65535]")

enableCustomResources = flag.Bool("enable-custom-resources", true,
"Enable custom resources")
Expand Down Expand Up @@ -561,8 +561,8 @@ func validateResourceName(lock string) error {

// validatePort makes sure a given port is inside the valid port range for its usage
func validatePort(port int) error {
if port < 1023 || port > 65535 {
return fmt.Errorf("port outside of valid port range [1023 - 65535]: %v", port)
if port < 1024 || port > 65535 {
return fmt.Errorf("port outside of valid port range [1024 - 65535]: %v", port)
}
return nil
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/nginx-ingress/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import (
)

func TestValidatePort(t *testing.T) {
badPorts := []int{80, 443, 1, 1022, 65536}
badPorts := []int{80, 443, 1, 1023, 65536}
for _, badPort := range badPorts {
err := validatePort(badPort)
if err == nil {
t.Errorf("Expected error for port %v\n", badPort)
}
}

goodPorts := []int{8080, 8081, 8082, 1023, 65535}
goodPorts := []int{8080, 8081, 8082, 1024, 65535}
for _, goodPort := range goodPorts {
err := validatePort(goodPort)
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ Below we describe the available command-line arguments:
Set the port where the NGINX stub_status or the NGINX Plus API is exposed.
Format: ``[1023 - 65535]`` (default 8080)
Format: ``[1024 - 65535]`` (default 8080)
.. option:: -proxy <string>
Expand Down Expand Up @@ -169,7 +169,7 @@ Below we describe the available command-line arguments:
Sets the port where the Prometheus metrics are exposed.
Format: ``[1023 - 65535]`` (default 9113)
Format: ``[1024 - 65535]`` (default 9113)
.. option:: -spire-agent-address <string>
Expand Down

0 comments on commit d89b677

Please sign in to comment.