Skip to content

Commit 78fc43d

Browse files
committed
add configurable EPP flags
1 parent 9fbef71 commit 78fc43d

File tree

24 files changed

+180
-16
lines changed

24 files changed

+180
-16
lines changed

charts/nginx-gateway-fabric/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ The following table lists the configurable parameters of the NGINX Gateway Fabri
245245
| `nginx.usage.resolver` | The nameserver used to resolve the NGINX Plus usage reporting endpoint. Used with NGINX Instance Manager. | string | `""` |
246246
| `nginx.usage.secretName` | The name of the Secret containing the JWT for NGINX Plus usage reporting. Must exist in the same namespace that the NGINX Gateway Fabric control plane is running in (default namespace: nginx-gateway). | string | `"nplus-license"` |
247247
| `nginx.usage.skipVerify` | Disable client verification of the NGINX Plus usage reporting server certificate. | bool | `false` |
248-
| `nginxGateway` | The nginxGateway section contains configuration for the NGINX Gateway Fabric control plane deployment. | object | `{"affinity":{},"autoscaling":{"enable":false},"config":{"logging":{"level":"info"}},"configAnnotations":{},"extraVolumeMounts":[],"extraVolumes":[],"gatewayClassAnnotations":{},"gatewayClassName":"nginx","gatewayControllerName":"gateway.nginx.org/nginx-gateway-controller","gwAPIExperimentalFeatures":{"enable":false},"gwAPIInferenceExtension":{"enable":false},"image":{"pullPolicy":"Always","repository":"ghcr.io/nginx/nginx-gateway-fabric","tag":"edge"},"kind":"deployment","labels":{},"leaderElection":{"enable":true,"lockName":""},"lifecycle":{},"metrics":{"enable":true,"port":9113,"secure":false},"name":"","nodeSelector":{},"podAnnotations":{},"productTelemetry":{"enable":true},"readinessProbe":{"enable":true,"initialDelaySeconds":3,"port":8081},"replicas":1,"resources":{},"service":{"annotations":{},"labels":{}},"serviceAccount":{"annotations":{},"imagePullSecret":"","imagePullSecrets":[],"name":""},"snippetsFilters":{"enable":false},"terminationGracePeriodSeconds":30,"tolerations":[],"topologySpreadConstraints":[]}` |
248+
| `nginxGateway` | The nginxGateway section contains configuration for the NGINX Gateway Fabric control plane deployment. | object | `{"affinity":{},"autoscaling":{"enable":false},"config":{"logging":{"level":"info"}},"configAnnotations":{},"extraVolumeMounts":[],"extraVolumes":[],"gatewayClassAnnotations":{},"gatewayClassName":"nginx","gatewayControllerName":"gateway.nginx.org/nginx-gateway-controller","gwAPIExperimentalFeatures":{"enable":false},"gwAPIInferenceExtension":{"enable":false,"endpointPicker":{"disableTLS":false,"skipVerify":true}},"image":{"pullPolicy":"Always","repository":"ghcr.io/nginx/nginx-gateway-fabric","tag":"edge"},"kind":"deployment","labels":{},"leaderElection":{"enable":true,"lockName":""},"lifecycle":{},"metrics":{"enable":true,"port":9113,"secure":false},"name":"","nodeSelector":{},"podAnnotations":{},"productTelemetry":{"enable":true},"readinessProbe":{"enable":true,"initialDelaySeconds":3,"port":8081},"replicas":1,"resources":{},"service":{"annotations":{},"labels":{}},"serviceAccount":{"annotations":{},"imagePullSecret":"","imagePullSecrets":[],"name":""},"snippetsFilters":{"enable":false},"terminationGracePeriodSeconds":30,"tolerations":[],"topologySpreadConstraints":[]}` |
249249
| `nginxGateway.affinity` | The affinity of the NGINX Gateway Fabric control plane pod. | object | `{}` |
250250
| `nginxGateway.autoscaling` | Autoscaling configuration for the NGINX Gateway Fabric control plane. | object | `{"enable":false}` |
251251
| `nginxGateway.autoscaling.enable` | Enable or disable Horizontal Pod Autoscaler for the control plane. | bool | `false` |
@@ -258,6 +258,9 @@ The following table lists the configurable parameters of the NGINX Gateway Fabri
258258
| `nginxGateway.gatewayControllerName` | The name of the Gateway controller. The controller name must be of the form: DOMAIN/PATH. The controller's domain is gateway.nginx.org. | string | `"gateway.nginx.org/nginx-gateway-controller"` |
259259
| `nginxGateway.gwAPIExperimentalFeatures.enable` | Enable the experimental features of Gateway API which are supported by NGINX Gateway Fabric. Requires the Gateway APIs installed from the experimental channel. | bool | `false` |
260260
| `nginxGateway.gwAPIInferenceExtension.enable` | Enable Gateway API Inference Extension support. Allows for configuring InferencePools to route traffic to AI workloads. | bool | `false` |
261+
| `nginxGateway.gwAPIInferenceExtension.endpointPicker` | EndpointPicker TLS configuration. | object | `{"disableTLS":false,"skipVerify":true}` |
262+
| `nginxGateway.gwAPIInferenceExtension.endpointPicker.disableTLS` | Disable TLS for EndpointPicker communication. By default, TLS is enabled. Set to true only for development/testing or when using a service mesh for encryption. | bool | `false` |
263+
| `nginxGateway.gwAPIInferenceExtension.endpointPicker.skipVerify` | Disables TLS certificate verification when connecting to the EndpointPicker. By default, certificate verification is disabled. REQUIRED: Must be true until Gateway API Inference Extension EndpointPicker supports mounting certificates. See: https://github.com/kubernetes-sigs/gateway-api-inference-extension/issues/1556 | bool | `true` |
261264
| `nginxGateway.image` | The image configuration for the NGINX Gateway Fabric control plane. | object | `{"pullPolicy":"Always","repository":"ghcr.io/nginx/nginx-gateway-fabric","tag":"edge"}` |
262265
| `nginxGateway.image.repository` | The NGINX Gateway Fabric image to use | string | `"ghcr.io/nginx/nginx-gateway-fabric"` |
263266
| `nginxGateway.kind` | The kind of the NGINX Gateway Fabric installation - currently, only deployment is supported. | string | `"deployment"` |

