-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes: separate frontend, worker, matching, history deployments. Co…
…nfigmap added. Parameterized.
- Loading branch information
Showing
11 changed files
with
271 additions
and
361 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,13 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "cadencechart.name" -}} | ||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
{{/* vim: set filetype=mustache: */}} | ||
|
||
{{/* | ||
Create a default fully qualified app name. | ||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). | ||
If release name contains chart name it will be used as a full name. | ||
*/}} | ||
{{- define "cadencechart.fullname" -}} | ||
{{- if .Values.fullnameOverride }} | ||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- $name := default .Chart.Name .Values.nameOverride }} | ||
{{- if contains $name .Release.Name }} | ||
{{- .Release.Name | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
{{- define "cadence.name" -}} | ||
{{- .Chart.Name | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Create chart name and version as used by the chart label. | ||
*/}} | ||
{{- define "cadencechart.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
{{- define "cadence.fullname" -}} | ||
{{- printf "%s-%s" .Release.Name (include "cadence.name" .) | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "cadencechart.labels" -}} | ||
helm.sh/chart: {{ include "cadencechart.chart" . }} | ||
{{ include "cadencechart.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "cadencechart.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "cadencechart.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create the name of the service account to use | ||
*/}} | ||
{{- define "cadencechart.serviceAccountName" -}} | ||
{{- if .Values.serviceAccount.create }} | ||
{{- default (include "cadencechart.fullname" .) .Values.serviceAccount.name }} | ||
{{- else }} | ||
{{- default "default" .Values.serviceAccount.name }} | ||
{{- end }} | ||
{{- end }} | ||
{{- define "cadence.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: cadence-schema-setup | ||
spec: | ||
backoffLimit: 4 | ||
template: | ||
metadata: | ||
name: cadence-schema-setup | ||
spec: | ||
restartPolicy: "OnFailure" | ||
initContainers: | ||
# Check Cassandra DNS resolution using busybox | ||
- name: check-cassandra-dns | ||
image: busybox | ||
command: ['sh', '-c', ' | ||
until nslookup {{ $.Values.cassandra.seeds }}; do | ||
echo "Waiting for Cassandra service DNS resolution..."; | ||
sleep 5; | ||
done; | ||
echo "Cassandra service DNS resolved."; | ||
'] | ||
# Check Cassandra readiness using cqlsh | ||
- name: check-cassandra-ready | ||
image: {{ .Values.image.repository }}:{{ .Values.image.tag }} | ||
command: ['sh', '-c', ' | ||
until cqlsh {{ $.Values.cassandra.seeds }} 9042 -e "SHOW VERSION"; do | ||
echo "Waiting for Cassandra to start..."; | ||
sleep 30; | ||
done; | ||
echo "Cassandra is up and running."; | ||
'] | ||
containers: | ||
- name: schema-setup | ||
image: {{ .Values.image.repository }}:{{ .Values.image.tag }} | ||
imagePullPolicy: IfNotPresent | ||
env: | ||
- name: CASSANDRA_SEEDS | ||
value: {{ $.Values.cassandra.seeds }} | ||
- name: KEYSPACE | ||
value: cadence | ||
- name: VISIBILITY_KEYSPACE | ||
value: cadence_visibility | ||
- name: RF | ||
value: "1" | ||
- name: CADENCE_HOME | ||
value: /etc/cadence | ||
args: ['sh', '-c', ' | ||
SCHEMA_DIR=$CADENCE_HOME/schema/cassandra/cadence/versioned; | ||
cadence-cassandra-tool --ep $CASSANDRA_SEEDS create -k $KEYSPACE --rf $RF; | ||
cadence-cassandra-tool --ep $CASSANDRA_SEEDS -k $KEYSPACE setup-schema -v 0.0; | ||
cadence-cassandra-tool --ep $CASSANDRA_SEEDS -k $KEYSPACE update-schema -d $SCHEMA_DIR; | ||
|
||
VISIBILITY_SCHEMA_DIR=$CADENCE_HOME/schema/cassandra/visibility/versioned; | ||
cadence-cassandra-tool --ep $CASSANDRA_SEEDS create -k $VISIBILITY_KEYSPACE --rf $RF; | ||
cadence-cassandra-tool --ep $CASSANDRA_SEEDS -k $VISIBILITY_KEYSPACE setup-schema -v 0.0; | ||
cadence-cassandra-tool --ep $CASSANDRA_SEEDS -k $VISIBILITY_KEYSPACE update-schema -d $VISIBILITY_SCHEMA_DIR; | ||
'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ include "cadence.fullname" . }} | ||
labels: | ||
app.kubernetes.io/name: {{ include "cadence.name" . }} | ||
helm.sh/chart: {{ include "cadence.chart" . }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} | ||
app.kubernetes.io/part-of: {{ .Chart.Name }} | ||
data: | ||
dynamic_config.yaml: |- | ||
{{- toYaml .Values.dynamicConfig.values | nindent 12 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
{{- range $service := (list "frontend" "history" "matching" "worker") }} | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: cadence-{{ $service }} | ||
labels: | ||
app: cadence | ||
component: {{ $service }} | ||
spec: | ||
replicas: {{ $.Values.deployment.replicaCount }} | ||
selector: | ||
matchLabels: | ||
app: cadence | ||
component: {{ $service }} | ||
template: | ||
metadata: | ||
labels: | ||
app: cadence | ||
component: {{ $service }} | ||
spec: | ||
initContainers: | ||
- name: wait-for-schema | ||
image: {{ $.Values.image.repository }}:{{ $.Values.image.tag }} | ||
command: ["sh", "-c", " | ||
until cqlsh {{ $.Values.cassandra.seeds }} 9042 -e \" | ||
USE cadence; | ||
SELECT curr_version FROM schema_version WHERE keyspace_name = 'cadence';\" | grep -q 0.37 && | ||
cqlsh {{ $.Values.cassandra.seeds }} 9042 -e \" | ||
USE cadence_visibility; | ||
SELECT curr_version FROM schema_version WHERE keyspace_name = 'cadence_visibility';\" | grep -q 0.9; | ||
do | ||
echo waiting for both cadence and cadence_visibility schema setup; | ||
sleep 10; | ||
done"] | ||
containers: | ||
- name: cadence-{{ $service }} | ||
image: {{ $.Values.image.repository }}:{{ $.Values.image.tag }} | ||
ports: | ||
- name: port-8000 | ||
containerPort: 8000 | ||
protocol: TCP | ||
- name: port-8001 | ||
containerPort: 8001 | ||
protocol: TCP | ||
- name: port-8002 | ||
containerPort: 8002 | ||
protocol: TCP | ||
- name: port-8003 | ||
containerPort: 8003 | ||
protocol: TCP | ||
- name: port-7933 | ||
containerPort: {{ if eq $service "frontend" }}7933{{ else if eq $service "history" }}7934{{ else if eq $service "matching" }}7935{{ else }}7939{{ end }} | ||
protocol: TCP | ||
- name: port-7833 | ||
containerPort: 7833 | ||
protocol: TCP | ||
volumeMounts: | ||
- name: config | ||
mountPath: /etc/cadence/config/dynamicconfig/config.yaml | ||
subPath: dynamic_config.yaml | ||
env: | ||
- name: CASSANDRA_SEEDS | ||
value: {{ $.Values.cassandra.seeds }} | ||
- name: PROMETHEUS_ENDPOINT_0 | ||
value: 0.0.0.0:8000 | ||
- name: PROMETHEUS_ENDPOINT_1 | ||
value: 0.0.0.0:8001 | ||
- name: PROMETHEUS_ENDPOINT_2 | ||
value: 0.0.0.0:8002 | ||
- name: PROMETHEUS_ENDPOINT_3 | ||
value: 0.0.0.0:8003 | ||
- name: DYNAMIC_CONFIG_FILE_PATH | ||
value: {{ $.Values.deployment.configPath }} | ||
- name: PRIMARY_FRONTEND_SERVICE | ||
value: cadence-frontend-service.{{ $.Release.Namespace }}.svc.cluster.local | ||
- name: BIND_ON_IP | ||
value: "0.0.0.0" | ||
- name: LOG_LEVEL | ||
value: {{ $.Values.log.level }} | ||
- name: LOG_STDOUT | ||
value: {{ $.Values.log.stdout | quote }} | ||
- name: ENABLE_ES | ||
value: {{ $.Values.deployment.enableES | quote }} | ||
- name: SKIP_SCHEMA_SETUP | ||
value: {{ $.Values.deployment.skipSchemaSetup | quote }} | ||
|
||
resources: | ||
limits: | ||
cpu: {{ $.Values.deployment.cpu.limit }} | ||
memory: {{ $.Values.deployment.memory.limit }} | ||
requests: | ||
cpu: {{ $.Values.deployment.cpu.request }} | ||
memory: {{ $.Values.deployment.memory.request }} | ||
volumes: | ||
- name: config | ||
configMap: | ||
name: {{ include "cadence.fullname" $ }} | ||
--- | ||
{{- end }} |
Oops, something went wrong.