Skip to content

Commit

Permalink
feat(Cadence): added clusterMetadata configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
pregnor committed Aug 18, 2021
1 parent 5add0b4 commit d3a3be9
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 16 deletions.
33 changes: 17 additions & 16 deletions cadence/templates/server-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -152,22 +152,22 @@ data:
{{- end}}
clusterMetadata:
enableGlobalDomain: {{ `{{ default .Env.ENABLE_GLOBAL_DOMAIN "true" }}` }}
failoverVersionIncrement: 10
masterClusterName: "primary"
currentClusterName: "primary"
enableGlobalDomain: {{ .Values.server.config.clusterMetadata.enableGlobalDomains }}
failoverVersionIncrement: {{ .Values.server.config.clusterMetadata.maximumClusterCount }}
masterClusterName: {{ .Values.server.config.clusterMetadata.masterClusterName }}
currentClusterName: {{ .Values.server.config.clusterMetadata.currentClusterName }}
clusterInformation:
primary:
enabled: true
initialFailoverVersion: 0
rpcName: "cadence-frontend"
rpcAddress: {{ `{{ default .Env.PRIMARY_FRONTEND_SERVICE "cadence" }}` }}:{{ .Values.server.frontend.service.port | default `{{ default .Env.FRONTEND_PORT 7933 }}` }}
{{- if `{{ .Env.ENABLE_GLOBAL_DOMAIN }}` }}
secondary:
enabled: true
initialFailoverVersion: 2
rpcName: "cadence-frontend"
rpcAddress: {{ `{{ default .Env.SECONDARY_FRONTEND_SERVICE "cadence-secondary" }}` }}:{{ .Values.server.frontend.service.port | default `{{ default .Env.FRONTEND_PORT 7933 }}` }}
{{- $currentClusterName := .Values.server.config.clusterMetadata.currentClusterName }}
{{- $currentClusterIndex := 0 }}
{{- $frontendComponentName := (include "cadence.componentname" (list . "frontend")) }}
{{- $serverFrontendServicePort := .Values.server.frontend.service.port }}
{{- range $clusterIndex, $clusterInfo := .Values.server.config.clusterMetadata.clusterInformation }}
{{- if eq $clusterInfo.name $currentClusterName }}{{ $currentClusterIndex = $clusterIndex }}{{ end }}
{{ $clusterInfo.name }}:
enabled: {{ $clusterInfo.enabled }}
initialFailoverVersion: {{ $clusterIndex }}
rpcName: "{{ $frontendComponentName }}"
rpcAddress: "{{ $clusterInfo.rpcAddress | default (printf "%s%s%.0f" $frontendComponentName ":" $serverFrontendServicePort ) }}"
{{- end }}
dcRedirectionPolicy:
Expand All @@ -178,7 +178,8 @@ data:
status: "disabled"
publicClient:
hostPort: "{{ include "cadence.componentname" (list . "frontend") }}:{{ .Values.server.frontend.service.port }}"
{{- $currentClusterInfo := (index .Values.server.config.clusterMetadata.clusterInformation $currentClusterIndex) }}
hostPort: "{{ $currentClusterInfo.rpcAddress | default (printf "%s%s%.0f" $frontendComponentName ":" $serverFrontendServicePort ) }}"
dynamicConfigClient:
filepath: "/etc/cadence/config/dynamicconfig/config.yaml"
Expand Down
84 changes: 84 additions & 0 deletions cadence/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,90 @@ server:
affinity: {}

config:
# clusterMetadata contains the settings of the Cadence clusters
# participating in a Cadence cluster group.
clusterMetadata:
# enableGlobalDomain when set to true allows creating global domains which
# are replicated between all Cadence clusters distributed among different
# Kubernetes clusters and whose tasks are served by the active Cadence
# cluster in the replication.
#
# WARNING: This value **MUST NOT** be changed after launching the first
# Cadence cluster of the Cadence cluster group.
enableGlobalDomain: true

# maximumClusterCount defines and locks the maximum number of Cadence
# clusters of a Cadence cluster group at any point in the future included
# clusters added later.
#
# The requirement for this is to be able to safely determine a
# failoverVersionIncrement and initialFailoverVersion for each cluster
# automatically, accounting for clusters which are potentially being added
# later on to the cluster group and ensuring unique failover versions for
# each cluster all the time.
#
# failoverVersionIncrement is the increment of each cluster version when
# failover happens.
#
# initialFailoverVersion is the failover version a cluster starts at when
# launched.
#
# WARNING: For each Cadence cluster, (initialFailoverVersion +
# i*failoverVersionIncrement) **MUST** result in a unique value, not used
# by any other cluster.
#
# WARNING: This value **MUST NOT** be changed after launching the first
# Cadence cluster of the Cadence cluster group.
maximumClusterCount: 100

# masterClusterName is the name of the Cadence leader cluster in a Cadence
# cluster group which can register a domain, while each cluster can update
# domains and do domain failover.
#
# WARNING: it **MUST** be set to the same value for all Cadence clusters
# in a Cadence cluster group.
masterClusterName: "cluster-0"

# currentClusterName is the name of the Cadence cluster the configuration
# belongs to.
#
# In a Cadence cluster group, this is the particular Cadence
# cluster being installed with the chart on a Kubernetes cluster.
#
# WARNING: This value **MUST NOT** be changed after launching the Cadence
# cluster.
currentClusterName: "cluster-0"

# clusterInformation contains the information about each Cadence cluster
# which participates in a Cadence cluster group.
#
# WARNING: for each Cadence cluster at any moment, the cluster names,
# initialFailoverVersion values and (initialFailoverVersion +
# i*failoverVersionIncrement) **MUST** be a unique value, not used by any
# other cluster.
#
# WARNING: once the Cadence cluster group is launched, you **MUST** only
# add Cadence clusters to the clusterInformation list and **MUST NOT**
# remove any Cadence cluster, although you **MAY** disable listed
# clusters.
#
# WARNING: you **MUST** list the Cadence clusters of a Cadence cluster
# group in the same order in each configuration to ensure the
# initialFailoverVersions are synchronized.
clusterInformation:
- name: cluster-0
# enabled defines whether the Cadence cluster is enabled.
enabled: true
# rpcAddress defines the address (host:port, host can be a DNS name)
# of the Cadence frontend remote service to use in a Cadence cluster.
#
# This is defaulted to the in-cluster Cadence frontend service, using
# the chart configured release name and frontend port, but can be
# manually overridden here if necessary.
# rpcAddress: cadence-frontend:7933
- name: cluster-1
enabled: true

logLevel: "debug,info"

# IMPORTANT: This value cannot be changed, once it's set.
Expand Down

0 comments on commit d3a3be9

Please sign in to comment.