charts/nginx-gateway-fabric/templates/deployment.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ spec:
103103
{{- if .Values.nginxGateway.gwAPIInferenceExtension.enable }}
104104
- --gateway-api-inference-extension
105105
{{- end }}
106+
{{- if .Values.nginxGateway.gwAPIInferenceExtension.endpointPicker.disableTLS }}
107+
- --endpoint-picker-disable-tls
108+
{{- end }}
109+
- --endpoint-picker-tls-skip-verify={{ .Values.nginxGateway.gwAPIInferenceExtension.endpointPicker.skipVerify }}
106110
{{- if .Values.nginxGateway.snippetsFilters.enable }}
107111
- --snippets-filters
108112
{{- end }}

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -846,6 +846,28 @@
846846
"required": [],
847847
"title": "enable",
848848
"type": "boolean"
849+
},
850+
"endpointPicker": {
851+
"description": "EndpointPicker TLS configuration.",
852+
"properties": {
853+
"disableTLS": {
854+
"default": false,
855+
"description": "Disable TLS for EndpointPicker communication. By default, TLS is enabled.\nSet to true only for development/testing or when using a service mesh for encryption.",
856+
"required": [],
857+
"title": "disableTLS",
858+
"type": "boolean"
859+
},
860+
"skipVerify": {
861+
"default": true,
862+
"description": "Disables TLS certificate verification when connecting to the EndpointPicker.\nBy default, certificate verification is disabled.\nREQUIRED: Must be true until Gateway API Inference Extension EndpointPicker supports mounting certificates.\nSee: https://github.com/kubernetes-sigs/gateway-api-inference-extension/issues/1556",
863+
"required": [],
864+
"title": "skipVerify",
865+
"type": "boolean"
866+
}
867+
},
868+
"required": [],
869+
"title": "endpointPicker",
870+
"type": "object"
849871
}
850872
},
851873
"required": [],

charts/nginx-gateway-fabric/values.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,19 @@ nginxGateway:
214214
# -- Enable Gateway API Inference Extension support. Allows for configuring InferencePools to route traffic to AI workloads.
215215
enable: false
216216

217+
# -- EndpointPicker TLS configuration.
218+
endpointPicker:
219+
# -- Disable TLS for EndpointPicker communication. By default, TLS is enabled.
220+
# Set to true only for development/testing or when using a service mesh for encryption.
221+
disableTLS: false
222+
223+
# -- Disables TLS certificate verification when connecting to the EndpointPicker.
224+
# By default, certificate verification is disabled.
225+
# REQUIRED: Must be true until Gateway API Inference Extension EndpointPicker supports mounting certificates.
226+
# See: https://github.com/kubernetes-sigs/gateway-api-inference-extension/issues/1556
227+
skipVerify: true
228+
229+
217230
snippetsFilters:
218231
# -- Enable SnippetsFilters feature. SnippetsFilters allow inserting NGINX configuration into the generated NGINX
219232
# config for HTTPRoute and GRPCRoute resources.

