Skip to content

Commit e07c24f

Browse files
authored
[heartex/label-studio] Native sidecar containers (#67)
1 parent 9dd8af2 commit e07c24f

File tree

6 files changed

+39
-137
lines changed

6 files changed

+39
-137
lines changed

heartex/label-studio/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
## 1.9.12
4+
- Added support for native sidecar containers (`initContainers` with `restartPolicy` of `Always`). Drop support for the old `sidecarContainers` values.
5+
36
## 1.9.11
47
- Added `args` to `sidecarContainers`.
58

heartex/label-studio/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ home: https://labelstud.io/
55
type: application
66
icon: https://raw.githubusercontent.com/heartexlabs/label-studio/master/images/logo.png
77
# Chart version
8-
version: 1.9.11
8+
version: 1.9.12
99
# Label Studio release version
1010
appVersion: "1.18.0"
1111
kubeVersion: ">= 1.14.0-0"

heartex/label-studio/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,6 @@ directory.
333333
| `app.pdb.create` | Enable/disable a Pod Disruption Budget creation | `true` |
334334
| `app.pdb.minAvailable` | Minimum number/percentage of pods that should remain scheduled | `""` |
335335
| `app.pdb.maxUnavailable` | Maximum number/percentage of pods that may be made unavailable. Defaults to `1` if both `app.pdb.minAvailable` and `app.pdb.maxUnavailable` are empty. | `""` |
336-
| `app.sidecarContainers` | Additional sidecar containers to the App Deployment pod | `[]` |
337336

338337
### Rqworker parameters
339338

heartex/label-studio/templates/app-deployment.yaml

Lines changed: 35 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,25 @@ spec:
4242
{{- end }}
4343
automountServiceAccountToken: {{ .Values.app.automountServiceAccountToken }}
4444
initContainers:
45-
- name: db-migrations
46-
image: "{{ .Values.global.image.registry | default "docker.io" }}/{{ .Values.global.image.repository }}:{{ .Values.global.image.tag | default .Chart.AppVersion }}"
47-
args: [ "label-studio-migrate" ]
48-
imagePullPolicy: {{ .Values.global.image.pullPolicy }}
49-
{{- if .Values.app.containerSecurityContext.enabled }}
50-
securityContext: {{- omit .Values.app.containerSecurityContext "enabled" | toYaml | nindent 12 }}
45+
{{- if .Values.app.initContainers }}
46+
{{- range .Values.app.initContainers }}
47+
- name: {{ .name }}
48+
image: {{ or .image (printf "%s/%s:%s" ($.Values.global.image.registry | default "docker.io") $.Values.global.image.repository $.Values.global.image.tag) ($.Chart.AppVersion) }}
49+
args: {{- range .args }}
50+
- {{ . }}
51+
{{- end }}
52+
imagePullPolicy: {{ or .pullPolicy $.Values.global.image.pullPolicy }}
53+
{{- if .restartPolicy }}
54+
restartPolicy: {{ .restartPolicy }}
55+
{{- end }}
56+
{{- if $.Values.app.containerSecurityContext.enabled }}
57+
securityContext: {{- omit $.Values.app.containerSecurityContext "enabled" | toYaml | nindent 12 }}
5158
{{- end }}
52-
resources:
53-
{{- toYaml .Values.app.initContainer.resources | nindent 12 }}
5459
env:
55-
{{- include "ls.common.envs" . | nindent 12 }}
60+
{{- include "ls.common.envs" $ | nindent 12 }}
5661
- name: INIT_CONTAINER
5762
value: "true"
58-
{{- if .Values.app.debug }}
63+
{{- if $.Values.app.debug }}
5964
- name: DEBUG
6065
value: "true"
6166
{{- end }}
@@ -66,33 +71,33 @@ spec:
6671
name: opt-heartex-init
6772
- mountPath: /tmp
6873
name: tmp-dir-init
69-
{{- if .Values.global.pgConfig.ssl.pgSslSecretName }}
74+
{{- if $.Values.global.pgConfig.ssl.pgSslSecretName }}
7075
- name: pg-ssl-certs
7176
mountPath: /opt/heartex/secrets/pg_certs
7277
{{- end }}
73-
{{- if .Values.global.redisConfig.ssl.redisSslSecretName }}
78+
{{- if $.Values.global.redisConfig.ssl.redisSslSecretName }}
7479
- name: redis-ssl-certs
7580
mountPath: /opt/heartex/secrets/redis_certs
7681
{{- end }}
77-
{{- if .Values.app.extraVolumeMounts }}
78-
{{ toYaml .Values.app.extraVolumeMounts | nindent 12 }}
82+
{{- if .extraVolumeMounts }}
83+
{{ toYaml .extraVolumeMounts | nindent 12 }}
7984
{{- end }}
80-
{{- if .Values.app.initContainers }}
81-
{{- range .Values.app.initContainers }}
82-
- name: {{ .name }}
83-
image: {{ or .image (printf "%s:%s" $.Values.global.image.repository $.Values.global.image.tag) ($.Chart.AppVersion) }}
84-
args: {{- range .args }}
85-
- {{ . }}
8685
{{- end }}
87-
imagePullPolicy: {{ or .pullPolicy $.Values.global.image.pullPolicy }}
88-
{{- if $.Values.app.containerSecurityContext.enabled }}
89-
securityContext: {{- omit $.Values.app.containerSecurityContext "enabled" | toYaml | nindent 12 }}
9086
{{- end }}
87+
- name: db-migrations
88+
image: "{{ .Values.global.image.registry | default "docker.io" }}/{{ .Values.global.image.repository }}:{{ .Values.global.image.tag | default .Chart.AppVersion }}"
89+
args: [ "label-studio-migrate" ]
90+
imagePullPolicy: {{ .Values.global.image.pullPolicy }}
91+
{{- if .Values.app.containerSecurityContext.enabled }}
92+
securityContext: {{- omit .Values.app.containerSecurityContext "enabled" | toYaml | nindent 12 }}
93+
{{- end }}
94+
resources:
95+
{{- toYaml .Values.app.initContainer.resources | nindent 12 }}
9196
env:
92-
{{- include "ls.common.envs" $ | nindent 12 }}
97+
{{- include "ls.common.envs" . | nindent 12 }}
9398
- name: INIT_CONTAINER
9499
value: "true"
95-
{{- if $.Values.app.debug }}
100+
{{- if .Values.app.debug }}
96101
- name: DEBUG
97102
value: "true"
98103
{{- end }}
@@ -103,19 +108,17 @@ spec:
103108
name: opt-heartex-init
104109
- mountPath: /tmp
105110
name: tmp-dir-init
106-
{{- if $.Values.global.pgConfig.ssl.pgSslSecretName }}
111+
{{- if .Values.global.pgConfig.ssl.pgSslSecretName }}
107112
- name: pg-ssl-certs
108113
mountPath: /opt/heartex/secrets/pg_certs
109114
{{- end }}
110-
{{- if $.Values.global.redisConfig.ssl.redisSslSecretName }}
115+
{{- if .Values.global.redisConfig.ssl.redisSslSecretName }}
111116
- name: redis-ssl-certs
112117
mountPath: /opt/heartex/secrets/redis_certs
113118
{{- end }}
114-
{{- if .extraVolumeMounts }}
115-
{{ toYaml .extraVolumeMounts | nindent 12 }}
119+
{{- if .Values.app.extraVolumeMounts }}
120+
{{ toYaml .Values.app.extraVolumeMounts | nindent 12 }}
116121
{{- end }}
117-
{{- end }}
118-
{{- end }}
119122
terminationGracePeriodSeconds: {{ .Values.app.terminationGracePeriodSeconds }}
120123
containers:
121124
- name: app
@@ -318,49 +321,7 @@ spec:
318321
- name: "uwsgimetrics"
319322
containerPort: 9117
320323
{{- end }}
321-
{{- if .Values.app.sidecarContainers }}
322-
{{- range .Values.app.sidecarContainers }}
323-
- name: {{ .name }}
324-
image: {{ .image }}
325-
imagePullPolicy: {{ .imagePullPolicy | default "IfNotPresent" }}
326-
{{- if .args }}
327-
args: {{ .args }}
328-
{{- end }}
329-
{{- if .securityContext }}
330-
securityContext: {{ toYaml .securityContext | nindent 12 }}
331-
{{- end }}
332-
env:
333-
{{- include "ls.common.envs" $ | nindent 12 }}
334-
{{- if .extraEnvironmentVars -}}
335-
{{- range $key, $value := .extraEnvironmentVars }}
336-
- name: {{ printf "%s" $key | replace "." "_" | upper | quote }}
337-
value: {{ $value | quote }}
338-
{{- end }}
339-
{{- end }}
340-
{{- if .extraEnvironmentSecrets -}}
341-
{{- range $key, $value := .extraEnvironmentSecrets }}
342-
- name: {{ printf "%s" $key | replace "." "_" | upper | quote }}
343-
valueFrom:
344-
secretKeyRef:
345-
name: {{ $value.secretName }}
346-
key: {{ $value.secretKey }}
347-
{{- end }}
348-
{{- end }}
349-
{{- if .readinessProbe }}
350-
readinessProbe: {{ toYaml .readinessProbe | nindent 12 }}
351-
{{- end }}
352-
{{- if .livenessProbe }}
353-
livenessProbe: {{ toYaml .livenessProbe | nindent 12 }}
354-
{{- end }}
355-
resources:
356-
{{- toYaml .resources | nindent 12 }}
357-
volumeMounts:
358-
{{- if .volumeMounts }}
359-
{{ toYaml .volumeMounts | nindent 12 }}
360-
{{- end }}
361-
{{- end }}
362-
{{- end }}
363-
{{- with .Values.app.nodeSelector }}
324+
{{- with .Values.app.nodeSelector }}
364325
nodeSelector:
365326
{{- toYaml . | nindent 8 }}
366327
{{- end }}

heartex/label-studio/values.schema.json

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -754,56 +754,6 @@
754754
}
755755
},
756756
"additionalProperties": false
757-
},
758-
"sidecarContainers": {
759-
"type": "array",
760-
"items": {
761-
"type": "object",
762-
"properties": {
763-
"name": {
764-
"type": "string"
765-
},
766-
"image": {
767-
"type": "string"
768-
},
769-
"imagePullPolicy": {
770-
"type": "string"
771-
},
772-
"args": {
773-
"type": "object",
774-
"additionalProperties": true
775-
},
776-
"securityContext": {
777-
"type": "object",
778-
"additionalProperties": true
779-
},
780-
"extraEnvironmentVars": {
781-
"type": "object",
782-
"additionalProperties": true
783-
},
784-
"extraEnvironmentSecrets": {
785-
"type": "object",
786-
"additionalProperties": true
787-
},
788-
"readinessProbe": {
789-
"type": "object",
790-
"additionalProperties": true
791-
},
792-
"livenessProbe": {
793-
"type": "object",
794-
"additionalProperties": true
795-
},
796-
"resources": {
797-
"type": "object",
798-
"additionalProperties": true
799-
},
800-
"volumeMounts": {
801-
"type": "array",
802-
"additionalProperties": true
803-
}
804-
},
805-
"additionalProperties": false
806-
}
807757
}
808758
},
809759
"additionalProperties": false

heartex/label-studio/values.yaml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -392,17 +392,6 @@ app:
392392
minAvailable: ""
393393
maxUnavailable: ""
394394

395-
## Add additional sidecar containers to the App Deployment pod
396-
## ref: https://kubernetes.io/docs/concepts/workloads/pods/#sidecar-containers
397-
## e.g:
398-
## sidecarContainers:
399-
## - name: your-sidecar-name
400-
## image: your-sidecar-image
401-
## imagePullPolicy: Always
402-
## command: ['sh', '-c', 'echo "hello world"']
403-
##
404-
sidecarContainers: [ ]
405-
406395
rqworker:
407396
enabled: true
408397

0 commit comments

Comments
 (0)