Skip to content

Commit

Permalink
Merge Helm Chart release/v4.4.0 into master
Browse files Browse the repository at this point in the history
  • Loading branch information
agolybev committed Nov 15, 2024
2 parents cd7384a + d6f3349 commit bd3f60d
Show file tree
Hide file tree
Showing 12 changed files with 274 additions and 38 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Change log

## 4.4.0

### New Features

* Added the ability to connect to Redis Sentinel nodes with a password
* Added the ability to set additional custom env variables for containers
* Added the ability to add additional custom volumes for containers
* Added the ability to set up Nginx log format in the Proxy container

### Changes

* Released ONLYOFFICE Docs [v8.2.1](https://github.com/ONLYOFFICE/DocumentServer/blob/master/CHANGELOG.md#821)

## 4.3.0

### New Features
Expand Down
4 changes: 2 additions & 2 deletions Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ description: Helm chart for installing ONLYOFFICE Docs in Kubernetes

type: application

version: 4.3.0
version: 4.4.0

appVersion: 8.2.0
appVersion: 8.2.1
40 changes: 28 additions & 12 deletions README.md

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion sources/scripts/test_ds.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
redisPort = os.environ.get('REDIS_SERVER_PORT')
redisUser = os.environ.get('REDIS_SERVER_USER')
redisPassword = os.environ.get('REDIS_SERVER_PWD')
redisSentinelPassword = os.environ.get('REDIS_SENTINEL_PWD')
redisDBNum = os.environ.get('REDIS_SERVER_DB_NUM')
redisConnectTimeout = 15
if os.environ.get('REDIS_CLUSTER_NODES'):
Expand Down Expand Up @@ -102,7 +103,7 @@ def get_redis_sentinel_status():
from redis import Sentinel
global rc
try:
sentinel = Sentinel([(redisHost, redisPort)], socket_timeout=redisConnectTimeout)
sentinel = Sentinel([(redisHost, redisPort)], socket_timeout=redisConnectTimeout, sentinel_kwargs={'password': redisSentinelPassword})
master_host, master_port = sentinel.discover_master(redisSentinelGroupName)
rc = redis.Redis(
host=master_host,
Expand Down
2 changes: 1 addition & 1 deletion sources/shutdown-ds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ spec:
defaultMode: 0755
containers:
- name: shutdown-ds
image: onlyoffice/docs-utils:8.2.0-1
image: onlyoffice/docs-utils:8.2.1-1
command: ["/bin/sh", "-c"]
args: ["/scripts/stop.sh"]
volumeMounts:
Expand Down
33 changes: 33 additions & 0 deletions templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,39 @@ Return Redis password
{{- end }}
{{- end -}}

{{/*
Get the Redis Sentinel password secret
*/}}
{{- define "ds.redis.sentinel.secretName" -}}
{{- if or .Values.connections.redisSentinelPassword .Values.connections.redisSentinelNoPass -}}
{{- printf "%s-redis-sentinel" .Release.Name -}}
{{- else if .Values.connections.redisSentinelExistingSecret -}}
{{- printf "%s" (tpl .Values.connections.redisSentinelExistingSecret $) -}}
{{- end -}}
{{- end -}}

{{/*
Return true if a secret object should be created for Redis Sentinel
*/}}
{{- define "ds.redis.sentinel.createSecret" -}}
{{- if or .Values.connections.redisSentinelPassword .Values.connections.redisSentinelNoPass (not .Values.connections.redisSentinelExistingSecret) -}}
{{- true -}}
{{- end -}}
{{- end -}}

{{/*
Return Redis Sentinel password
*/}}
{{- define "ds.redis.sentinel.password" -}}
{{- if not (empty .Values.connections.redisSentinelPassword) }}
{{- .Values.connections.redisSentinelPassword }}
{{- else if .Values.connections.redisSentinelNoPass }}
{{- printf "" }}
{{- else }}
{{- required "A Redis Sentinel Password is required!" .Values.connections.redisSentinelPassword }}
{{- end }}
{{- end -}}

{{/*
Get the info auth password secret
*/}}
Expand Down
16 changes: 16 additions & 0 deletions templates/deployments/converter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ spec:
configMap:
name: {{ .Values.extraThemes.configMap }}
{{- end }}
{{- with .Values.converter.extraVolumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
terminationGracePeriodSeconds: {{ .Values.converter.terminationGracePeriodSeconds }}
{{- with .Values.converter.initContainers }}
initContainers:
Expand Down Expand Up @@ -143,6 +146,16 @@ spec:
secretKeyRef:
name: {{ template "ds.redis.secretName" . }}
key: {{ .Values.connections.redisSecretKeyName }}
{{- if eq .Values.connections.redisConnectorName "ioredis" }}
- name: REDIS_SENTINEL_PWD
valueFrom:
secretKeyRef:
name: {{ template "ds.redis.sentinel.secretName" . }}
key: {{ .Values.connections.redisSentinelSecretKeyName }}
{{- end }}
{{- with .Values.converter.extraEnvVars }}
{{- toYaml . | nindent 10 }}
{{- end }}
envFrom:
- secretRef:
name: {{ template "ds.jwt.secretName" . }}
Expand All @@ -168,3 +181,6 @@ spec:
mountPath: /var/www/{{ .Values.product.name }}/documentserver/web-apps/apps/common/main/resources/themes/{{ .Values.extraThemes.filename }}
subPath: {{ .Values.extraThemes.filename }}
{{- end }}
{{- with .Values.converter.extraVolumeMounts }}
{{- toYaml . | nindent 10 }}
{{- end }}
28 changes: 27 additions & 1 deletion templates/deployments/docservice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ spec:
configMap:
name: ds-welcome-page
{{- end }}
{{- with .Values.docservice.extraVolumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
terminationGracePeriodSeconds: {{ .Values.docservice.terminationGracePeriodSeconds }}
{{- with .Values.docservice.initContainers }}
initContainers:
Expand Down Expand Up @@ -150,8 +153,12 @@ spec:
livenessProbe: {{- omit .Values.proxy.livenessProbe "enabled" | toYaml | nindent 12 }}
{{- end }}
resources: {{ toYaml .Values.proxy.resources | nindent 12 }}
{{- if or .Values.proxy.infoAllowedIP .Values.proxy.infoAllowedUser }}
{{- if or .Values.proxy.infoAllowedIP .Values.proxy.infoAllowedUser .Values.proxy.extraEnvVars .Values.proxy.logFormat }}
env:
{{- if .Values.proxy.logFormat }}
- name: NGINX_LOG_FORMAT
value: {{ join "' '" .Values.proxy.logFormat }}
{{- end }}
{{- if .Values.proxy.infoAllowedIP }}
- name: INFO_ALLOWED_IP
value: {{ join " " .Values.proxy.infoAllowedIP }}
Expand All @@ -165,6 +172,9 @@ spec:
name: {{ template "ds.info.secretName" . }}
key: {{ .Values.proxy.infoAllowedSecretKeyName }}
{{- end }}
{{- with .Values.proxy.extraEnvVars }}
{{- toYaml . | nindent 10 }}
{{- end }}
{{- end }}
envFrom:
- configMapRef:
Expand All @@ -184,6 +194,9 @@ spec:
mountPath: /etc/nginx/includes/ds-example.conf
subPath: ds-example.conf
{{- end }}
{{- with .Values.proxy.extraVolumeMounts }}
{{- toYaml . | nindent 10 }}
{{- end }}

- name: docservice
image: {{ .Values.docservice.image.repository }}:{{ .Values.docservice.image.tag }}
Expand Down Expand Up @@ -222,6 +235,16 @@ spec:
secretKeyRef:
name: {{ template "ds.redis.secretName" . }}
key: {{ .Values.connections.redisSecretKeyName }}
{{- if eq .Values.connections.redisConnectorName "ioredis" }}
- name: REDIS_SENTINEL_PWD
valueFrom:
secretKeyRef:
name: {{ template "ds.redis.sentinel.secretName" . }}
key: {{ .Values.connections.redisSentinelSecretKeyName }}
{{- end }}
{{- with .Values.docservice.extraEnvVars }}
{{- toYaml . | nindent 10 }}
{{- end }}
envFrom:
- secretRef:
name: {{ template "ds.jwt.secretName" . }}
Expand All @@ -247,3 +270,6 @@ spec:
mountPath: /var/www/{{ .Values.product.name }}/documentserver/web-apps/apps/common/main/resources/themes/{{ .Values.extraThemes.filename }}
subPath: {{ .Values.extraThemes.filename }}
{{- end }}
{{- with .Values.docservice.extraVolumeMounts }}
{{- toYaml . | nindent 10 }}
{{- end }}
17 changes: 17 additions & 0 deletions templates/secrets/redis-sentinel-password.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{- if and (eq (include "ds.redis.sentinel.createSecret" .) "true") (eq .Values.connections.redisConnectorName "ioredis") }}
apiVersion: v1
kind: Secret
metadata:
name: {{ .Release.Name }}-redis-sentinel
namespace: {{ include "ds.namespace" . | quote }}
{{- if .Values.commonLabels }}
labels:
{{- include "ds.labels.commonLabels" . | trim | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "ds.annotations.commonAnnotations" ( dict "keyName" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
type: Opaque
stringData:
{{ .Values.connections.redisSentinelSecretKeyName }}: {{ include "ds.redis.sentinel.password" . | quote }}
{{- end }}
20 changes: 18 additions & 2 deletions templates/statefulset/example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,21 +84,37 @@ spec:
- containerPort: {{ .Values.example.containerPorts.http }}
name: http
resources: {{ toYaml .Values.example.resources | nindent 10 }}
{{- if .Values.example.extraEnvVars }}
env:
{{- with .Values.example.extraEnvVars }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
envFrom:
- secretRef:
name: {{ template "ds.jwt.secretName" . }}
- configMapRef:
name: example
{{- if .Values.example.extraConf.configMap }}
{{- if or .Values.example.extraConf.configMap .Values.example.extraVolumeMounts }}
volumeMounts:
{{- if .Values.example.extraConf.configMap }}
- name: example-custom-file
mountPath: /etc/{{ .Values.product.name }}/documentserver-example/{{ .Values.example.extraConf.filename }}
subPath: {{ .Values.example.extraConf.filename }}
{{- end }}
{{- with .Values.example.extraVolumeMounts }}
{{- toYaml . | nindent 10 }}
{{- end }}
{{- end }}
{{- if .Values.example.extraConf.configMap }}
{{- if or .Values.example.extraConf.configMap .Values.example.extraVolumes }}
volumes:
{{- if .Values.example.extraConf.configMap }}
- name: example-custom-file
configMap:
name: {{ .Values.example.extraConf.configMap }}
{{- end }}
{{- with .Values.example.extraVolumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
{{- end }}
11 changes: 7 additions & 4 deletions templates/tests/test-ds-pod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ spec:
secretKeyRef:
name: {{ template "ds.redis.secretName" . }}
key: {{ .Values.connections.redisSecretKeyName }}
{{- if eq .Values.connections.redisConnectorName "ioredis" }}
- name: REDIS_SENTINEL_PWD
valueFrom:
secretKeyRef:
name: {{ template "ds.redis.sentinel.secretName" . }}
key: {{ .Values.connections.redisSentinelSecretKeyName }}
{{- end }}
- name: STORAGE_S3
value: {{ .Values.persistence.storageS3 | quote }}
envFrom:
Expand All @@ -84,11 +91,7 @@ spec:
- name: test-ds
mountPath: /scripts/test_ds.py
subPath: test_ds.py
{{- if .Values.webProxy.enabled }}
command: ['http_proxy={{ .Values.webProxy.http }}', 'https_proxy={{ .Values.webProxy.https }}', 'no_proxy={{ .Values.webProxy.noProxy }}', 'python', '/scripts/test_ds.py']
{{- else }}
command: ['python', '/scripts/test_ds.py']
{{- end }}
volumes:
{{- if not .Values.persistence.storageS3 }}
- name: ds-files
Expand Down
Loading

0 comments on commit bd3f60d

Please sign in to comment.