Skip to content
This repository has been archived by the owner on Nov 13, 2024. It is now read-only.

Commit

Permalink
feat: configurable persistence
Browse files Browse the repository at this point in the history
  • Loading branch information
eshepelyuk committed Jun 29, 2021
1 parent fbf6043 commit cd2553f
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 7 deletions.
11 changes: 11 additions & 0 deletions templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,14 @@ app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{- define "apicurio-registry.image" -}}
{{- $sfx := "" -}}
{{- if hasKey . "sql" -}}
{{- $sfx = "sql" -}}
{{- else if hasKey . "kafka" -}}
{{- $sfx = "kafkasql" -}}
{{- else -}}
{{- $sfx = "mem" -}}
{{- end -}}
{{ printf "%s/%s-%s:%s" .image.registry .image.repository $sfx .image.tag }}
{{- end -}}
16 changes: 13 additions & 3 deletions templates/deployment-registry.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,30 @@ spec:
serviceAccountName: {{ include "apicurio-registry.name" . }}
containers:
- name: apicurio-registry
image: {{ .Values.registry.image.registry }}/{{ .Values.registry.image.repository }}:{{ .Values.registry.image.tag }}
image: {{ include "apicurio-registry.image" .Values.registry }}
ports:
- containerPort: 8080
name: http
protocol: TCP
env:
# - name: K_SINK
# value: http://localhost:8787/events
- name: REGISTRY_LOG_LEVEL
value: INFO
- name: LOG_LEVEL
value: INFO
- name: QUARKUS_PROFILE
value: prod
{{- if hasKey .Values.registry "sql" }}
- name: REGISTRY_DATASOURCE_URL
value: {{ .Values.registry.sql.url }}
- name: REGISTRY_DATASOURCE_USERNAME
value: {{ .Values.registry.sql.username }}
- name: REGISTRY_DATASOURCE_PASSWORD
value: {{ .Values.registry.sql.password }}
{{- end }}
{{- if hasKey .Values.registry "kafka" }}
- name: KAFKA_BOOTSTRAP_SERVERS
value: {{ .Values.registry.kafka.bootstrapServers }}
{{- end }}
livenessProbe:
httpGet:
path: /health/live
Expand Down
2 changes: 1 addition & 1 deletion templates/deployment-sync.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ spec:
spec:
serviceAccountName: {{ include "apicurio-registry.name" . }}
containers:
- name: kube-sync
- name: artf-sync
image: {{ .Values.sync.image.registry }}/{{ .Values.sync.image.repository }}:{{ .Values.sync.image.tag }}
imagePullPolicy: "Always"
env:
Expand Down
25 changes: 24 additions & 1 deletion test/linter/test.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
set -x

helm lint . --strict
if [ $? -ne 0 ]; then
Expand All @@ -25,3 +24,27 @@ helm lint . --strict --set 'sync.watchNamespaces=null'
if [ $? -ne 0 ]; then
exit 1
fi

helm lint . --strict --set 'registry.kafka.bootstrapServers=kafka1'
if [ $? -ne 0 ]; then
exit 1
fi

helm lint . --strict --set 'registry.kafka.bootstrap=kafka1'
if [ $? -eq 0 ]; then
exit 1
fi

helm lint . --strict --set 'registry.sql.url=c,registry.sql.username=a,registry.sql.password=b'
if [ $? -ne 0 ]; then
exit 1
fi

helm lint . --strict --set 'registry.sql.url=c,registry.sql.username=a,registry.sql.pwd=b'
if [ $? -eq 0 ]; then
exit 1
fi

echo "=================================================================================="
echo " LINT PASSED"
echo "=================================================================================="
23 changes: 22 additions & 1 deletion values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,24 @@
"type": "object"
}
}
},
"persistence": {
"kafka": {
"type": "object", "additionalProperties": false,
"required": ["bootstrapServers"],
"properties": {
"bootstrapServers": {"type": "string"}
}
},
"sql": {
"type": "object", "additionalProperties": false,
"required": ["url", "username", "password"],
"properties": {
"url": {"type": "string"},
"username": {"type": "string"},
"password": {"type": "string"}
}
}
}
},

Expand All @@ -36,10 +54,13 @@
"registry": {
"type": "object", "title": "registry settings",
"required": ["enabled", "image", "resources"],
"additionalProperties": false,
"properties": {
"enabled": {"$ref": "#/definitions/isEnabled"},
"image": {"$ref": "#/definitions/dockerImage"},
"resources": {"$ref": "#/definitions/podResources"}
"resources": {"$ref": "#/definitions/podResources"},
"kafka": {"$ref": "#/definitions/persistence/kafka"},
"sql": {"$ref": "#/definitions/persistence/sql"}
}
},
"sync": {
Expand Down
13 changes: 12 additions & 1 deletion values.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
registry:
enabled: true

## uncomment and adjust for kafka persistence
# kafka:
# bootstrapServers: kafka1:9092,kafka2:9092

## uncomment and adjust for sql persistence
# sql:
# url: jdbc:postgresql://postgres/apicurio-registry
# username: apicurio
# password: apicurio-password

image:
registry: "quay.io"
repository: "apicurio/apicurio-registry-mem"
repository: "apicurio/apicurio-registry"
tag: "2.0.0.Final"
resources: {}
# limits:
Expand Down

0 comments on commit cd2553f

Please sign in to comment.