@@ -26,6 +26,7 @@ package config
26
26
27
27
import (
28
28
"bytes"
29
+ "fmt"
29
30
"strings"
30
31
"time"
31
32
@@ -38,6 +39,7 @@ import (
38
39
"go.temporal.io/server/common/masker"
39
40
"go.temporal.io/server/common/metrics"
40
41
"go.temporal.io/server/common/persistence/visibility/store/elasticsearch/client"
42
+ "go.temporal.io/server/common/primitives"
41
43
"go.temporal.io/server/common/telemetry"
42
44
)
43
45
@@ -111,9 +113,12 @@ type (
111
113
112
114
// RootTLS contains all TLS settings for the Temporal server
113
115
RootTLS struct {
114
- // Internode controls backend service communication TLS settings.
116
+ // Internode controls backend service (history, matching, internal-frontend)
117
+ // communication TLS settings.
115
118
Internode GroupTLS `yaml:"internode"`
116
- // Frontend controls SDK Client to Frontend communication TLS settings.
119
+ // Frontend controls frontend server TLS settings. To control system worker -> frontend
120
+ // TLS, use the SystemWorker field. (Frontend.Client is accepted for backwards
121
+ // compatibility.)
117
122
Frontend GroupTLS `yaml:"frontend"`
118
123
// SystemWorker controls TLS setting for System Workers connecting to Frontend.
119
124
SystemWorker WorkerTLS `yaml:"systemWorker"`
@@ -481,16 +486,30 @@ type (
481
486
S3ForcePathStyle bool `yaml:"s3ForcePathStyle"`
482
487
}
483
488
484
- // PublicClient is config for internal nodes (history/matching/worker) connecting to
485
- // temporal frontend. There are two methods of connecting:
486
- // Explicit endpoint: Supply a host:port to connect to. This can resolve to multiple IPs,
487
- // or a single IP that is a load-balancer.
488
- // Membership resolver (new in 1.18): Leave this empty, and other nodes will use the
489
- // membership service resolver to find the frontend.
490
- // TODO: remove this and always use membership resolver
489
+ // PublicClient is the config for internal nodes (history/matching/worker) connecting to
490
+ // frontend. There are three methods of connecting:
491
+ // 1. Use membership to locate "internal-frontend" and connect to them using the Internode
492
+ // TLS config (which can be "no TLS"). This is recommended for deployments that use an
493
+ // Authorizer and ClaimMapper. To use this, leave this section out of your config, and
494
+ // make sure there is an "internal-frontend" section in Services.
495
+ // 2. Use membership to locate "frontend" and connect to them using the Frontend TLS config
496
+ // (which can be "no TLS"). This is recommended for deployments that don't use an
497
+ // Authorizer or ClaimMapper, or have implemented a custom ClaimMapper that correctly
498
+ // identifies the system worker using mTLS and assigns it an Admin-level claim.
499
+ // To use this, leave this section out of your config and make sure there is _no_
500
+ // "internal-frontend" section in Services.
501
+ // 3. Connect to an explicit endpoint using the SystemWorker (falling back to Frontend) TLS
502
+ // config (which can be "no TLS"). You can use this if you want to force frontend
503
+ // connections to go through an external load balancer. If you use this with a
504
+ // ClaimMapper+Authorizer, you need to ensure that your ClaimMapper assigns Admin
505
+ // claims to worker nodes, and your Authorizer correctly handles those claims.
491
506
PublicClient struct {
492
- // HostPort is the host port to connect on. Host can be DNS name
507
+ // HostPort is the host port to connect on. Host can be DNS name. See the above
508
+ // comment: in many situations you can leave this empty.
493
509
HostPort string `yaml:"hostPort"`
510
+ // Force selection of either the "internode" or "frontend" TLS configs for these
511
+ // connections (only those two strings are valid).
512
+ ForceTLSConfig string `yaml:"forceTLSConfig"`
494
513
}
495
514
496
515
// NamespaceDefaults is the default config for each namespace
@@ -551,6 +570,12 @@ const (
551
570
ClusterMDStoreName DataStoreName = "ClusterMDStore"
552
571
)
553
572
573
+ const (
574
+ ForceTLSConfigAuto = ""
575
+ ForceTLSConfigInternode = "internode"
576
+ ForceTLSConfigFrontend = "frontend"
577
+ )
578
+
554
579
// Validate validates this config
555
580
func (c * Config ) Validate () error {
556
581
if err := c .Persistence .Validate (); err != nil {
@@ -561,6 +586,17 @@ func (c *Config) Validate() error {
561
586
return err
562
587
}
563
588
589
+ _ , hasIFE := c .Services [string (primitives .InternalFrontendService )]
590
+ if hasIFE && (c .PublicClient .HostPort != "" || c .PublicClient .ForceTLSConfig != "" ) {
591
+ return fmt .Errorf ("when using internal-frontend, publicClient must be empty" )
592
+ }
593
+
594
+ switch c .PublicClient .ForceTLSConfig {
595
+ case ForceTLSConfigAuto , ForceTLSConfigInternode , ForceTLSConfigFrontend :
596
+ default :
597
+ return fmt .Errorf ("invalid value for publicClient.forceTLSConfig: %q" , c .PublicClient .ForceTLSConfig )
598
+ }
599
+
564
600
return nil
565
601
}
566
602
0 commit comments