Skip to content

Commit 9f207de

Browse files
authored
Issue 121: Supplying init containers within helm charts (#148)
* Adds support for initContainers and prestartCommand within the schema registry helm charts Signed-off-by: SrishT <[email protected]>
1 parent 9e399e7 commit 9f207de

File tree

6 files changed

+64
-8
lines changed

6 files changed

+64
-8
lines changed

charts/schema-registry/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ apiVersion: v2
1212
name: schema-registry
1313
description: Schema Registry Helm chart for Kubernetes
1414
type: application
15-
version: 0.0.1
16-
appVersion: 0.0.1
15+
version: 0.1.0
16+
appVersion: 0.1.0
1717
home: https://github.com/pravega/schema-registry

charts/schema-registry/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,16 @@ The following table lists the configurable parameters of the schema registry cha
4949
| Parameter | Description | Default |
5050
| ----- | ----------- | ------ |
5151
| `replicas` | Number of replicas | `2` |
52-
| `image.repository` | Repository for schema registry image | `pravega/schema-registry` |
53-
| `image.tag` | Tag for schema registry image | `0.0.1` |
52+
| `image.repository` | Repository for schema registry image | `pravega/schemaregistry` |
53+
| `image.tag` | Tag for schema registry image | `0.1.0` |
5454
| `image.pullPolicy` | Pull policy for schema registry image | `IfNotPresent` |
5555
| `serviceAccount.create` | Whether to create a service account | `true` |
5656
| `serviceAccount.name` | Name of the service account | `schema-registry` |
5757
| `serviceAccount.annotations` | Annotations to be added to the service account | |
5858
| `service.type` | Schema registry service type | `LoadBalancer` |
5959
| `service.port` | Schema registry service port | `9092` |
60+
| `initContainer` | Configuration for the init container | `{}` |
61+
| `container` | Additional configuration for the schema registry container, to be provided if an init container has been configured | `{}` |
6062
| `ingress.enabled` | Whether to expose as an ingress resource | `false` |
6163
| `ingress.path` | Path for the ingress | `/` |
6264
| `ingress.annotations` | Annotations for the ingress | `{}` |

charts/schema-registry/templates/configmap.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,8 @@ data:
4141
"TLS_KEY_FILE": "/etc/secret-volume/{{ .Values.tls.keyFile }}"
4242
"TLS_KEY_PASSWORD_FILE": "/etc/secret-volume/{{ .Values.tls.keyPasswordFile }}"
4343
{{- end }}
44+
{{- if and .Values.container .Values.container.command }}
45+
"PRE_START_CMD": "{{ .Values.container.command }}"
46+
{{- else }}
47+
"PRE_START_CMD": ""
48+
{{- end }}

charts/schema-registry/templates/deployment.yaml

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ spec:
4646
- sh
4747
- -c
4848
- netstat -ltn 2> /dev/null | grep {{ .Values.service.port }} || ss -ltn 2> /dev/null | grep {{ .Values.service.port }}
49-
{{- if or .Values.authentication.enabled .Values.tls.enabled }}
49+
{{- if or .Values.authentication.enabled .Values.tls.enabled (and .Values.container .Values.container.volume) }}
5050
volumeMounts:
5151
{{- if .Values.authentication.enabled }}
5252
- name: auth-passwd-secret
@@ -58,8 +58,29 @@ spec:
5858
mountPath: /etc/secret-volume
5959
readOnly: true
6060
{{- end }}
61+
{{- if and .Values.container .Values.container.volume }}
62+
- name: transfer-data
63+
mountPath: {{ .Values.container.volume.mountPath }}
6164
{{- end }}
62-
{{- if or .Values.authentication.enabled .Values.tls.enabled }}
65+
{{- end }}
66+
{{- if .Values.initContainer }}
67+
initContainers:
68+
- name: {{ .Values.initContainer.name }}
69+
image: "{{ .Values.initContainer.image.repository }}:{{ .Values.initContainer.image.tag }}"
70+
imagePullPolicy: {{ .Values.initContainer.image.pullPolicy }}
71+
command:
72+
{{ toYaml .Values.initContainer.command | indent 12 }}
73+
{{- if .Values.initContainer.resources }}
74+
resources:
75+
{{ toYaml .Values.initContainer.command | indent 12 }}
76+
{{- end }}
77+
{{- if .Values.initContainer.volume }}
78+
volumeMounts:
79+
- name: transfer-data
80+
mountPath: {{ .Values.initContainer.volume.mountPath }}
81+
{{- end }}
82+
{{- end }}
83+
{{- if or .Values.authentication.enabled .Values.tls.enabled (and .Values.initContainer .Values.initContainer.volume) }}
6384
volumes:
6485
{{- if .Values.authentication.enabled }}
6586
- name: auth-passwd-secret
@@ -71,4 +92,8 @@ spec:
7192
secret:
7293
secretName: {{ .Values.tls.secret }}
7394
{{- end }}
95+
{{- if and .Values.container .Values.container.volume }}
96+
- name: transfer-data
97+
emptyDir: {}
98+
{{- end }}
7499
{{- end }}

charts/schema-registry/values.yaml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
replicas: 2
1616

1717
image:
18-
repository: pravega/schema-registry
19-
tag: 0.0.1
18+
repository: pravega/schemaregistry
19+
tag: 0.1.0
2020
pullPolicy: IfNotPresent
2121

2222
## Service account name and whether to create it.
@@ -29,6 +29,26 @@ service:
2929
type: LoadBalancer
3030
port: 9092
3131

32+
initContainer: {}
33+
# name: ""
34+
# image:
35+
# repository:
36+
# tag:
37+
# pullPolicy: IfNotPresent
38+
## provide a list containing the command that needs to be executed within the init container
39+
## e.g. ["/bin/sh", "-c", "cp /data/* /target"]
40+
# command: []
41+
# resources: {}
42+
# volume:
43+
# mountPath: /target
44+
45+
container: {}
46+
## just provide the command to be executed within the entrypoint
47+
## e.g. "cp /additional_libs/* /opt/schema-registry/lib/"
48+
# command: ""
49+
# volume:
50+
# mountPath: /additional_libs
51+
3252
## Ingress configuration.
3353
ingress:
3454
enabled: false

docker/pravega-schema-registry/scripts/entrypoint.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,8 @@ if [ ${WAIT_FOR} ];then
2121
${SCRIPTS_DIR}/wait_for
2222
fi
2323

24+
if [[ -n "$PRE_START_CMD" ]];then
25+
$PRE_START_CMD
26+
fi
27+
2428
exec /opt/schema-registry/bin/schema-registry

0 commit comments

Comments
 (0)