@@ -15,6 +15,7 @@ import (
1515 "github.com/go-logr/logr"
1616 "google.golang.org/grpc"
1717 "google.golang.org/grpc/credentials"
18+ "google.golang.org/grpc/credentials/insecure"
1819 eppMetadata "sigs.k8s.io/gateway-api-inference-extension/pkg/epp/metadata"
1920
2021 "github.com/nginx/nginx-gateway-fabric/v2/internal/framework/types"
@@ -34,13 +35,19 @@ func endpointPickerServer(handler http.Handler) error {
3435}
3536
3637// realExtProcClientFactory returns a factory that creates a new gRPC connection and client per request.
37- func realExtProcClientFactory () extProcClientFactory {
38+ func realExtProcClientFactory (endpointPickerEnableTLS , endpointPickerInsecureSkipVerify bool ) extProcClientFactory {
3839 return func (target string ) (extprocv3.ExternalProcessorClient , func () error , error ) {
39- creds := credentials .NewTLS (& tls.Config {
40- // add RootCAs or, if you have a self-signed server cert:
41- InsecureSkipVerify : true , //nolint:gosec
42- })
43- conn , err := grpc .NewClient (target , grpc .WithTransportCredentials (creds ))
40+ var opts []grpc.DialOption
41+
42+ if ! endpointPickerEnableTLS {
43+ opts = append (opts , grpc .WithTransportCredentials (insecure .NewCredentials ()))
44+ } else {
45+ creds := credentials .NewTLS (& tls.Config {
46+ InsecureSkipVerify : endpointPickerInsecureSkipVerify , //nolint:gosec
47+ })
48+ opts = append (opts , grpc .WithTransportCredentials (creds ))
49+ }
50+ conn , err := grpc .NewClient (target , opts ... )
4451 if err != nil {
4552 return nil , nil , err
4653 }
0 commit comments