|
| 1 | +{{/* Exactly one datastore backend must be enabled */}} |
| 2 | +{{- include "dss.validate-datastore" . -}} |
| 3 | +{{- if .Values.raft.enabled }} |
| 4 | +{{- $dss := .Values.dss -}} |
| 5 | +{{- $raft := .Values.raft -}} |
| 6 | +{{- $ridPeers := include "dss.raft-peers" (dict "releaseName" .Release.Name "base" $raft.nodeIDBase "replicas" $raft.replicas "port" $raft.ports.rid) -}} |
| 7 | +{{- $scdPeers := include "dss.raft-peers" (dict "releaseName" .Release.Name "base" $raft.nodeIDBase "replicas" $raft.replicas "port" $raft.ports.scd) -}} |
| 8 | +{{- $auxPeers := include "dss.raft-peers" (dict "releaseName" .Release.Name "base" $raft.nodeIDBase "replicas" $raft.replicas "port" $raft.ports.aux) -}} |
| 9 | + |
| 10 | +--- |
| 11 | +apiVersion: v1 |
| 12 | +kind: Service |
| 13 | +metadata: |
| 14 | + labels: |
| 15 | + name: {{.Release.Name}}-core-service-headless |
| 16 | + name: {{.Release.Name}}-core-service-headless |
| 17 | +spec: |
| 18 | + clusterIP: None |
| 19 | + selector: |
| 20 | + app: {{.Release.Name}}-core-service |
| 21 | + ports: |
| 22 | + - port: {{ $raft.ports.aux }} |
| 23 | + targetPort: {{ $raft.ports.aux }} |
| 24 | + protocol: TCP |
| 25 | + name: raft-aux |
| 26 | + - port: {{ $raft.ports.rid }} |
| 27 | + targetPort: {{ $raft.ports.rid }} |
| 28 | + protocol: TCP |
| 29 | + name: raft-rid |
| 30 | + - port: {{ $raft.ports.scd }} |
| 31 | + targetPort: {{ $raft.ports.scd }} |
| 32 | + protocol: TCP |
| 33 | + name: raft-scd |
| 34 | + |
| 35 | +--- |
| 36 | +apiVersion: apps/v1 |
| 37 | +kind: StatefulSet |
| 38 | +metadata: |
| 39 | + labels: |
| 40 | + name: {{.Release.Name}}-core-service |
| 41 | + name: {{.Release.Name}}-core-service |
| 42 | +spec: |
| 43 | + minReadySeconds: 30 |
| 44 | + serviceName: {{.Release.Name}}-core-service-headless |
| 45 | + replicas: {{ $raft.replicas }} |
| 46 | + selector: |
| 47 | + matchLabels: |
| 48 | + app: {{.Release.Name}}-core-service |
| 49 | + template: |
| 50 | + metadata: |
| 51 | + labels: |
| 52 | + app: {{.Release.Name}}-core-service |
| 53 | +{{ if $dss.conf.enableDssMetrics }} |
| 54 | + annotations: |
| 55 | + prometheus.io/path: metrics |
| 56 | + prometheus.io/port: '8079' |
| 57 | + prometheus.io/scrape: 'true' |
| 58 | +{{ end }} |
| 59 | + spec: |
| 60 | + containers: |
| 61 | + - name: core-service |
| 62 | +{{/* The node ID is derived from the pod ordinal at runtime: pod <name>-N is raft node <N + nodeIDBase>. */}} |
| 63 | + command: |
| 64 | + - sh |
| 65 | + - -c |
| 66 | + args: |
| 67 | + - | |
| 68 | + exec core-service \ |
| 69 | + --accepted_jwt_audiences={{$dss.conf.hostname}} \ |
| 70 | + --addr=:8080 \ |
| 71 | +{{ if $dss.conf.publicEndpoint }} |
| 72 | + --public_endpoint={{$dss.conf.publicEndpoint}} \ |
| 73 | +{{ end }} |
| 74 | + --locality={{$dss.conf.locality}} \ |
| 75 | + --store_type=raft \ |
| 76 | + --raft_node_id=$(( ${HOSTNAME##*-} + {{ $raft.nodeIDBase }} )) \ |
| 77 | + --raft_cluster_id={{ $raft.clusterID }} \ |
| 78 | + --raft_datadir={{ $raft.datadir }} \ |
| 79 | +{{ range $flag, $value := $raft.tuning }} |
| 80 | + --{{ $flag }}={{ $value }} \ |
| 81 | +{{ end }} |
| 82 | + --rid_raft_peers='{{ $ridPeers }}' \ |
| 83 | + --scd_raft_peers='{{ $scdPeers }}' \ |
| 84 | + --aux_raft_peers='{{ $auxPeers }}' \ |
| 85 | + --enable_scd={{$dss.conf.enableScd}} \ |
| 86 | + --enable_scd_global_lock={{$dss.conf.enableScdGlobalLock | default false}} \ |
| 87 | +{{ if $dss.conf.enableTimeBasedNotificationIndex }} |
| 88 | + --enable_time_based_notification_index=true \ |
| 89 | +{{ end }} |
| 90 | +{{ if $dss.conf.enableDssMetrics }} |
| 91 | + --enable_metrics=true \ |
| 92 | +{{ end }} |
| 93 | + --gcp_prof_service_name= \ |
| 94 | +{{ if $dss.conf.jwksEndpoint }} |
| 95 | + --jwks_endpoint={{ $dss.conf.jwksEndpoint }} \ |
| 96 | +{{ end }} |
| 97 | +{{ if $dss.conf.jwksKeyIds }} |
| 98 | + --jwks_key_ids={{ $dss.conf.jwksKeyIds | join "," }} \ |
| 99 | +{{ end }} |
| 100 | +{{ if $dss.conf.pubKeys }} |
| 101 | + --public_key_files={{ $dss.conf.pubKeys | join "," }} \ |
| 102 | +{{ end }} |
| 103 | + image: {{ $dss.image }} |
| 104 | + imagePullPolicy: {{ $dss.imagePullPolicy | default "Always" }} |
| 105 | + ports: |
| 106 | + - containerPort: 8080 |
| 107 | + name: http |
| 108 | +{{ if $dss.conf.enableDssMetrics }} |
| 109 | + - containerPort: 8079 |
| 110 | + name: metrics |
| 111 | +{{ end }} |
| 112 | + - containerPort: {{ $raft.ports.aux }} |
| 113 | + name: raft-aux |
| 114 | + - containerPort: {{ $raft.ports.rid }} |
| 115 | + name: raft-rid |
| 116 | + - containerPort: {{ $raft.ports.scd }} |
| 117 | + name: raft-scd |
| 118 | + readinessProbe: |
| 119 | + httpGet: |
| 120 | + path: /healthy |
| 121 | + port: 8080 |
| 122 | + resources: |
| 123 | +{{ toYaml $raft.resources | indent 12 }} |
| 124 | + stdin: false |
| 125 | + tty: false |
| 126 | + volumeMounts: |
| 127 | + - mountPath: {{ $raft.datadir }} |
| 128 | + name: raft-data |
| 129 | + {{- include "public-certs:volumeMount" (dict "cockroachdbEnabled" false) | nindent 12 }} |
| 130 | + imagePullSecrets: [] |
| 131 | + terminationGracePeriodSeconds: 30 |
| 132 | + volumes: |
| 133 | + {{- include "public-certs:volume" (dict "cockroachdbEnabled" false) | nindent 8 }} |
| 134 | + volumeClaimTemplates: |
| 135 | + - metadata: |
| 136 | + name: raft-data |
| 137 | + spec: |
| 138 | + accessModes: |
| 139 | + - ReadWriteOnce |
| 140 | +{{ if $raft.storage.storageClass }} |
| 141 | + storageClassName: {{ $raft.storage.storageClass }} |
| 142 | +{{ end }} |
| 143 | + resources: |
| 144 | + requests: |
| 145 | + storage: {{ $raft.storage.size }} |
| 146 | +{{- end }} |
0 commit comments