Skip to content

Commit

Permalink
Merge pull request #301 from ONLYOFFICE/release/v4.1.0
Browse files Browse the repository at this point in the history
Merge Helm Chart release/v4.1.0 into master
  • Loading branch information
agolybev authored Mar 7, 2024
2 parents 851362e + 731ea60 commit 9d6ed5b
Show file tree
Hide file tree
Showing 45 changed files with 369 additions and 68 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Change log

## 4.1.0

### New Features

* Added the ability set up annotations for all the deployed resources
* Added the ability to disable `PVC` creation when using the S3 storage

### Changes

* Using an already configured image for the `helm test` command
* Released [v8.0.1](https://github.com/ONLYOFFICE/DocumentServer/blob/master/CHANGELOG.md#801) of ONLYOFFICE Docs

### Fixes

* Fixed a bug when adding multiline annotations to Ingress

## 4.0.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.0.0
version: 4.1.0

appVersion: 8.0.0
appVersion: 8.0.1
51 changes: 40 additions & 11 deletions README.md

Large diffs are not rendered by default.

31 changes: 7 additions & 24 deletions sources/scripts/test_ds.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
brokerPassword = os.environ.get('AMQP_PWD')
brokerVhost = os.environ.get('AMQP_VHOST')

storageS3 = os.environ.get('STORAGE_S3')

total_result = {}


Expand All @@ -51,17 +53,7 @@ def init_logger(name):
logger.info('Running a script to test the availability of DocumentServer and dependencies\n')


def install_module(package):
try:
subprocess.check_call([sys.executable, '-m', 'pip', 'install', package],
stdout=subprocess.DEVNULL,
stderr=subprocess.STDOUT)
except Exception as msg_install_module:
logger_test_ds.error(f'Error when trying to install the "{package}" package... {msg_install_module}\n')


def get_redis_status():
install_module('redis')
import redis
global rc
try:
Expand All @@ -84,7 +76,6 @@ def get_redis_status():


def get_redis_cluster_status():
install_module('redis')
from redis.cluster import RedisCluster as Redis
from redis.cluster import ClusterNode
global rc
Expand All @@ -107,7 +98,6 @@ def get_redis_cluster_status():


def get_redis_sentinel_status():
install_module('redis')
import redis
from redis import Sentinel
global rc
Expand Down Expand Up @@ -161,7 +151,6 @@ def check_redis():


def check_db_postgresql(tbl_dict):
install_module('psycopg2')
import psycopg2
try:
dbc = psycopg2.connect(
Expand Down Expand Up @@ -196,7 +185,6 @@ def check_db_postgresql(tbl_dict):


def check_db_mysql(tbl_dict):
install_module('pymysql')
import pymysql
try:
dbc = pymysql.connect(
Expand Down Expand Up @@ -240,7 +228,6 @@ def check_db():


def check_mq_rabbitmq():
install_module('pika')
import pika
try:
mqp = pika.URLParameters(f'{brokerProto}://{brokerUser}:{brokerPassword}@{brokerHost}:{brokerPort}{brokerVhost}')
Expand Down Expand Up @@ -303,8 +290,6 @@ def check_mq():
if brokerType == 'rabbitmq':
check_mq_rabbitmq()
elif brokerType == 'activemq':
install_module('python-qpid-proton')
install_module('func_timeout')
from func_timeout import func_timeout, FunctionTimedOut
try:
activemq_return_status = func_timeout(15, check_mq_activemq)
Expand All @@ -316,11 +301,9 @@ def check_mq():
def check_dir_access():
logger_test_ds.info('Checking the availability of shared storage...')
try:
add_group = ['groupadd', '-g', '1005', 'ds']
add_user = ['useradd', '-g', 'ds', '-u', '101', 'ds']
dir_create = ['su', 'ds', '-c', 'mkdir /ds/test/App_Data/cache/files/testds']
dir_delete = ['su', 'ds', '-c', 'rm -rf /ds/test/App_Data/cache/files/testds']
all_cmd = [add_group, add_user, dir_create, dir_delete]
dir_create = ['mkdir', '/ds/test/App_Data/cache/files/testds']
dir_delete = ['rm', '-rf', '/ds/test/App_Data/cache/files/testds']
all_cmd = [dir_create, dir_delete]
all_status = []
for cmd in all_cmd:
process = subprocess.Popen(cmd)
Expand All @@ -341,7 +324,6 @@ def check_dir_access():


def get_ds_status():
install_module('requests')
import requests
from requests.adapters import HTTPAdapter
logger_test_ds.info('Checking DocumentServer availability...')
Expand Down Expand Up @@ -374,7 +356,8 @@ def total_status():
check_redis()
check_db()
check_mq()
check_dir_access()
if storageS3 == 'false':
check_dir_access()
get_ds_status()
total_status()

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.0.0-1
image: onlyoffice/docs-utils:8.0.1-1
command: ["/bin/sh", "-c"]
args: ["/scripts/stop.sh"]
volumeMounts:
Expand Down
3 changes: 3 additions & 0 deletions templates/RBAC/dashboard-role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ metadata:
"helm.sh/hook": post-install,post-upgrade
"helm.sh/hook-weight": "2"
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
{{- if .Values.commonAnnotations }}
{{- include "ds.annotations.commonAnnotations" ( dict "keyName" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
rules:
- apiGroups: [""]
resources: ["configmaps"]
Expand Down
3 changes: 3 additions & 0 deletions templates/RBAC/dashboard-rolebinding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ metadata:
"helm.sh/hook": post-install,post-upgrade
"helm.sh/hook-weight": "3"
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
{{- if .Values.commonAnnotations }}
{{- include "ds.annotations.commonAnnotations" ( dict "keyName" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
subjects:
- kind: ServiceAccount
name: dashboard-sa
Expand Down
12 changes: 12 additions & 0 deletions templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,18 @@ Get the ds labels
{{- end }}
{{- end -}}

{{/*
Get the ds annotations
*/}}
{{- define "ds.annotations.commonAnnotations" -}}
{{- $annotations := toYaml .keyName }}
{{- if contains "{{" $annotations }}
{{- tpl $annotations .context }}
{{- else }}
{{- $annotations }}
{{- end }}
{{- end -}}

{{/*
Get the ds Service Account name
*/}}
Expand Down
3 changes: 3 additions & 0 deletions templates/configmaps/dashboard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ metadata:
"helm.sh/hook": post-install,post-upgrade
"helm.sh/hook-weight": "4"
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
{{- if .Values.commonAnnotations }}
{{- include "ds.annotations.commonAnnotations" ( dict "keyName" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
data:
get_dashboard.sh: |-
#!/bin/bash
Expand Down
3 changes: 3 additions & 0 deletions templates/configmaps/documentserver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ metadata:
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 }}
data:
DB_TYPE: {{ template "ds.db.type" . }}
DB_USER: {{ .Values.connections.dbUser }}
Expand Down
3 changes: 3 additions & 0 deletions templates/configmaps/example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ metadata:
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 }}
data:
DS_URL: {{ include "ds.example.dsUrl" . }}
{{- end }}
3 changes: 3 additions & 0 deletions templates/configmaps/grafana.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ metadata:
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 }}
data:
grafana.ini: |-
[server]
Expand Down
5 changes: 5 additions & 0 deletions templates/configmaps/pre-delete.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ metadata:
"helm.sh/hook": pre-delete
"helm.sh/hook-weight": "1"
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
{{- if .Values.commonAnnotations }}
{{- include "ds.annotations.commonAnnotations" ( dict "keyName" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
data:
stop.sh: |-
#!/bin/bash
Expand All @@ -32,6 +35,7 @@ data:
echo -e "\e[0;31m DB is not available \e[0m"
exit 1
fi
{{- if not .Values.persistence.storageS3 }}
FILES_DIR=/var/lib/{{ .Values.product.name }}/documentserver/App_Data/cache/files/
ls $FILES_DIR > /dev/null
if [ $? -ne 0 ]; then
Expand All @@ -49,6 +53,7 @@ data:
;;
esac
done
{{- end }}
if [[ "$PRIVATE_CLUSTER" != "true" ]]; then
wget -O /scripts/{{ .Values.delete.existingConfigmap.tblRemove.keyName }} \
{{- if eq .Values.connections.dbType "postgres" }}
Expand Down
3 changes: 3 additions & 0 deletions templates/configmaps/pre-install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ metadata:
"helm.sh/hook": pre-install
"helm.sh/hook-weight": "2"
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
{{- if .Values.commonAnnotations }}
{{- include "ds.annotations.commonAnnotations" ( dict "keyName" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
data:
initdb.sh: |-
#!/bin/bash
Expand Down
5 changes: 5 additions & 0 deletions templates/configmaps/pre-rollback.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ metadata:
annotations:
"helm.sh/hook": pre-rollback
"helm.sh/hook-weight": "1"
{{- if .Values.commonAnnotations }}
{{- include "ds.annotations.commonAnnotations" ( dict "keyName" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
data:
stop.sh: |-
#!/bin/bash
Expand All @@ -31,6 +34,7 @@ data:
echo -e "\e[0;31m DB is not available \e[0m"
exit 1
fi
{{- if not .Values.persistence.storageS3 }}
FILES_DIR=/var/lib/{{ .Values.product.name }}/documentserver/App_Data/cache/files/
ls $FILES_DIR > /dev/null
if [ $? -ne 0 ]; then
Expand All @@ -48,6 +52,7 @@ data:
;;
esac
done
{{- end }}
if [[ "$PRIVATE_CLUSTER" != "true" ]]; then
wget -O /scripts/{{ .Values.rollback.existingConfigmap.tblRemove.keyName }} \
{{- if eq .Values.connections.dbType "postgres" }}
Expand Down
5 changes: 5 additions & 0 deletions templates/configmaps/pre-upgrade.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ metadata:
"helm.sh/hook": pre-upgrade
"helm.sh/hook-weight": "1"
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
{{- if .Values.commonAnnotations }}
{{- include "ds.annotations.commonAnnotations" ( dict "keyName" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
data:
stop.sh: |-
#!/bin/bash
Expand All @@ -36,6 +39,7 @@ data:
echo -e "\e[0;31m DB is not available \e[0m"
exit 1
fi
{{- if not .Values.persistence.storageS3 }}
FILES_DIR=/var/lib/{{ .Values.product.name }}/documentserver/App_Data/cache/files/
ls $FILES_DIR > /dev/null
if [ $? -ne 0 ]; then
Expand All @@ -53,6 +57,7 @@ data:
;;
esac
done
{{- end }}
if [[ "$PRIVATE_CLUSTER" != "true" ]]; then
wget -O /scripts/{{ .Values.upgrade.existingConfigmap.tblRemove.keyName }} \
{{- if eq .Values.connections.dbType "postgres" }}
Expand Down
3 changes: 3 additions & 0 deletions templates/configmaps/welcome-page.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ metadata:
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 }}
data:
ds-example.conf: |-
location /example/ {
Expand Down
8 changes: 8 additions & 0 deletions templates/deployments/converter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ metadata:
{{- if .Values.commonLabels }}
{{- include "ds.labels.commonLabels" . | trim | nindent 4 }}
{{- end }}
{{- if or .Values.commonAnnotations .Values.converter.annotations }}
{{- $dictValue := default .Values.commonAnnotations .Values.converter.annotations }}
annotations: {{- include "ds.annotations.commonAnnotations" ( dict "keyName" $dictValue "context" $ ) | nindent 4 }}
{{- end }}
spec:
{{- if not .Values.converter.autoscaling.enabled }}
replicas: {{ .Values.converter.replicas }}
Expand Down Expand Up @@ -84,9 +88,11 @@ spec:
- name: {{ .Values.imagePullSecrets }}
{{- end }}
volumes:
{{- if not .Values.persistence.storageS3 }}
- name: ds-files
persistentVolumeClaim:
claimName: {{ template "ds.pvc.name" . }}
{{- end }}
- name: ds-license
{{- if .Values.license.existingClaim }}
persistentVolumeClaim:
Expand Down Expand Up @@ -136,8 +142,10 @@ spec:
- configMapRef:
name: documentserver
volumeMounts:
{{- if not .Values.persistence.storageS3 }}
- name: ds-files
mountPath: /var/lib/{{ .Values.product.name }}/documentserver/App_Data/cache/files
{{- end }}
- name: ds-license
mountPath: /var/www/{{ .Values.product.name }}/Data
{{- if not .Values.license.existingClaim }}
Expand Down
Loading

0 comments on commit 9d6ed5b

Please sign in to comment.