@@ -25,6 +25,9 @@ limited to, log level, tracing, or metrics. For the best user experience, these
25
25
changed at runtime, to avoid having to restart NKG. The first option that we will allow users to configure is the
26
26
log level. The easiest and most intuitive way to implement a Kubernetes-native API is through a CRD.
27
27
28
+ In this doc, the term "user" will refer to the cluster operator (the person who installs and manages NKG). The
29
+ cluster operator owns this CRD resource.
30
+
28
31
## API, Customer Driven Interfaces, and User Experience
29
32
30
33
The API would be provided in a CRD. An authorized user would interact with this CRD using ` kubectl ` to ` get `
@@ -33,20 +36,24 @@ or `edit` the configuration.
33
36
Proposed configuration CRD example:
34
37
35
38
``` yaml
36
- apiVersion : nginx.gateway.k8s.io/v1beta1
39
+ apiVersion : nginx.gateway.k8s.io/v1alpha1
37
40
kind : NGINXControlConfig
38
41
metadata :
39
42
name : nkg-config
40
43
namespace : nginx-gateway
41
44
spec :
42
- logLevel : info
45
+ log :
46
+ level : info
47
+ ...
48
+ status :
43
49
...
44
50
` ` `
45
51
46
52
- The CRD would be Namespace-scoped, living in the same Namespace as the controller that it applies to.
47
- - CRD is initialized and created when NKG is deployed
48
- - NKG references the name of this CRD via CLI arg, and only watches this CRD
49
- - If user deletes resource, NKG logs an error and creates an event. Last state is used until CRD is restored.
53
+ - CRD is initialized and created when NKG is deployed.
54
+ - NKG references the name of this CRD via CLI arg, and only watches this CRD. If the resource doesn't exist,
55
+ then an error is logged and event created, and default values are used.
56
+ - If user deletes resource, NKG logs an error and creates an event. NKG will revert to default values.
50
57
51
58
For discussion with team:
52
59
@@ -79,7 +86,8 @@ be similar in behavior as the current unit tests that verify Gateway API resourc
79
86
We need to ensure that any configurable fields that are exposed to a user are:
80
87
81
88
- Properly validated. This means that the fields should be the correct type (integer, string, etc.), have appropriate
82
- length, and use regex patterns or enums to prevent any unwanted input.
89
+ length, and use regex patterns or enums to prevent any unwanted input. This will initially be done through
90
+ OpenAPI schema validation. If necessary as the CRD evolves, CEL or webhooks could be used.
83
91
- Have a valid use case. The more fields we expose, the more attack vectors we create. We should only be exposing
84
92
fields that are genuinely useful for a user to change dynamically.
85
93
0 commit comments