cmd/gateway/commands.go

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,11 @@ const (
3737
`The controller name must be of the form: DOMAIN/PATH. The controller's domain is '%s'`
3838
plusFlag = "nginx-plus"
3939

40-
serverTLSSecret = "server-tls"
41-
agentTLSSecret = "agent-tls"
42-
nginxOneTelemetryEndpointHost = "agent.connect.nginx.com"
40+
serverTLSSecret = "server-tls"
41+
agentTLSSecret = "agent-tls"
42+
nginxOneTelemetryEndpointHost = "agent.connect.nginx.com"
43+
endpointPickerDisableTLSFlag = "endpoint-picker-disable-tls"
44+
endpointPickerTLSSkipVerifyFlag = "endpoint-picker-tls-skip-verify"
4345
)
4446

4547
// usageReportParams holds the parameters for building the usage report configuration for PLUS.
@@ -162,6 +164,9 @@ func createControllerCommand() *cobra.Command {
162164
nginxDockerSecrets = stringSliceValidatingValue{
163165
validator: validateResourceName,
164166
}
167+
168+
endpointPickerDisableTLS bool
169+
endpointPickerTLSSkipVerifyFlag = true
165170
)
166171

167172
usageReportParams := usageReportParams{
@@ -288,6 +293,8 @@ func createControllerCommand() *cobra.Command {
288293
EndpointPort: nginxOneConsoleTelemetryEndpointPort.value,
289294
EndpointTLSSkipVerify: nginxOneConsoleTLSSkipVerify,
290295
},
296+
EndpointPickerDisableTLS: endpointPickerDisableTLS,
297+
EndpointPickerTLSSkipVerify: endpointPickerTLSSkipVerifyFlag,
291298
}
292299

293300
if err := controller.StartManager(conf); err != nil {
@@ -441,6 +448,8 @@ func createControllerCommand() *cobra.Command {
441448
"traffic to AI workloads.",
442449
)
443450

451+
addEPPConnectionFlags(cmd, endpointPickerDisableTLS, endpointPickerTLSSkipVerifyFlag)
452+
444453
cmd.Flags().Var(
445454
&nginxDockerSecrets,
446455
nginxDockerSecretFlag,
@@ -758,19 +767,44 @@ func createSleepCommand() *cobra.Command {
758767
}
759768

760769
func createEndpointPickerCommand() *cobra.Command {
770+
var endpointPickerDisableTLS bool
771+
endpointPickerTLSSkipVerifyFlag := true
761772
cmd := &cobra.Command{
762773
Use: "endpoint-picker",
763774
Short: "Shim server for communication between NGINX and the Gateway API Inference Extension Endpoint Picker",
764775
RunE: func(_ *cobra.Command, _ []string) error {
765776
logger := ctlrZap.New().WithName("endpoint-picker-shim")
766-
handler := createEndpointPickerHandler(realExtProcClientFactory(), logger)
777+
handler := createEndpointPickerHandler(
778+
realExtProcClientFactory(endpointPickerDisableTLS, endpointPickerTLSSkipVerifyFlag),
779+
logger,
780+
)
767781
return endpointPickerServer(handler)
768782
},
769783
}
770784

785+
addEPPConnectionFlags(cmd, endpointPickerDisableTLS, endpointPickerTLSSkipVerifyFlag)
786+
771787
return cmd
772788
}
773789

790+
func addEPPConnectionFlags(cmd *cobra.Command, disableTLS, tlsSkipVerify bool) {
791+
cmd.Flags().BoolVar(
792+
&disableTLS,
793+
endpointPickerDisableTLSFlag,
794+
false,
795+
"Disables TLS when connecting to the EndpointPicker. "+
796+
"Set to true only for development/testing or when using a service mesh for encryption.",
797+
)
798+
799+
cmd.Flags().BoolVar(
800+
&tlsSkipVerify,
801+
endpointPickerTLSSkipVerifyFlag,
802+
true,
803+
"Disables server certificate verification when connecting to the EndpointPicker, if TLS is enabled. "+
804+
"REQUIRED: Must be true until Gateway API Inference Extension EndpointPicker supports mounting certificates.",
805+
)
806+
}
807+
774808
func parseFlags(flags *pflag.FlagSet) ([]string, []string) {
775809
var flagKeys, flagValues []string
776810

cmd/gateway/commands_test.go

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ func TestControllerCmdFlagValidation(t *testing.T) {
161161
"--nginx-one-telemetry-endpoint-host=telemetry-endpoint-host",
162162
"--nginx-one-telemetry-endpoint-port=443",
163163
"--nginx-one-tls-skip-verify",
164+
"--endpoint-picker-disable-tls",
165+
"--endpoint-picker-tls-skip-verify",
164166
},
165167
wantErr: false,
166168
},
@@ -924,3 +926,51 @@ func TestUsageReportConfig(t *testing.T) {
924926
})
925927
}
926928
}
929+
930+
func TestEndpointPickerFlags(t *testing.T) {
931+
t.Parallel()
932+
tests := []flagTestCase{
933+
{
934+
name: "valid flags with default values",
935+
args: []string{
936+
"--endpoint-picker-disable-tls=false",
937+
"--endpoint-picker-tls-skip-verify=true",
938+
},
939+
wantErr: false,
940+
},
941+
{
942+
name: "valid flags with changed values",
943+
args: []string{
944+
"--endpoint-picker-disable-tls=true",
945+
"--endpoint-picker-tls-skip-verify=false",
946+
},
947+
wantErr: false,
948+
},
949+
{
950+
name: "endpoint-picker-disable-tls is not a bool",
951+
args: []string{
952+
"--endpoint-picker-disable-tls=not-a-bool",
953+
},
954+
wantErr: true,
955+
expectedErrPrefix: `invalid argument "not-a-bool" for "--endpoint-picker-disable-tls" flag:` +
956+
` strconv.ParseBool: parsing "not-a-bool": invalid syntax`,
957+
},
958+
{
959+
name: "endpoint-picker-tls-skip-verify is not a bool",
960+
args: []string{
961+
"--endpoint-picker-tls-skip-verify=not-a-bool",
962+
},
963+
wantErr: true,
964+
expectedErrPrefix: `invalid argument "not-a-bool" for "--endpoint-picker-tls-skip-verify" flag:` +
965+
` strconv.ParseBool: parsing "not-a-bool": invalid syntax`,
966+
},
967+
}
968+
969+
for _, test := range tests {
970+
t.Run(test.name, func(t *testing.T) {
971+
t.Parallel()
972+
cmd := createEndpointPickerCommand()
973+
testFlag(t, cmd, test)
974+
})
975+
}
976+
}

