Skip to content
Snippets Groups Projects
Commit d516a3e0 authored by Guillaume Samson's avatar Guillaume Samson
Browse files

swh/cassandra-replay: update configmap to support pg backend and filter/retry configuration

Related to swh/infra/sysadm-environment#4879
parent 760a85eb
No related branches found
No related tags found
1 merge request!51swh/cassandra-replay: update configmap to support pg backend and filter/retry configuration
{{ if .Values.storage_replayer.enabled -}} {{ if .Values.storage_replayer.enabled -}}
{{- $error_reporter := .Values.storage_replayer.error_reporter }} {{- $error_reporter := .Values.storage_replayer.error_reporter }}
{{- range $deployment, $deployment_config := .Values.storage_replayer.deployments -}} {{- range $deployment, $deployment_config := .Values.storage_replayer.deployments -}}
{{- $storageConfigIndent := ternary " " "" $.Values.storage_replayer.pipelineFilterRetry }}
--- ---
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: ConfigMap
...@@ -10,20 +11,38 @@ metadata: ...@@ -10,20 +11,38 @@ metadata:
data: data:
config.yml.template: | config.yml.template: |
storage: storage:
cls: {{ $.Values.storage_replayer.storageClass }} {{- with $.Values.storage_replayer }}
hosts: {{- if not .pipelineFilterRetry }}
{{- range $seed := $.Values.storage_replayer.cassandra.seeds }} cls: {{ .storageClass }}
- {{ $seed }} {{- else if .pipelineFilterRetry }}
cls: pipeline
steps:
- cls: filter
- cls: retry
- cls: {{ .storageClass }}
{{- end }} {{- end }}
keyspace: {{ $.Values.storage_replayer.cassandra.keySpace }} {{- end }}
consistency_level: {{ $.Values.storage_replayer.cassandra.consistencyLevel }} {{- if eq $.Values.storage_replayer.storageClass "cassandra" }}
{{- if $deployment_config.specific_options -}} {{- with $.Values.storage_replayer.cassandra }}
{{- range $option, $value := $deployment_config.specific_options }} {{ $storageConfigIndent }}hosts:
{{ $option }}: {{ $value }} {{- range $seed := .seeds }}
{{ $storageConfigIndent }} - {{ $seed }}
{{- end }} {{- end }}
{{ $storageConfigIndent }}keyspace: {{ .keySpace }}
{{ $storageConfigIndent }}consistency_level: {{ .consistencyLevel }}
{{- end }}
{{- else if eq $.Values.storage_replayer.storageClass "postgresql" }}
{{- with $.Values.storage_replayer.postgresql }}
{{ $storageConfigIndent }}db: host={{ .host }} port={{ .port | default "5432" }} user={{ .user | default "guest" }} dbname={{ .db | default "swh" }} password=${POSTGRESQL_PASSWORD}
{{- end }} {{- end }}
objstorage: {{- end }}
cls: noop {{- if $deployment_config.specific_options -}}
{{- range $option, $value := $deployment_config.specific_options }}
{{ $storageConfigIndent }}{{ $option }}: {{ $value }}
{{- end }}
{{- end }}
{{ $storageConfigIndent }} objstorage:
{{ $storageConfigIndent }} cls: noop
journal_client: journal_client:
cls: kafka cls: kafka
......
...@@ -37,6 +37,18 @@ spec: ...@@ -37,6 +37,18 @@ spec:
args: args:
- -c - -c
- eval echo "\"$(</etc/swh/configuration-template/config.yml.template)\"" > /etc/swh/config.yml - eval echo "\"$(</etc/swh/configuration-template/config.yml.template)\"" > /etc/swh/config.yml
{{- if eq $.Values.storage_replayer.storageClass "postgresql" }}
{{ with .Values.storage_replayer.postgresql }}
env:
- name: POSTGRESQL_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .secretKeyRef }}
key: {{ .secretKeyName }}
# 'name' secret must exist & include that ^ key
optional: false
{{- end }}
{{- end }}
volumeMounts: volumeMounts:
- name: configuration - name: configuration
mountPath: /etc/swh mountPath: /etc/swh
......
...@@ -69,7 +69,6 @@ tmpEphemeralStorage: ...@@ -69,7 +69,6 @@ tmpEphemeralStorage:
storage_replayer: storage_replayer:
enabled: false enabled: false
storageClass: cassandra # only cassandra is currently supported
maxMessagesBytes: "524288000" maxMessagesBytes: "524288000"
journalBrokers: journalBrokers:
# The name of the secret containing the BROKER_USER_PASSWORD value # The name of the secret containing the BROKER_USER_PASSWORD value
...@@ -78,6 +77,9 @@ storage_replayer: ...@@ -78,6 +77,9 @@ storage_replayer:
- broker1 - broker1
- broker2 - broker2
user: myuser user: myuser
## storage backend must be cassandra or postgresql
storageClass: cassandra
## if storageClass is cassandra
cassandra: cassandra:
initKeyspace: false # useful to ensure the cassandra database is bootstrapped initKeyspace: false # useful to ensure the cassandra database is bootstrapped
seeds: seeds:
...@@ -85,6 +87,17 @@ storage_replayer: ...@@ -85,6 +87,17 @@ storage_replayer:
- seed2 - seed2
keySpace: swh keySpace: swh
consistencyLevel: LOCAL_QUORUM consistencyLevel: LOCAL_QUORUM
## if storageClass is postgresql
#postgresql:
# host: db1
# port: '5432'
# user: pg_user
# dbname: swh
## name of the secret containing the $secretKeyName value
# secretKeyRef: swh-postgresql-common-secrets
# secretKeyName: storage-postgresql-password
## if pipeline/filter/retry is needed in storage configuration
pipelineFilterRetry: false
# optional 'replayer' configuration may be specified with a 'error_reporter' config # optional 'replayer' configuration may be specified with a 'error_reporter' config
# entry allowing to specify redis connection parameters. It will be used to report # entry allowing to specify redis connection parameters. It will be used to report
# non-recoverable replaying issues # non-recoverable replaying issues
...@@ -205,7 +218,7 @@ storage: ...@@ -205,7 +218,7 @@ storage:
# db: softwareheritage # db: softwareheritage
# user: guest # user: guest
# # name of the secret containing the $secretKeyName value # # name of the secret containing the $secretKeyName value
# secretKeyRef: common-secrets # secretKeyRef: swh-postgresql-common-secrets
# secretKeyName: storage-postgresql-password # secretKeyName: storage-postgresql-password
objstorage: objstorage:
cls: noop cls: noop
......
...@@ -15,7 +15,6 @@ tmpEphemeralStorage: ...@@ -15,7 +15,6 @@ tmpEphemeralStorage:
storage: 100Gi # no effects storage: 100Gi # no effects
storage_replayer: storage_replayer:
storageClass: cassandra # only cassandra is currently supported
maxMessagesBytes: "524288000" maxMessagesBytes: "524288000"
journalBrokers: journalBrokers:
# The name of the secret containing the BROKER_USER_PASSWORD value # The name of the secret containing the BROKER_USER_PASSWORD value
......
...@@ -21,6 +21,7 @@ storage_replayer: ...@@ -21,6 +21,7 @@ storage_replayer:
- kafka3.internal.softwareheritage.org:9094 - kafka3.internal.softwareheritage.org:9094
- kafka4.internal.softwareheritage.org:9094 - kafka4.internal.softwareheritage.org:9094
user: swh-cassandra-prod user: swh-cassandra-prod
storageClass: cassandra
cassandra: cassandra:
seeds: seeds:
- cassandra01.internal.softwareheritage.org - cassandra01.internal.softwareheritage.org
......
...@@ -19,6 +19,7 @@ storage_replayer: ...@@ -19,6 +19,7 @@ storage_replayer:
- journal1.internal.staging.swh.network:9094 - journal1.internal.staging.swh.network:9094
user: swh-cassandra-stg user: swh-cassandra-stg
secretName: swh-cassandra-broker-secret secretName: swh-cassandra-broker-secret
storageClass: cassandra
cassandra: cassandra:
initKeyspace: true # only to bootstrap a new cassandra database initKeyspace: true # only to bootstrap a new cassandra database
seeds: seeds:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment