Upgraded catalog item(s)

This commit upgrades collabora catalog item(s).
This commit is contained in:
sonicaj committed 2022-04-20 20:00:10 +00:00
1 parent 175cf7957e
commit b791bfccb6
30 files changed
+8 -8

No files matched your search

@@ -0,0 +1,40 @@
{{/*
Retrieve secret name for secure credentials
*/}}
{{- define "secretName" -}}
{{- print "credentials" -}}
{{- end -}}
{{/*
Retrieve true/false if certificate is configured
*/}}
{{- define "certAvailable" -}}
{{- if .Values.certificate -}}
{{- $values := (. | mustDeepCopy) -}}
{{- $_ := set $values "commonCertOptions" (dict "certKeyName" $values.Values.certificate) -}}
{{- template "common.resources.cert_present" $values -}}
{{- else -}}
{{- false -}}
{{- end -}}
{{- end -}}
{{/*
Retrieve public key of certificate
*/}}
{{- define "cert.publicKey" -}}
{{- $values := (. | mustDeepCopy) -}}
{{- $_ := set $values "commonCertOptions" (dict "certKeyName" $values.Values.certificate "publicKey" true) -}}
{{ include "common.resources.cert" $values }}
{{- end -}}
{{/*
Retrieve private key of certificate
*/}}
{{- define "cert.privateKey" -}}
{{- $values := (. | mustDeepCopy) -}}
{{- $_ := set $values "commonCertOptions" (dict "certKeyName" $values.Values.certificate) -}}
{{ include "common.resources.cert" $values }}
{{- end -}}
@@ -0,0 +1,75 @@
apiVersion: {{ template "common.capabilities.deployment.apiVersion" . }}
kind: Deployment
metadata:
name: {{ template "common.names.fullname" . }}
labels: {{ include "common.labels" . | nindent 4 }}
spec:
strategy:
type: {{ .Values.updateStrategy }}
selector:
matchLabels: {{ include "common.labels.selectorLabels" . | nindent 6 }}
template:
metadata:
name: {{ template "common.names.fullname" . }}
labels: {{ include "common.labels.selectorLabels" . | nindent 8 }}
spec:
containers:
- name: {{ .Chart.Name }}-nginx
image: {{ printf "%s:%s" .Values.nginx.image.repository .Values.nginx.image.tag }}
imagePullPolicy: {{ .Values.nginx.image.pullPolicy }}
volumeMounts:
- name: configuration
mountPath: /etc/nginx/nginx.conf
readOnly: true
subPath: config
- name: certs
mountPath: /etc/nginx/server.crt
subPath: certPublicKey
- name: certs
mountPath: /etc/nginx/server.key
subPath: certPrivateKey
ports:
- name: http
containerPort: 80
protocol: TCP
- name: https
containerPort: 443
protocol: TCP
- name: {{ .Chart.Name }}
{{ include "common.containers.imageConfig" .Values.image | nindent 10 }}
{{ if .Values.extraAppVolumeMounts }}
volumeMounts:
{{ range $index, $hostPathConfiguration := .Values.extraAppVolumeMounts }}
- name: extrappvolume-{{ $index }}
mountPath: {{ $hostPathConfiguration.mountPath }}
{{ end }}
{{ end }}
ports:
- name: collabora
protocol: TCP
containerPort: 9980
{{ $envList := (default list .Values.environmentVariables) }}
{{ $secretName := (include "secretName" .) }}
{{ $envConfig := .Values.config }}
{{ $envList = mustAppend $envList (dict "name" "timezone" "value" $envConfig.timezone) }}
{{ $envList = mustAppend $envList (dict "name" "domain" "value" $envConfig.domain) }}
{{ $envList = mustAppend $envList (dict "name" "dictionaries" "value" $envConfig.dictionaries) }}
{{ $envList = mustAppend $envList (dict "name" "extra_params" "value" $envConfig.extra_params) }}
{{ $envList = mustAppend $envList (dict "name" "DONT_GEN_SSL_CERT" "value" "true") }}
{{ $envList = mustAppend $envList (dict "name" "server_name" "value" (printf "%v:%v" $envConfig.server_name .Values.nodePort)) }}
{{ $envList = mustAppend $envList (dict "name" "username" "valueFromSecret" true "secretName" $secretName "secretKey" "username") }}
{{ $envList = mustAppend $envList (dict "name" "password" "valueFromSecret" true "secretName" $secretName "secretKey" "password") }}
{{ include "common.containers.allEnvironmentVariables" (dict "environmentVariables" $envList) | nindent 10 }}
volumes:
- name: configuration
configMap:
defaultMode: 0700
name: "nginx-config"
- name: certs
secret:
secretName: {{ include "secretName" . }}
{{ range $index, $hostPathConfiguration := .Values.extraAppVolumeMounts }}
- name: extrappvolume-{{ $index }}
hostPath:
path: {{ $hostPathConfiguration.hostPath }}
{{ end }}
@@ -0,0 +1,122 @@
{{- $serviceName := "localhost" -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: "nginx-config"
annotations:
rollme: {{ randAlphaNum 5 | quote }}
data:
config: |-
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
# Types to enable gzip compression on
gzip_types
text/plain
text/css
text/js
text/xml
text/javascript
application/javascript
application/x-javascript
application/json
application/xml
application/rss+xml
image/svg+xml;
sendfile on;
client_max_body_size 1000m;
keepalive_timeout 65;
# Disable tokens for security (#23684)
server_tokens off;
gzip on;
client_body_temp_path /var/tmp/firmware;
server {
server_name nginx;
listen 0.0.0.0:443 default_server ssl http2;
listen [::]:443 default_server ssl http2;
ssl_certificate "/etc/nginx/server.crt";
ssl_certificate_key "/etc/nginx/server.key";
ssl_session_timeout 120m;
ssl_session_cache shared:ssl:16m;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
ssl_ciphers EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA:EDH+aRSA:EECDH:!RC4:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS:!SHA1:!SHA256:!SHA384;
add_header Strict-Transport-Security max-age=31536000;
location = /robots.txt {
add_header Content-Type text/plain;
proxy_set_header Referer "http://nginx";
return 200 "User-agent: *\nDisallow: /loleaflet/*\n";
}
# static files
location ^~ /browser {
proxy_pass http://{{ $serviceName }}:9980;
proxy_set_header Host $host;
# proxy_set_header Referer "http://nginx";
}
# WOPI discovery URL
location ^~ /hosting/discovery {
set $upstream_collabora {{ $serviceName }};
proxy_pass http://$upstream_collabora:9980;
proxy_set_header Host $http_host;
# proxy_set_header Referer "http://nginx";
}
# Capabilities
location ^~ /hosting/capabilities {
proxy_pass http://{{ $serviceName }}:9980;
proxy_set_header Host $host;
# proxy_set_header Referer "http://nginx";
}
# main websocket
location ~ ^/cool/(.*)/ws$ {
proxy_pass http://{{ $serviceName }}:9980;
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
# proxy_set_header Referer "http://nginx";
proxy_read_timeout 36000s;
}
# download, presentation and image upload
location ~ ^/(c|l)ool {
proxy_pass http://{{ $serviceName }}:9980;
proxy_set_header Host $host;
proxy_set_header Referer "http://nginx";
}
# Admin Console websocket
location ^~ /cool/adminws {
proxy_pass http://{{ $serviceName }}:9980;
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
# proxy_set_header Referer "http://nginx";
proxy_read_timeout 36000s;
}
}
server {
listen 0.0.0.0:80;
listen [::]:80;
server_name nginx;
return 307 https://$host:{{ .Values.nodePort }}}$request_uri;
}
}
@@ -0,0 +1,6 @@
{{ $port := .Values.nodePort }}
{{ $ports := list }}
{{ $ports = mustAppend $ports (dict "name" "https" "nodePort" $port "targetPort" 443 "port" 443) }}
{{ $params := (. | mustDeepCopy) }}
{{ $_ := set $params "commonService" (dict "ports" $ports "type" "NodePort" ) }}
{{ include "common.classes.service" $params }}
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ template "secretName" . }}
labels: {{ include "common.labels" . | nindent 4 }}
type: Opaque
data:
username: {{ .Values.config.username | b64enc | quote }}
password: {{ .Values.config.password | b64enc | quote }}
{{ if eq (include "certAvailable" .) "true" }}
certPublicKey: {{ (include "cert.publicKey" .) | toString | b64enc | quote }}
certPrivateKey: {{ (include "cert.privateKey" .) | toString | b64enc | quote }}
{{ else }}
{{ fail "No certificate configured for Collabora" }}
{{ end }}
@@ -0,0 +1,21 @@
{{- $serviceName := (include "common.names.fullname" .) -}}
apiVersion: v1
kind: Pod
metadata:
name: "{{ .Release.Name }}-collabora-test"
labels:
app: {{ .Release.Name }}
release: {{ .Release.Name }}
annotations:
"helm.sh/hook": test
spec:
containers:
- name: test-curl
image: alpine/curl
imagePullPolicy: "IfNotPresent"
command:
- /bin/sh
- -ec
- |
curl --connect-timeout 5 --max-time 10 --retry 5 --retry-delay 15 --retry-max-time 90 --retry-all-errors -ks https://{{ $serviceName }}/browser/dist/admin/admin.html
restartPolicy: Never