cmd/gateway/endpoint_picker.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,19 @@ func endpointPickerServer(handler http.Handler) error {
3535
}
3636

3737
// realExtProcClientFactory returns a factory that creates a new gRPC connection and client per request.
38-
func realExtProcClientFactory() extProcClientFactory {
38+
func realExtProcClientFactory(disableTLS, tlsSkipVerify bool) extProcClientFactory {
3939
return func(target string) (extprocv3.ExternalProcessorClient, func() error, error) {
4040
var opts []grpc.DialOption
41-
enableTLS := true
42-
insecureSkipVerify := true
4341

44-
if !enableTLS {
42+
if disableTLS {
4543
opts = append(opts, grpc.WithTransportCredentials(insecure.NewCredentials()))
4644
} else {
4745
creds := credentials.NewTLS(&tls.Config{
48-
InsecureSkipVerify: insecureSkipVerify, //nolint:gosec
46+
InsecureSkipVerify: tlsSkipVerify, //nolint:gosec
4947
})
5048
opts = append(opts, grpc.WithTransportCredentials(creds))
5149
}
50+
5251
conn, err := grpc.NewClient(target, opts...)
5352
if err != nil {
5453
return nil, nil, err

deploy/azure/deploy.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ spec:
286286
- --metrics-port=9113
287287
- --health-port=8081
288288
- --leader-election-lock-name=nginx-gateway-leader-election
289+
- --endpoint-picker-tls-skip-verify=true
289290
env:
290291
- name: POD_NAMESPACE
291292
valueFrom:

deploy/default/deploy.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ spec:
286286
- --metrics-port=9113
287287
- --health-port=8081
288288
- --leader-election-lock-name=nginx-gateway-leader-election
289+
- --endpoint-picker-tls-skip-verify=true
289290
env:
290291
- name: POD_NAMESPACE
291292
valueFrom:

deploy/experimental-nginx-plus/deploy.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ spec:
295295
- --health-port=8081
296296
- --leader-election-lock-name=nginx-gateway-leader-election
297297
- --gateway-api-experimental-features
298+
- --endpoint-picker-tls-skip-verify=true
298299
env:
299300
- name: POD_NAMESPACE
300301
valueFrom:

0 commit comments

Comments
 (0)