Skip to content

Commit 6f95494

Browse files
committed
Mostly fix lint issues
1 parent b515032 commit 6f95494

File tree

12 files changed

+79
-71
lines changed

12 files changed

+79
-71
lines changed

charts/nginx-gateway-fabric/README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ The following table lists the configurable parameters of the NGINX Gateway Fabri
264264
| `certGenerator.ttlSecondsAfterFinished` | How long to wait after the cert generator job has finished before it is removed by the job controller. | int | `30` |
265265
| `clusterDomain` | The DNS cluster domain of your Kubernetes cluster. | string | `"cluster.local"` |
266266
| `gateways` | A list of Gateway objects. View https://gateway-api.sigs.k8s.io/reference/spec/#gateway for full Gateway reference. | list | `[]` |
267-
| `nginx` | The nginx section contains the configuration for all NGINX data plane deployments installed by the NGINX Gateway Fabric control plane. | object | `{"config":{},"container":{"hostPorts":[],"lifecycle":{},"readinessProbe":{},"resources":{},"volumeMounts":[]},"debug":false,"image":{"pullPolicy":"Always","repository":"ghcr.io/nginx/nginx-gateway-fabric/nginx","tag":"edge"},"imagePullSecret":"","imagePullSecrets":[],"kind":"deployment","nginxOneConsole":{"dataplaneKeySecretName":"","endpointHost":"product.connect.nginx.com","endpointPort":443,"tlsSkipVerify":false},"plus":false,"pod":{},"replicas":1,"service":{"externalTrafficPolicy":"Local","loadBalancerClass":"","loadBalancerIP":"","loadBalancerSourceRanges":[],"nodePorts":[],"type":"LoadBalancer"},"usage":{"caSecretName":"","clientSSLSecretName":"","endpoint":"","resolver":"","secretName":"nplus-license","skipVerify":false}}` |
267+
| `nginx` | The nginx section contains the configuration for all NGINX data plane deployments installed by the NGINX Gateway Fabric control plane. | object | `{"config":{},"container":{"hostPorts":[],"lifecycle":{},"readinessProbe":{},"resources":{},"volumeMounts":[]},"debug":false,"image":{"pullPolicy":"Always","repository":"ghcr.io/nginx/nginx-gateway-fabric/nginx","tag":"edge"},"imagePullSecret":"","imagePullSecrets":[],"kind":"deployment","nginxOneConsole":{"dataplaneKeySecretName":"","endpointHost":"agent.connect.nginx.com","endpointPort":443,"tlsSkipVerify":false},"plus":false,"pod":{},"replicas":1,"service":{"externalTrafficPolicy":"Local","loadBalancerClass":"","loadBalancerIP":"","loadBalancerSourceRanges":[],"nodePorts":[],"type":"LoadBalancer"},"usage":{"caSecretName":"","clientSSLSecretName":"","endpoint":"","resolver":"","secretName":"nplus-license","skipVerify":false}}` |
268268
| `nginx.config` | The configuration for the data plane that is contained in the NginxProxy resource. This is applied globally to all Gateways managed by this instance of NGINX Gateway Fabric. | object | `{}` |
269269
| `nginx.container` | The container configuration for the NGINX container. This is applied globally to all Gateways managed by this instance of NGINX Gateway Fabric. | object | `{"hostPorts":[],"lifecycle":{},"readinessProbe":{},"resources":{},"volumeMounts":[]}` |
270270
| `nginx.container.hostPorts` | A list of HostPorts to expose on the host. This configuration allows containers to bind to a specific port on the host node, enabling external network traffic to reach the container directly through the host's IP address and port. Use this option when you need to expose container ports on the host for direct access, such as for debugging, legacy integrations, or when NodePort/LoadBalancer services are not suitable. Note: Using hostPort may have security and scheduling implications, as it ties pods to specific nodes and ports. | list | `[]` |
@@ -276,6 +276,10 @@ The following table lists the configurable parameters of the NGINX Gateway Fabri
276276
| `nginx.imagePullSecret` | The name of the secret containing docker registry credentials. Secret must exist in the same namespace as the helm release. The control plane will copy this secret into any namespace where NGINX is deployed. | string | `""` |
277277
| `nginx.imagePullSecrets` | A list of secret names containing docker registry credentials. Secrets must exist in the same namespace as the helm release. The control plane will copy these secrets into any namespace where NGINX is deployed. | list | `[]` |
278278
| `nginx.kind` | The kind of NGINX deployment. | string | `"deployment"` |
279+
| `nginx.nginxOneConsole` | Configuration for NGINX One Console. | object | `{"dataplaneKeySecretName":"","endpointHost":"agent.connect.nginx.com","endpointPort":443,"tlsSkipVerify":false}` |
280+
| `nginx.nginxOneConsole.endpointHost` | The Endpoint host that the NGINX One Console telemetry metrics will be sent to. | string | `"agent.connect.nginx.com"` |
281+
| `nginx.nginxOneConsole.endpointPort` | The endpoint port that the NGINX One Console telemetry metrics will be sent to. | int | `443` |
282+
| `nginx.nginxOneConsole.tlsSkipVerify` | Skip TLS verification for NGINX One Console connections. | bool | `false` |
279283
| `nginx.plus` | Is NGINX Plus image being used. | bool | `false` |
280284
| `nginx.pod` | The pod configuration for the NGINX data plane pod. This is applied globally to all Gateways managed by this instance of NGINX Gateway Fabric. | object | `{}` |
281285
| `nginx.replicas` | The number of replicas of the NGINX Deployment. | int | `1` |

