-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add helm chart * fix typos * add volumeClaim and remove serviceName * changing postgres service to load balancer for access * add redis and redis-worker * fix sonar issues and resource limits * fix defaults and allow configurable limts * tag images with branch and allow use in templates * initialize table in dbt container * remove external load balancer * remove defaults in values template * change redis port * remove newline from env var * remove old templates and add couch2pg * multiple instances for couch2pg * allow user,dbs,port, and secure to vary * adding multi instance example
- Loading branch information
Showing
7 changed files
with
225 additions
and
0 deletions.
There are no files selected for viewing
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,24 @@ | ||
apiVersion: v2 | ||
name: cht_sync | ||
description: A Helm chart for Kubernetes | ||
|
||
# A chart can be either an 'application' or a 'library' chart. | ||
# | ||
# Application charts are a collection of templates that can be packaged into versioned archives | ||
# to be deployed. | ||
# | ||
# Library charts provide useful utilities or functions for the chart developer. They're included as | ||
# a dependency of application charts to inject those utilities and functions into the rendering | ||
# pipeline. Library charts do not define any templates and therefore cannot be deployed. | ||
type: application | ||
|
||
# This is the chart version. This version number should be incremented each time you make changes | ||
# to the chart and its templates, including the app version. | ||
# Versions are expected to follow Semantic Versioning (https://semver.org/) | ||
version: 0.1.0 | ||
|
||
# This is the version number of the application being deployed. This version number should be | ||
# incremented each time you make changes to the application. Versions are not expected to | ||
# follow Semantic Versioning. They should reflect the version the application is using. | ||
# It is recommended to use it with quotes. | ||
appVersion: "0.1.0" |
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,54 @@ | ||
{{- $couchdbs := .Values.couchdbs -}} | ||
{{- range $index, $service := $couchdbs }} | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: cht-sync-couch2pg--{{ $service.host | replace "." "-" }} | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: cht-sync | ||
template: | ||
metadata: | ||
labels: | ||
app: cht-sync | ||
spec: | ||
automountServiceAccountToken: false | ||
containers: | ||
- name: couch2pg | ||
image: medicmobile/cht-sync-couch2pg:{{ $.Values.image_tag | default "latest" }} | ||
resources: | ||
limits: | ||
cpu: {{ ($.Values.couch2pg).cpu_limit | default "500m" }} | ||
memory: {{ ($.Values.couch2pg).memory_limit | default "1Gi" }} | ||
env: | ||
- name: POSTGRES_HOST | ||
value: {{ $.Values.postgres.host | default "postgres" }} | ||
- name: POSTGRES_USER | ||
value: {{ $.Values.postgres.user }} | ||
- name: POSTGRES_PORT | ||
value: {{ $.Values.postgres.port | default "5432" | quote }} | ||
- name: POSTGRES_PASSWORD | ||
value: {{ $.Values.postgres.password }} | ||
- name: POSTGRES_DB | ||
value: {{ $.Values.postgres.db }} | ||
- name: POSTGRES_TABLE | ||
value: {{ $.Values.postgres.table }} | ||
- name: POSTGRES_SCHEMA | ||
value: {{ $.Values.postgres.schema }} | ||
- name: COUCHDB_USER | ||
value: {{ $service.user | default $.Values.couchdb.user }} | ||
- name: COUCHDB_PASSWORD | ||
value: {{ $service.password }} | ||
- name: COUCHDB_HOST | ||
value: {{ $service.host }} | ||
- name: COUCHDB_DBS | ||
value: {{ $service.dbs | default $.Values.couchdb.dbs }} | ||
- name: COUCHDB_PORT | ||
value: {{ ($service.port | default $.Values.couchdb.port) | quote }} | ||
- name: COUCHDB_SECURE | ||
value: {{ ($service.secure | default $.Values.couchdb.secure) | quote }} | ||
{{- end }} | ||
|
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,42 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: cht-sync-dbt | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: cht-sync | ||
template: | ||
metadata: | ||
labels: | ||
app: cht-sync | ||
spec: | ||
automountServiceAccountToken: false | ||
containers: | ||
- name: dbt | ||
image: medicmobile/dataemon:{{ .Values.image_tag | default "latest" }} | ||
resources: | ||
limits: | ||
cpu: {{ (.Values.dbt).cpu_limit | default "500m" }} | ||
memory: {{ (.Values.dbt).memory_limit | default "1Gi" }} | ||
env: | ||
- name: POSTGRES_HOST | ||
value: {{ .Values.postgres.host | default "postgres" }} | ||
- name: POSTGRES_USER | ||
value: {{ .Values.postgres.user }} | ||
- name: POSTGRES_PORT | ||
value: {{ .Values.postgres.port | default "5432" | quote }} | ||
- name: POSTGRES_PASSWORD | ||
value: {{ .Values.postgres.password }} | ||
- name: POSTGRES_DB | ||
value: {{ .Values.postgres.db }} | ||
- name: POSTGRES_TABLE | ||
value: {{ .Values.postgres.table }} | ||
- name: POSTGRES_SCHEMA | ||
value: {{ .Values.postgres.schema }} | ||
- name: ROOT_POSTGRES_SCHEMA | ||
value: {{ .Values.postgres.schema }} | ||
- name: CHT_PIPELINE_BRANCH_URL | ||
value: {{ .Values.cht_pipeline_branch_url }} | ||
|
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,13 @@ | ||
{{- if .Values.postgres.enabled }} | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: postgres | ||
spec: | ||
selector: | ||
inner.service: postgres | ||
ports: | ||
- protocol: TCP | ||
port: {{ .Values.postgres.port | default "5432" }} | ||
targetPort: 5432 | ||
{{- end }} |
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,47 @@ | ||
# templates/postgres.yaml | ||
|
||
{{- if .Values.postgres.enabled }} | ||
apiVersion: apps/v1 | ||
kind: StatefulSet | ||
metadata: | ||
name: cht-sync-postgres | ||
spec: | ||
serviceName: postgres | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: cht-sync | ||
inner.service: postgres | ||
template: | ||
metadata: | ||
labels: | ||
app: cht-sync | ||
inner.service: postgres | ||
spec: | ||
automountServiceAccountToken: false | ||
containers: | ||
- name: postgres-c | ||
image: postgres:13 | ||
resources: | ||
limits: | ||
cpu: {{ (.Values.postgres).cpu_limit | default "1000m" }} | ||
memory: {{ (.Values.postgres).memory_limit | default "2Gi" }} | ||
env: | ||
- name: POSTGRES_USER | ||
value: {{ .Values.postgres.user }} | ||
- name: POSTGRES_PASSWORD | ||
value: {{ .Values.postgres.password }} | ||
- name: POSTGRES_DB | ||
value: {{ .Values.postgres.db }} | ||
ports: | ||
- containerPort: {{ .Values.postgres.port | default "5432" }} | ||
|
||
volumeClaimTemplates: | ||
- metadata: | ||
name: postgres-data | ||
spec: | ||
accessModes: [ "ReadWriteOnce" ] | ||
resources: | ||
requests: | ||
storage: {{ .Values.postgres.storageSize | default "1Gi" }} | ||
{{- end }} |
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,10 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: postgrest | ||
spec: | ||
selector: | ||
inner.service: postgrest | ||
ports: | ||
- protocol: TCP | ||
port: 3000 |
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,35 @@ | ||
|
||
postgres: | ||
enabled: true # if true a postgres service will not be created in this cluster | ||
user: "" | ||
password: "" | ||
db: "" | ||
schema: "v1" | ||
table: "medic" | ||
host: "postgres" # if postgres is outside the cluster | ||
port: 5432 # if postgres is outside the cluster | ||
|
||
cht_pipeline_branch_url: "https://github.com/medic/cht-pipeline.git#main" | ||
|
||
# values shared by all couchdb instances | ||
# can be omitted if couchdb instances do not share any values | ||
couchdb: | ||
user: "" | ||
dbs: "medic" # space separated list of databases you want to sync e.g "medic medic-sentinel" | ||
port: "5984" | ||
secure: "true" # "true" if SSL is required | ||
|
||
# values for each couchdb instance | ||
# host and password are required | ||
# other values can be omitted if they are common to all couchdb instances and specified above | ||
couchdbs: | ||
- host: "host1" # required for all couchdb instances | ||
password: "" # required for all couchdb instances | ||
- host: "host2" | ||
password: "" | ||
- host: "host3" | ||
password: "" | ||
user: "user2" # required if different than above | ||
dbs: "medic medic_sentinel" # required if different than above | ||
port: "5984" # required if different than above | ||
secure: "true" # required if different than above |