Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Change log

## 6.1.0

### New Features

* Added the ability to set `revisionHistoryLimit` for the Docservice, Converter, Adminpanel and Example workloads (`docservice.revisionHistoryLimit`, `converter.revisionHistoryLimit`, `adminpanel.revisionHistoryLimit`, `example.revisionHistoryLimit`)
* Added the ability to take the AMQP username from an existing Secret (`connections.amqpUserExistingSecret`, `connections.amqpUserSecretKeyName`); when set, `AMQP_USER` is no longer rendered in the `documentserver` ConfigMap
* Added `checksum/*` annotations to the Docservice, Converter, Adminpanel and Example Pod templates, so the Pods are restarted when the ConfigMaps and Secrets rendered by the chart change
* Added `customResources.versionSalt` to force a new `DS_VERSION_HASH` after the content of the custom resources PVC changes

### Changes

* **Behavior change:** the default of `docservice.podAnnotations`, `converter.podAnnotations`, `adminpanel.podAnnotations` and `example.podAnnotations` is now `{}` instead of `rollme: "{{ randAlphaNum 5 | quote }}"`. Pods are no longer restarted on every `helm upgrade`, only when the hashed ConfigMaps/Secrets or the image change. Secrets and ConfigMaps not rendered by the chart (`*ExistingSecret`, WOPI keys, `extraConf`, `extraThemes`) and the custom resources PVC content require Stakater Reloader, versioned names or a change of `customResources.versionSalt`. The previous behavior can be restored by setting `rollme: "{{ randAlphaNum 5 | quote }}"` in `*.podAnnotations`
* `DS_VERSION_HASH` is no longer derived from the current time. It is computed from the image tag, the `customFonts` / `customDictionaries` / `customPlugins` settings and `customResources.versionSalt`, so the rendered output is deterministic (required for Argo CD)

### Fixes

* Fixed perpetual OutOfSync and unneeded rollouts under Argo CD caused by `rollme` and the time-based `DS_VERSION_HASH`

## 6.0.0

### New Features
Expand Down
2 changes: 1 addition & 1 deletion 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: 6.0.0
version: 6.1.0

appVersion: 9.3.1
24 changes: 20 additions & 4 deletions README.md

Large diffs are not rendered by default.

47 changes: 47 additions & 0 deletions templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -652,3 +652,50 @@ Get the Secret value
{{- printf "%s" $existValue -}}
{{- end -}}
{{- end -}}

{{/*
Concatenate the rendered output of the given chart templates.
Usage: include "ds.checksum.templates" (list . "configmaps/documentserver.yaml" ...)
*/}}
{{- define "ds.checksum.templates" -}}
{{- $context := first . -}}
{{- range rest . -}}
{{- include (print $context.Template.BasePath "/" .) $context -}}
{{- end -}}
{{- end -}}

{{/*
Deterministic inputs of the Secrets that use ds.secrets.lookup (their rendered output is random
under `helm template`, so the input values are used instead). Empty if the Secret is not created by the chart
*/}}
{{- define "ds.checksum.jwtInput" -}}
{{- if eq (include "ds.jwt.createSecret" .) "true" -}}
{{- toJson .Values.jwt -}}
{{- end -}}
{{- end -}}

{{- define "ds.checksum.secureLinkInput" -}}
{{- if eq (include "ds.secureLinkSecret.createSecret" .) "true" -}}
{{- .Values.proxy.secureLinkSecret -}}
{{- end -}}
{{- end -}}

{{- define "ds.checksum.infoAuthInput" -}}
{{- if eq (include "ds.info.createSecret" .) "true" -}}
{{- .Values.proxy.infoAllowedPassword -}}
{{- end -}}
{{- end -}}