charts/nginx-gateway-fabric/values.schema.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -450,28 +450,28 @@
450450
"properties": {
451451
"dataplaneKeySecretName": {
452452
"default": "",
453-
"description": "Name of the secret which holds the dataplane key that is required to authenticate with the NGINX One Console.",
453+
"description": "Name of the secret which holds the dataplane key that is required to authenticate with the NGINX One Console.\nSecret must exist in the same namespace that the NGINX Gateway Fabric control plane is running in\n(default namespace: nginx-gateway).",
454454
"required": [],
455455
"title": "dataplaneKeySecretName",
456456
"type": "string"
457457
},
458458
"endpointHost": {
459-
"default": "product.connect.nginx.com",
460-
"description": "The Endpoint host that the NGINX One Console telemetry metrics will be sent to. ",
459+
"default": "agent.connect.nginx.com",
460+
"description": "The Endpoint host that the NGINX One Console telemetry metrics will be sent to.",
461461
"required": [],
462462
"title": "endpointHost",
463463
"type": "string"
464464
},
465465
"endpointPort": {
466466
"default": 443,
467-
"description": "The endpoint port that the NGINX One Console telemetry metrics will be sent to.",
467+
"description": "The endpoint port that the NGINX One Console telemetry metrics will be sent to.",
468468
"required": [],
469469
"title": "endpointPort",
470470
"type": "integer"
471471
},
472472
"tlsSkipVerify": {
473473
"default": false,
474-
"description": "NGINX One Console configuration specifying tls skip verify.",
474+
"description": "Skip TLS verification for NGINX One Console connections.",
475475
"required": [],
476476
"title": "tlsSkipVerify",
477477
"type": "boolean"

charts/nginx-gateway-fabric/values.yaml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -212,18 +212,20 @@ nginx:
212212
# -- Is NGINX Plus image being used.
213213
plus: false
214214

215-
# Configuration for NGINX One Console.
215+
# -- Configuration for NGINX One Console.
216216
nginxOneConsole:
217217
# Name of the secret which holds the dataplane key that is required to authenticate with the NGINX One Console.
218+
# Secret must exist in the same namespace that the NGINX Gateway Fabric control plane is running in
219+
# (default namespace: nginx-gateway).
218220
dataplaneKeySecretName: ""
219221

220-
# The Endpoint host that the NGINX One Console telemetry metrics will be sent to.
221-
endpointHost: "product.connect.nginx.com"
222+
# -- The Endpoint host that the NGINX One Console telemetry metrics will be sent to.
223+
endpointHost: "agent.connect.nginx.com"
222224

223-
# The endpoint port that the NGINX One Console telemetry metrics will be sent to.
225+
# -- The endpoint port that the NGINX One Console telemetry metrics will be sent to.
224226
endpointPort: 443
225227

226-
# NGINX One Console configuration specifying tls skip verify.
228+
# -- Skip TLS verification for NGINX One Console connections.
227229
tlsSkipVerify: false
228230

229231
# -- The name of the secret containing docker registry credentials.

cmd/gateway/commands.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func createControllerCommand() *cobra.Command {
6060
configFlag = "config"
6161
serviceFlag = "service"
6262
agentTLSSecretFlag = "agent-tls-secret"
63-
nginxOneConsoleDataplaneKeySecretFlag = "nginx-one-console-dataplane-key-secret"
63+
nginxOneConsoleDataplaneKeySecretFlag = "nginx-one-console-dataplane-key-secret" //nolint:gosec // not credentials
6464
nginxOneConsoleTelemetryEndpointHostFlag = "nginx-one-console-telemetry-endpoint-host"
6565
nginxOneConsoleTelemetryEndpointPortFlag = "nginx-one-console-telemetry-endpoint-port"
6666
nginxOneConsoleTLSSkipVerifyFlag = "nginx-one-console-tls-skip-verify"
@@ -109,10 +109,10 @@ func createControllerCommand() *cobra.Command {
109109
}
110110
nginxOneConsoleTelemetryEndpointHost = stringValidatingValue{
111111
validator: validateResourceName,
112-
value: "product.connect.nginx.com",
112+
value: "agent.connect.nginx.com",
113113
}
114114
nginxOneConsoleTelemetryEndpointPort = intValidatingValue{
115-
validator: validateProtocolPort,
115+
validator: validateAnyPort,
116116
value: 443,
117117
}
118118
nginxOneConsoleTLSSkipVerify bool

cmd/gateway/commands_test.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -459,17 +459,18 @@ func TestControllerCmdFlagValidation(t *testing.T) {
459459
args: []string{
460460
"--nginx-one-console-telemetry-endpoint-host=!@#$",
461461
},
462-
wantErr: true,
463-
expectedErrPrefix: `invalid argument "!@#$" for "--nginx-one-console-telemetry-endpoint-host" flag: invalid format: `,
462+
wantErr: true,
463+
expectedErrPrefix: `invalid argument "!@#$" for "--nginx-one-console-telemetry-endpoint-host" ` +
464+
`flag: invalid format: `,
464465
},
465466
{
466467
name: "nginx-one-console-telemetry-endpoint-port is invalid type",
467468
args: []string{
468469
"--nginx-one-console-telemetry-endpoint-port=invalid", // not an int
469470
},
470471
wantErr: true,
471-
expectedErrPrefix: `invalid argument "invalid" for "--nginx-one-console-telemetry-endpoint-port" flag: failed to parse int value:` +
472-
` strconv.ParseInt: parsing "invalid": invalid syntax`,
472+
expectedErrPrefix: `invalid argument "invalid" for "--nginx-one-console-telemetry-endpoint-port" ` +
473+
`flag: failed to parse int value: strconv.ParseInt: parsing "invalid": invalid syntax`,
473474
},
474475
{
475476
name: "nginx-one-console-telemetry-endpoint-port is outside of range",
@@ -482,8 +483,8 @@ func TestControllerCmdFlagValidation(t *testing.T) {
482483
},
483484
{
484485
name: "nginx-one-console-tls-skip-verify is not a bool",
485-
expectedErrPrefix: `invalid argument "not-a-bool" for "--nginx-one-console-tls-skip-verify" flag: strconv.ParseBool:` +
486-
` parsing "not-a-bool": invalid syntax`,
486+
expectedErrPrefix: `invalid argument "not-a-bool" for "--nginx-one-console-tls-skip-verify" flag:` +
487+
`strconv.ParseBool: parsing "not-a-bool": invalid syntax`,
487488
args: []string{
488489
"--nginx-one-console-tls-skip-verify=not-a-bool",
489490
},

cmd/gateway/validation.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,9 @@ func validatePort(port int) error {
157157
return nil
158158
}
159159

160-
// validateProtocolPort makes sure a given port is inside the valid port range for its usage. This also includes well known ports.
161-
func validateProtocolPort(port int) error {
160+
// validateAnyPort makes sure a given port is inside the valid range for all ports.
161+
// This includes protected ports (1-1023) and unprivileged ports (1024-65535).
162+
func validateAnyPort(port int) error {
162163
if port < 1 || port > 65535 {
163164
return fmt.Errorf("port outside of valid port range [1 - 65535]: %v", port)
164165
}

cmd/gateway/validation_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ func TestProtocolPort(t *testing.T) {
443443
t.Parallel()
444444
g := NewWithT(t)
445445

446-
err := validateProtocolPort(tc.port)
446+
err := validateAnyPort(tc.port)
447447
if !tc.expErr {
448448
g.Expect(err).ToNot(HaveOccurred())
449449
} else {

internal/controller/config/config.go

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,38 +12,38 @@ const DefaultNginxMetricsPort = int32(9113)
1212
type Config struct {
1313
// AtomicLevel is an atomically changeable, dynamic logging level.
1414
AtomicLevel zap.AtomicLevel
15-
// UsageReportConfig specifies the NGINX Plus usage reporting configuration.
16-
UsageReportConfig UsageReportConfig
17-
// ImageSource is the source of the NGINX Gateway image.
18-
ImageSource string
19-
// Flags contains the NGF command-line flag names and values.
20-
Flags Flags
2115
// GatewayPodConfig contains information about this Pod.
2216
GatewayPodConfig GatewayPodConfig
2317
// Logger is the Zap Logger used by all components.
2418
Logger logr.Logger
25-
// GatewayCtlrName is the name of this controller.
26-
GatewayCtlrName string
19+
// NGINXSCCName is the name of the SecurityContextConstraints for the NGINX Pods. Only applicable in OpenShift.
20+
NGINXSCCName string
2721
// ConfigName is the name of the NginxGateway resource for this controller.
2822
ConfigName string
29-
// GatewayClassName is the name of the GatewayClass resource that the Gateway will use.
30-
GatewayClassName string
3123
// AgentTLSSecretName is the name of the TLS Secret used by NGINX Agent to communicate with the control plane.
3224
AgentTLSSecretName string
33-
// NGINXSCCName is the name of the SecurityContextConstraints for the NGINX Pods. Only applicable in OpenShift.
34-
NGINXSCCName string
35-
// NginxDockerSecretNames are the names of any Docker registry Secrets for the NGINX container.
36-
NginxDockerSecretNames []string
25+
// GatewayClassName is the name of the GatewayClass resource that the Gateway will use.
26+
GatewayClassName string
27+
// ImageSource is the source of the NGINX Gateway image.
28+
ImageSource string
29+
// GatewayCtlrName is the name of this controller.
30+
GatewayCtlrName string
31+
// UsageReportConfig specifies the NGINX Plus usage reporting configuration.
32+
UsageReportConfig UsageReportConfig
33+
// Flags contains the NGF command-line flag names and values.
34+
Flags Flags
3735
// LeaderElection contains the configuration for leader election.
3836
LeaderElection LeaderElectionConfig
37+
// NginxDockerSecretNames are the names of any Docker registry Secrets for the NGINX container.
38+
NginxDockerSecretNames []string
39+
// NginxOneConsoleTelemetryConfig contains the configuration for NGINX One Console telemetry.
40+
NginxOneConsoleTelemetryConfig NginxOneConsoleTelemetryConfig
3941
// ProductTelemetryConfig contains the configuration for collecting product telemetry.
4042
ProductTelemetryConfig ProductTelemetryConfig
41-
// MetricsConfig specifies the metrics config.
42-
MetricsConfig MetricsConfig
4343
// HealthConfig specifies the health probe config.
4444
HealthConfig HealthConfig
45-
// NginxOneConsoleTelemetryConfig contains the configuration for NGINX One Console telemetry.
46-
NginxOneConsoleTelemetryConfig NginxOneConsoleTelemetryConfig
45+
// MetricsConfig specifies the metrics config.
46+
MetricsConfig MetricsConfig
4747
// Plus indicates whether NGINX Plus is being used.
4848
Plus bool
4949
// ExperimentalFeatures indicates if experimental features are enabled.

internal/controller/manager.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -218,19 +218,19 @@ func StartManager(cfg config.Config) error {
218218
ctx,
219219
mgr,
220220
provisioner.Config{
221-
DeploymentStore: nginxUpdater.NginxDeployments,
222-
StatusQueue: statusQueue,
223-
Logger: cfg.Logger.WithName("provisioner"),
224-
EventRecorder: recorder,
225-
GatewayPodConfig: &cfg.GatewayPodConfig,
226-
GCName: cfg.GatewayClassName,
227-
AgentTLSSecretName: cfg.AgentTLSSecretName,
228-
NGINXSCCName: cfg.NGINXSCCName,
229-
Plus: cfg.Plus,
230-
NginxDockerSecretNames: cfg.NginxDockerSecretNames,
231-
PlusUsageConfig: &cfg.UsageReportConfig,
232-
AgentLabels: agentLabels,
233-
NginxOneConsoleTelemetryConfig: cfg.NginxOneConsoleTelemetryConfig,
221+
DeploymentStore: nginxUpdater.NginxDeployments,
222+
StatusQueue: statusQueue,
223+
Logger: cfg.Logger.WithName("provisioner"),
224+
EventRecorder: recorder,
225+
GatewayPodConfig: &cfg.GatewayPodConfig,
226+
GCName: cfg.GatewayClassName,
227+
AgentTLSSecretName: cfg.AgentTLSSecretName,
228+
NGINXSCCName: cfg.NGINXSCCName,
229+
Plus: cfg.Plus,
230+
NginxDockerSecretNames: cfg.NginxDockerSecretNames,
231+
PlusUsageConfig: &cfg.UsageReportConfig,
232+
AgentLabels: agentLabels,
233+
NginxOneConsoleTelemetryConfig: cfg.NginxOneConsoleTelemetryConfig,
234234
},
235235
)
236236
if err != nil {

internal/controller/provisioner/objects.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,10 @@ func (p *NginxProvisioner) buildNginxResourceObjects(
7474

7575
var dataplaneKeySecretName string
7676
if p.cfg.NginxOneConsoleTelemetryConfig.DataplaneKeySecretName != "" {
77-
dataplaneKeySecretName = controller.CreateNginxResourceName(resourceName, p.cfg.NginxOneConsoleTelemetryConfig.DataplaneKeySecretName)
77+
dataplaneKeySecretName = controller.CreateNginxResourceName(
78+
resourceName,
79+
p.cfg.NginxOneConsoleTelemetryConfig.DataplaneKeySecretName,
80+
)
7881
}
7982

8083
// map key is the new name, value is the original name

0 commit comments

Comments
 (0)