Skip to content

Commit

Permalink
feat(kuma-cp): allow to disable KDS SOTW grpc api (#7961)
Browse files Browse the repository at this point in the history
Signed-off-by: Lukasz Dziedziak <[email protected]>
  • Loading branch information
lukidzi authored Oct 4, 2023
1 parent 6105118 commit d756e47
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 1 deletion.
2 changes: 2 additions & 0 deletions docs/generated/kuma-cp.md
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,8 @@ multizone:
msgSendTimeout: 60s # ENV: KUMA_MULTIZONE_GLOBAL_KDS_MSG_SEND_TIMEOUT
# Backoff that is executed when the global control plane is sending the response that was previously rejected by zone control plane
nackBackoff: 5s # ENV: KUMA_MULTIZONE_GLOBAL_KDS_NACK_BACKOFF
# DisableSOTW if true doesn't expose SOTW version of KDS. Default: false
disableSOTW: false # ENV: KUMA_MULTIZONE_GLOBAL_KDS_DISABLE_SOTW
zone:
# Kuma Zone name used to mark the zone dataplane resources
name: "" # ENV: KUMA_MULTIZONE_ZONE_NAME
Expand Down
2 changes: 2 additions & 0 deletions docs/generated/raw/kuma-cp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,8 @@ multizone:
msgSendTimeout: 60s # ENV: KUMA_MULTIZONE_GLOBAL_KDS_MSG_SEND_TIMEOUT
# Backoff that is executed when the global control plane is sending the response that was previously rejected by zone control plane
nackBackoff: 5s # ENV: KUMA_MULTIZONE_GLOBAL_KDS_NACK_BACKOFF
# DisableSOTW if true doesn't expose SOTW version of KDS. Default: false
disableSOTW: false # ENV: KUMA_MULTIZONE_GLOBAL_KDS_DISABLE_SOTW
zone:
# Kuma Zone name used to mark the zone dataplane resources
name: "" # ENV: KUMA_MULTIZONE_ZONE_NAME
Expand Down
2 changes: 2 additions & 0 deletions pkg/config/app/kuma-cp/kuma-cp.defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,8 @@ multizone:
msgSendTimeout: 60s # ENV: KUMA_MULTIZONE_GLOBAL_KDS_MSG_SEND_TIMEOUT
# Backoff that is executed when the global control plane is sending the response that was previously rejected by zone control plane
nackBackoff: 5s # ENV: KUMA_MULTIZONE_GLOBAL_KDS_NACK_BACKOFF
# DisableSOTW if true doesn't expose SOTW version of KDS. Default: false
disableSOTW: false # ENV: KUMA_MULTIZONE_GLOBAL_KDS_DISABLE_SOTW
zone:
# Kuma Zone name used to mark the zone dataplane resources
name: "" # ENV: KUMA_MULTIZONE_ZONE_NAME
Expand Down
3 changes: 3 additions & 0 deletions pkg/config/loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ var _ = Describe("Config loader", func() {
Expect(cfg.Multizone.Global.KDS.MaxMsgSize).To(Equal(uint32(1)))
Expect(cfg.Multizone.Global.KDS.MsgSendTimeout.Duration).To(Equal(10 * time.Second))
Expect(cfg.Multizone.Global.KDS.NackBackoff.Duration).To(Equal(11 * time.Second))
Expect(cfg.Multizone.Global.KDS.DisableSOTW).To(BeTrue())
Expect(cfg.Multizone.Zone.GlobalAddress).To(Equal("grpc://1.1.1.1:5685"))
Expect(cfg.Multizone.Zone.Name).To(Equal("zone-1"))
Expect(cfg.Multizone.Zone.KDS.RootCAFile).To(Equal("/rootCa"))
Expand Down Expand Up @@ -563,6 +564,7 @@ multizone:
maxMsgSize: 1
msgSendTimeout: 10s
nackBackoff: 11s
disableSOTW: true
zone:
globalAddress: "grpc://1.1.1.1:5685"
name: "zone-1"
Expand Down Expand Up @@ -859,6 +861,7 @@ tracing:
"KUMA_MULTIZONE_GLOBAL_KDS_MAX_MSG_SIZE": "1",
"KUMA_MULTIZONE_GLOBAL_KDS_MSG_SEND_TIMEOUT": "10s",
"KUMA_MULTIZONE_GLOBAL_KDS_NACK_BACKOFF": "11s",
"KUMA_MULTIZONE_GLOBAL_KDS_DISABLE_SOTW": "true",
"KUMA_MULTIZONE_ZONE_GLOBAL_ADDRESS": "grpc://1.1.1.1:5685",
"KUMA_MULTIZONE_ZONE_NAME": "zone-1",
"KUMA_MULTIZONE_ZONE_KDS_ROOT_CA_FILE": "/rootCa",
Expand Down
2 changes: 2 additions & 0 deletions pkg/config/multizone/kds.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ type KdsServerConfig struct {
MsgSendTimeout config_types.Duration `json:"msgSendTimeout" envconfig:"kuma_multizone_global_kds_msg_send_timeout"`
// Backoff that is executed when the global control plane is sending the response that was previously rejected by zone control plane.
NackBackoff config_types.Duration `json:"nackBackoff" envconfig:"kuma_multizone_global_kds_nack_backoff"`
// DisableSOTW if true doesn't expose SOTW version of KDS. Default: false
DisableSOTW bool `json:"disableSOTW" envconfig:"kuma_multizone_global_kds_disable_sotw"`
}

var _ config.Config = &KdsServerConfig{}
Expand Down
1 change: 1 addition & 0 deletions pkg/config/multizone/multicluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ func DefaultGlobalConfig() *GlobalConfig {
TlsMinVersion: "TLSv1_2",
TlsCipherSuites: []string{},
NackBackoff: config_types.Duration{Duration: 5 * time.Second},
DisableSOTW: false,
},
}
}
Expand Down
4 changes: 3 additions & 1 deletion pkg/kds/mux/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ func (s *server) Start(stop <-chan struct{}) error {
grpcServer := grpc.NewServer(grpcOptions...)

// register services
mesh_proto.RegisterMultiplexServiceServer(grpcServer, s)
if !s.config.DisableSOTW {
mesh_proto.RegisterMultiplexServiceServer(grpcServer, s)
}
mesh_proto.RegisterGlobalKDSServiceServer(grpcServer, s.serviceServer)
mesh_proto.RegisterKDSSyncServiceServer(grpcServer, s.kdsSyncServiceServer)
s.metrics.RegisterGRPC(grpcServer)
Expand Down

0 comments on commit d756e47

Please sign in to comment.