{{/*
Render checksum annotations for the pod template. Entries with empty input are skipped.
A key that is also set in the user podAnnotations is skipped, so the user value wins and no duplicate key is rendered.
Usage: include "ds.annotations.checksums" (dict "podAnnotations" .Values.docservice.podAnnotations "checksums" (dict "checksum/config" "<input>"))
*/}}
{{- define "ds.annotations.checksums" -}}
{{- $user := default dict .podAnnotations -}}
{{- range $key, $input := .checksums }}
{{- if and $input (not (hasKey $user $key)) }}
{{ $key }}: {{ $input | sha256sum }}
{{- end }}
{{- end }}
{{- end -}}
4 changes: 3 additions & 1 deletion templates/configmaps/documentserver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ data:
AMQP_PORT: {{ .Values.connections.amqpPort | quote }}
AMQP_VHOST: {{ .Values.connections.amqpVhost | quote }}
AMQP_HOST: {{ .Values.connections.amqpHost }}
{{- if not .Values.connections.amqpUserExistingSecret }}
AMQP_USER: {{ .Values.connections.amqpUser }}
{{- end }}
AMQP_PROTO: {{ .Values.connections.amqpProto }}
METRICS_ENABLED: {{ .Values.metrics.enabled | quote }}
{{- if .Values.metrics.enabled }}
Expand Down Expand Up @@ -76,5 +78,5 @@ data:
{{- end }}
STORAGE_SUBDIRECTORY_NAME: {{ default .Values.images.tag .Values.docservice.image.tag }}
{{- if or .Values.customFonts.build .Values.customDictionaries.build .Values.customPlugins.build }}
DS_VERSION_HASH: {{ printf "%s" (now | date "2006.01.02-1504") | sha256sum | trunc 32 }}
DS_VERSION_HASH: {{ dict "imageTag" (default .Values.images.tag .Values.docservice.image.tag) "customFonts" .Values.customFonts "customDictionaries" .Values.customDictionaries "customPlugins" .Values.customPlugins "versionSalt" .Values.customResources.versionSalt | toJson | sha256sum | trunc 32 }}
{{- end }}
18 changes: 16 additions & 2 deletions templates/deployments/converter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ spec:
{{- if not .Values.converter.autoscaling.enabled }}
replicas: {{ .Values.converter.replicas }}
{{- end }}
{{- if not (kindIs "invalid" .Values.converter.revisionHistoryLimit) }}
revisionHistoryLimit: {{ .Values.converter.revisionHistoryLimit }}
{{- end }}
selector:
matchLabels:
app: {{ include "ds.resources.name" (list . .Values.commonNameSuffix "converter") }}
Expand All @@ -32,12 +35,16 @@ spec:
{{- if .Values.commonLabels }}
{{- include "ds.labels.commonLabels" . | trim | nindent 8 }}
{{- end }}
{{- if .Values.converter.podAnnotations }}
annotations:
{{- include "ds.annotations.checksums" (dict "podAnnotations" .Values.converter.podAnnotations "checksums" (dict
"checksum/config" (include "ds.checksum.templates" (list . "configmaps/documentserver.yaml"))
"checksum/credentials" (include "ds.checksum.templates" (list . "secrets/db-password.yaml" "secrets/rabbitmq-password.yaml" "secrets/redis-password.yaml" "secrets/redis-sentinel-password.yaml"))
"checksum/jwt" (include "ds.checksum.jwtInput" .)
"checksum/secure-link" (include "ds.checksum.secureLinkInput" .)
)) | trim | nindent 8 }}
{{- range $key, $value := .Values.converter.podAnnotations }}
{{ $key }}: {{ tpl $value $ }}
{{- end }}
{{- end }}
spec:
serviceAccountName: {{ include "ds.serviceAccountName" . }}
{{- if .Values.podSecurityContext.enabled }}
Expand Down Expand Up @@ -184,6 +191,13 @@ spec:
secretKeyRef:
name: {{ template "ds.rabbitmq.secretName" . }}
key: {{ .Values.connections.amqpSecretKeyName }}
{{- if .Values.connections.amqpUserExistingSecret }}
- name: AMQP_USER
valueFrom:
secretKeyRef:
name: {{ tpl .Values.connections.amqpUserExistingSecret $ }}
key: {{ .Values.connections.amqpUserSecretKeyName }}
{{- end }}
- name: REDIS_SERVER_PWD
valueFrom:
secretKeyRef:
Expand Down
20 changes: 18 additions & 2 deletions templates/deployments/docservice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ spec:
{{- if not .Values.docservice.autoscaling.enabled }}
replicas: {{ .Values.docservice.replicas }}
{{- end }}
{{- if not (kindIs "invalid" .Values.docservice.revisionHistoryLimit) }}
revisionHistoryLimit: {{ .Values.docservice.revisionHistoryLimit }}
{{- end }}
selector:
matchLabels:
app: {{ include "ds.resources.name" (list . .Values.commonNameSuffix "docservice") }}
Expand All @@ -32,12 +35,18 @@ spec:
{{- if .Values.commonLabels }}
{{- include "ds.labels.commonLabels" . | trim | nindent 8 }}
{{- end }}
{{- if .Values.docservice.podAnnotations }}
annotations:
{{- include "ds.annotations.checksums" (dict "podAnnotations" .Values.docservice.podAnnotations "checksums" (dict
"checksum/config" (include "ds.checksum.templates" (list . "configmaps/documentserver.yaml"))
"checksum/welcome-page" (include "ds.checksum.templates" (list . "configmaps/welcome-page.yaml"))
"checksum/credentials" (include "ds.checksum.templates" (list . "secrets/db-password.yaml" "secrets/rabbitmq-password.yaml" "secrets/redis-password.yaml" "secrets/redis-sentinel-password.yaml"))
"checksum/jwt" (include "ds.checksum.jwtInput" .)
"checksum/secure-link" (include "ds.checksum.secureLinkInput" .)
"checksum/info-auth" (include "ds.checksum.infoAuthInput" .)
)) | trim | nindent 8 }}
{{- range $key, $value := .Values.docservice.podAnnotations }}
{{ $key }}: {{ tpl $value $ }}
{{- end }}
{{- end }}
spec:
serviceAccountName: {{ include "ds.serviceAccountName" . }}
{{- if .Values.podSecurityContext.enabled }}
Expand Down Expand Up @@ -316,6 +325,13 @@ spec:
secretKeyRef:
name: {{ template "ds.rabbitmq.secretName" . }}
key: {{ .Values.connections.amqpSecretKeyName }}
{{- if .Values.connections.amqpUserExistingSecret }}
- name: AMQP_USER
valueFrom:
secretKeyRef:
name: {{ tpl .Values.connections.amqpUserExistingSecret $ }}
key: {{ .Values.connections.amqpUserSecretKeyName }}
{{- end }}
- name: REDIS_SERVER_PWD
valueFrom:
secretKeyRef:
Expand Down
18 changes: 16 additions & 2 deletions templates/statefulset/adminpanel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ metadata:
annotations: {{- include "ds.annotations.commonAnnotations" ( dict "keyName" $dictValue "context" $ ) | nindent 4 }}
{{- end }}
spec:
{{- if not (kindIs "invalid" .Values.adminpanel.revisionHistoryLimit) }}
revisionHistoryLimit: {{ .Values.adminpanel.revisionHistoryLimit }}
{{- end }}
selector:
matchLabels:
app: {{ include "ds.resources.name" (list . .Values.commonNameSuffix "adminpanel") }}
Expand All @@ -33,12 +36,16 @@ spec:
{{- if .Values.commonLabels }}
{{- include "ds.labels.commonLabels" . | trim | nindent 8 }}
{{- end }}
{{- if .Values.adminpanel.podAnnotations }}
annotations:
{{- include "ds.annotations.checksums" (dict "podAnnotations" .Values.adminpanel.podAnnotations "checksums" (dict
"checksum/config" (include "ds.checksum.templates" (list . "configmaps/documentserver.yaml"))
"checksum/credentials" (include "ds.checksum.templates" (list . "secrets/redis-password.yaml" "secrets/redis-sentinel-password.yaml"))
"checksum/jwt" (include "ds.checksum.jwtInput" .)
"checksum/secure-link" (include "ds.checksum.secureLinkInput" .)
)) | trim | nindent 8 }}
{{- range $key, $value := .Values.adminpanel.podAnnotations }}
{{ $key }}: {{ tpl $value $ }}
{{- end }}
{{- end }}
spec:
serviceAccountName: {{ include "ds.serviceAccountName" . }}
{{- if .Values.podSecurityContext.enabled }}
Expand Down Expand Up @@ -94,6 +101,13 @@ spec:
args:
- adminpanel
env:
{{- if .Values.connections.amqpUserExistingSecret }}
- name: AMQP_USER
valueFrom:
secretKeyRef:
name: {{ tpl .Values.connections.amqpUserExistingSecret $ }}
key: {{ .Values.connections.amqpUserSecretKeyName }}
{{- end }}
- name: REDIS_SERVER_PWD
valueFrom:
secretKeyRef:
Expand Down
9 changes: 7 additions & 2 deletions templates/statefulset/example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ metadata:
annotations: {{- include "ds.annotations.commonAnnotations" ( dict "keyName" $dictValue "context" $ ) | nindent 4 }}
{{- end }}
spec:
{{- if not (kindIs "invalid" .Values.example.revisionHistoryLimit) }}
revisionHistoryLimit: {{ .Values.example.revisionHistoryLimit }}
{{- end }}
selector:
matchLabels:
app: {{ include "ds.resources.name" (list . .Values.commonNameSuffix "example") }}
Expand All @@ -33,12 +36,14 @@ spec:
{{- if .Values.commonLabels }}
{{- include "ds.labels.commonLabels" . | trim | nindent 8 }}
{{- end }}
{{- if .Values.example.podAnnotations }}
annotations:
{{- include "ds.annotations.checksums" (dict "podAnnotations" .Values.example.podAnnotations "checksums" (dict
"checksum/config" (include "ds.checksum.templates" (list . "configmaps/example.yaml"))
"checksum/jwt" (include "ds.checksum.jwtInput" .)
)) | trim | nindent 8 }}
{{- range $key, $value := .Values.example.podAnnotations }}
{{ $key }}: {{ tpl $value $ }}
{{- end }}
{{- end }}
spec:
serviceAccountName: {{ include "ds.serviceAccountName" . }}
{{- if .Values.podSecurityContext.enabled }}
Expand Down
7 changes: 7 additions & 0 deletions templates/tests/test-ds-pod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ spec:
secretKeyRef:
name: {{ template "ds.rabbitmq.secretName" . }}
key: {{ .Values.connections.amqpSecretKeyName }}
{{- if .Values.connections.amqpUserExistingSecret }}
- name: AMQP_USER
valueFrom:
secretKeyRef:
name: {{ tpl .Values.connections.amqpUserExistingSecret $ }}
key: {{ .Values.connections.amqpUserSecretKeyName }}
{{- end }}
- name: REDIS_SERVER_PWD
valueFrom:
secretKeyRef:
Expand Down
44 changes: 36 additions & 8 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,14 @@ connections:
amqpVhost: "/"
## connections.amqpUser The username for the AMQP server account
amqpUser: user
## connections.amqpUserExistingSecret The name of existing secret to use for the AMQP server username
## If set to, `connections.amqpUser` is ignored and `AMQP_USER` is taken from this secret instead of the `documentserver` ConfigMap
## Must contain the key specified in `connections.amqpUserSecretKeyName`
## Do not also set `AMQP_USER` via `docservice.extraEnvVars` / `converter.extraEnvVars` / `adminpanel.extraEnvVars` when this option is used
## (duplicate env names; server-side apply in Argo CD can reject duplicate list keys)
amqpUserExistingSecret: ""
## connections.amqpUserSecretKeyName The name of the key that contains the AMQP server username
amqpUserSecretKeyName: rabbitmq-user
## connections.amqpProto The protocol for the connection to AMQP server
amqpProto: amqp
## connections.amqpExistingSecret The name of existing secret to use for AMQP server passwords
Expand Down Expand Up @@ -501,11 +509,15 @@ docservice:
## You can also use `tpl` as the value for the key
annotations: {}
## docservice.podAnnotations Map of annotations to add to the Docservice deployment pods
podAnnotations:
rollme: "{{ randAlphaNum 5 | quote }}"
## Checksum annotations (`checksum/*`) for the resources rendered by this chart are added automatically; a key set here takes priority
## To restart the pods on every render, set `rollme: "{{ randAlphaNum 5 | quote }}"` (not deterministic, not recommended with Argo CD)
podAnnotations: {}
## docservice.replicas Number of Docservice replicas to deploy
## If the `docservice.autoscaling.enabled` parameter is enabled, it is ignored
replicas: 2
## docservice.revisionHistoryLimit The number of old ReplicaSets to retain to allow rollback
## If not set (`null`), the Kubernetes default is used (10). `0` is a valid value
revisionHistoryLimit: null
## Update strategy used to replace old Pods by new ones. Allowed values: `RollingUpdate` or `Recreate`
## For Docservice deployment, it is recommended to use the `Recreate` type
## docservice.updateStrategy.type Docservice deployment update strategy type
Expand Down Expand Up @@ -956,11 +968,15 @@ converter:
## You can also use `tpl` as the value for the key
annotations: {}
## converter.podAnnotations Map of annotations to add to the Converter deployment pods
podAnnotations:
rollme: "{{ randAlphaNum 5 | quote }}"
## Checksum annotations (`checksum/*`) for the resources rendered by this chart are added automatically; a key set here takes priority
## To restart the pods on every render, set `rollme: "{{ randAlphaNum 5 | quote }}"` (not deterministic, not recommended with Argo CD)
podAnnotations: {}
## converter.replicas Number of Converter replicas to deploy
## If the `converter.autoscaling.enabled` parameter is enabled, it is ignored
replicas: 2
## converter.revisionHistoryLimit The number of old ReplicaSets to retain to allow rollback
## If not set (`null`), the Kubernetes default is used (10). `0` is a valid value
revisionHistoryLimit: null
## Update strategy used to replace old Pods by new ones. Allowed values: `RollingUpdate` or `Recreate`
## converter.updateStrategy.type Docservice deployment update strategy type
updateStrategy:
Expand Down Expand Up @@ -1179,8 +1195,12 @@ adminpanel:
## You can also use `tpl` as the value for the key
annotations: {}
## adminpanel.podAnnotations Map of annotations to add to the Adminpanel deployment pod
podAnnotations:
rollme: "{{ randAlphaNum 5 | quote }}"
## Checksum annotations (`checksum/*`) for the resources rendered by this chart are added automatically; a key set here takes priority
## To restart the pods on every render, set `rollme: "{{ randAlphaNum 5 | quote }}"` (not deterministic, not recommended with Argo CD)
podAnnotations: {}
## adminpanel.revisionHistoryLimit The number of old ControllerRevisions to retain to allow rollback
## If not set (`null`), the Kubernetes default is used (10). `0` is a valid value
revisionHistoryLimit: null
## Update strategy used to replace old Pods by new ones. Allowed values: `RollingUpdate` or `OnDelete`
## adminpanel.updateStrategy.type Adminpanel StatefulSet update strategy type
updateStrategy:
Expand Down Expand Up @@ -1348,8 +1368,12 @@ example:
## You can also use `tpl` as the value for the key
annotations: {}
## example.podAnnotations Map of annotations to add to the Example pod
podAnnotations:
rollme: "{{ randAlphaNum 5 | quote }}"
## Checksum annotations (`checksum/*`) for the resources rendered by this chart are added automatically; a key set here takes priority
## To restart the pods on every render, set `rollme: "{{ randAlphaNum 5 | quote }}"` (not deterministic, not recommended with Argo CD)
podAnnotations: {}
## example.revisionHistoryLimit The number of old ControllerRevisions to retain to allow rollback
## If not set (`null`), the Kubernetes default is used (10). `0` is a valid value
revisionHistoryLimit: null
## Update strategy used to replace old Pods by new ones. Allowed values: `RollingUpdate` or `OnDelete`
## example.updateStrategy.type Example StatefulSet update strategy type
updateStrategy:
Expand Down Expand Up @@ -2282,6 +2306,10 @@ wopiKeysDeletion:
## For more details, see here:
## ref: https://github.com/ONLYOFFICE/Kubernetes-Docs/blob/master/CUSTOM_RESOURCES.md
customResources:
## customResources.versionSalt Arbitrary string included in the `DS_VERSION_HASH` input
## The chart cannot see the content of the `persistence.customResources` PVC. After changing it, change this value in Git to get a new `DS_VERSION_HASH`
## (so that browsers fetch the new assets) and to roll the Pods. Used only if a `*.build` parameter is set to `true`
versionSalt: ""
job:
## customResources.job.annotations Defines annotations that will be additionally added to custom-resources Job
## If set to, it takes priority over the `commonAnnotations`
Expand Down
Loading