Skip to content

Commit d945668

Browse files
committed
More code review
1 parent 3adb59d commit d945668

File tree

5 files changed

+24
-6
lines changed

5 files changed

+24
-6
lines changed

apis/v1alpha1/nginxgateway_types.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ type Logging struct {
5050
type ControllerLogLevel string
5151

5252
const (
53-
// Info level for control plane logging.
53+
// ControllerLogLevelInfo is the info level for control plane logging.
5454
ControllerLogLevelInfo ControllerLogLevel = "info"
5555

56-
// Debug level for control plane logging.
56+
// ControllerLogLevelDebug is the debug level for control plane logging.
5757
ControllerLogLevelDebug ControllerLogLevel = "debug"
5858

59-
// Error level for control plane logging.
59+
// ControllerLogLevelError is the error level for control plane logging.
6060
ControllerLogLevelError ControllerLogLevel = "error"
6161
)
6262

cmd/gateway/commands_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ func TestStaticModeCmdFlagValidation(t *testing.T) {
116116
name: "valid flags",
117117
args: []string{
118118
"--gateway=nginx-gateway/nginx",
119+
"--config=nginx-gateway-config",
119120
"--update-gatewayclass-status=true",
120121
},
121122
wantErr: false,
@@ -142,6 +143,22 @@ func TestStaticModeCmdFlagValidation(t *testing.T) {
142143
expectedErrPrefix: `invalid argument "nginx-gateway" for "--gateway" flag: invalid format; ` +
143144
"must be NAMESPACE/NAME",
144145
},
146+
{
147+
name: "config is set to empty string",
148+
args: []string{
149+
"--config=",
150+
},
151+
wantErr: true,
152+
expectedErrPrefix: `invalid argument "" for "-c, --config" flag: must be set`,
153+
},
154+
{
155+
name: "config is set to invalid string",
156+
args: []string{
157+
"--config=!@#$",
158+
},
159+
wantErr: true,
160+
expectedErrPrefix: `invalid argument "!@#$" for "-c, --config" flag: invalid format`,
161+
},
145162
{
146163
name: "update-gatewayclass-status is set to empty string",
147164
args: []string{

deploy/manifests/nginx-gateway.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ metadata:
347347
spec:
348348
controllerName: gateway.nginx.org/nginx-gateway-controller
349349
---
350-
# Source: nginx-kubernetes-gateway/templates/control-config.yaml
350+
# Source: nginx-kubernetes-gateway/templates/nginxgateway.yaml
351351
apiVersion: gateway.nginx.org/v1alpha1
352352
kind: NginxGateway
353353
metadata:

docs/control-plane-configuration.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ of the resource is `<release-name>-config`. It is deployed in the same Namespace
1414

1515
The control plane only watches this single instance of the custom resource. If the resource is invalid per the OpenAPI
1616
schema, the Kubernetes API server will reject the changes. If the resource is deleted or deemed invalid by NGINX
17-
Kubernetes Gateway, an error Event is created in the `nginx-gateway` Namespace, and the default values will be used by
18-
the control plane for its configuration.
17+
Kubernetes Gateway, a warning Event is created in the `nginx-gateway` Namespace, and the default values will be used by
18+
the control plane for its configuration. Additionally, the control plane updates the status of the resource (if it exists)
19+
to reflect whether it is valid or not.
1920

2021
### Spec
2122

0 commit comments

Comments
 (0)