kubernetes/helm/README.md | 11 + kubernetes/helm/libreoffice-online/Chart.yaml | 4 kubernetes/helm/libreoffice-online/templates/_helpers.tpl | 11 + kubernetes/helm/libreoffice-online/templates/deployment.yaml | 89 +++++++++++ kubernetes/helm/libreoffice-online/templates/hpa.yaml | 32 +++ kubernetes/helm/libreoffice-online/templates/service.yaml | 19 ++ kubernetes/helm/libreoffice-online/values.yaml | 77 +++++++++ 7 files changed, 243 insertions(+)
New commits: commit 0ca4d204bb1361b198666a82d5072a281ed62a82 Author: Gabriel Masei <gabriel.ma...@1and1.ro> AuthorDate: Thu Oct 10 15:48:21 2019 +0300 Commit: Gabriel Masei <gabriel.ma...@1and1.ro> CommitDate: Thu Oct 10 15:48:21 2019 +0300 Add basic support for kubernetes deploy Change-Id: I695f412570339a6225b198bcd3fd3b4f29fb4bd3 diff --git a/kubernetes/helm/README.md b/kubernetes/helm/README.md new file mode 100644 index 000000000..d038dbe38 --- /dev/null +++ b/kubernetes/helm/README.md @@ -0,0 +1,11 @@ +# OnlineOffice Helm-Charts + +# Available Charts + +## LibreOffice-Online +Chart for deploying C++ application [LibreOffice Online] in Kubernetes cluster.</br> +To install the chart a command similar to the one above needs to be issued.</br> +``` +.. cd helm-charts +helm install --namespace=${your desired namespace} --generate-name libreoffice-online +``` diff --git a/kubernetes/helm/libreoffice-online/Chart.yaml b/kubernetes/helm/libreoffice-online/Chart.yaml new file mode 100644 index 000000000..63e2067bc --- /dev/null +++ b/kubernetes/helm/libreoffice-online/Chart.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +description: LibreOffice Online helm chart +name: libreoffice-online +version: 1.1.0 diff --git a/kubernetes/helm/libreoffice-online/templates/_helpers.tpl b/kubernetes/helm/libreoffice-online/templates/_helpers.tpl new file mode 100644 index 000000000..ec188b25f --- /dev/null +++ b/kubernetes/helm/libreoffice-online/templates/_helpers.tpl @@ -0,0 +1,11 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "name" -}} +{{- default .Values.global.app.name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "chartname" -}} +{{- printf "%s-%s" .Chart.Name (.Chart.Version | replace "+" "_") -}} +{{- end -}} diff --git a/kubernetes/helm/libreoffice-online/templates/deployment.yaml b/kubernetes/helm/libreoffice-online/templates/deployment.yaml new file mode 100644 index 000000000..f0e600c68 --- /dev/null +++ b/kubernetes/helm/libreoffice-online/templates/deployment.yaml @@ -0,0 +1,89 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ default .Values.global.app.name .Values.deployment.name }} + labels: + app: {{ template "name" . }} + chart: {{ template "chartname" . }} + release: {{ .Release.Name }} + version: "{{ .Values.global.app.version }}" +spec: + minReadySeconds: {{ .Values.deployment.minReadySeconds }} + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + app: {{ template "name" . }} + release: {{ .Release.Name }} + strategy: + type: {{ .Values.deployment.type }} + {{- if eq .Values.deployment.type "RollingUpdate"}} + rollingUpdate: + maxSurge: {{ .Values.deployment.maxSurge }} + maxUnavailable: {{ .Values.deployment.maxUnavailable }} + {{- end}} + template: + metadata: + labels: + app: {{ template "name" . }} + release: {{ .Release.Name }} + version: "{{ .Values.global.app.version }}" + exposed: "true" + annotations: + {{- if .Values.global.app.monitoring.activate }} + prometheus.io/scrape: "true" + prometheus.io/port: "{{ .Values.global.app.monitoring.port }}" + prometheus.io/path: "{{ .Values.global.app.monitoring.path }}" + {{- end }} + spec: + containers: + - name: {{ .Values.global.app.name }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - containerPort: {{ .Values.global.app.service.internalPort }} + securityContext: + readOnlyRootFilesystem: false + runAsNonRoot: true + #Lool user id + runAsUser: 101 + {{- if .Values.probes.liveness.activate }} + livenessProbe: + httpGet: + path: {{ .Values.probes.liveness.path }} + port: {{ .Values.probes.port }} + scheme: {{ .Values.probes.urlScheme }} + initialDelaySeconds: {{ .Values.probes.liveness.initialDelaySeconds }} + periodSeconds: {{ .Values.probes.liveness.periodSeconds }} + timeoutSeconds: {{ .Values.probes.liveness.timeoutSeconds }} + successThreshold: {{ .Values.probes.liveness.successThreshold }} + failureThreshold: {{ .Values.probes.liveness.failureThreshold }} + {{- end }} + {{- if .Values.probes.readiness.activate }} + readinessProbe: + httpGet: + path: {{ .Values.probes.readiness.path }} + port: {{ .Values.probes.port }} + scheme: {{ .Values.probes.urlScheme }} + initialDelaySeconds: {{ .Values.probes.readiness.initialDelaySeconds }} + periodSeconds: {{ .Values.probes.readiness.periodSeconds }} + timeoutSeconds: {{ .Values.probes.readiness.timeoutSeconds }} + successThreshold: {{ .Values.probes.readiness.successThreshold }} + failureThreshold: {{ .Values.probes.readiness.failureThreshold }} + {{- end }} + {{- if .Values.environmentVariablesLool }} + env: +{{ toYaml .Values.environmentVariablesLool | indent 12 }} + {{- end }} + volumeMounts: + - name: tmp + mountPath: /tmp + resources: +{{ toYaml .Values.resources | indent 12 }} + {{- if .Values.nodeSelector }} + nodeSelector: +{{ toYaml .Values.nodeSelector | indent 8 }} + {{- end }} + volumes: + - name: tmp + emptyDir: + medium: "Memory" \ No newline at end of file diff --git a/kubernetes/helm/libreoffice-online/templates/hpa.yaml b/kubernetes/helm/libreoffice-online/templates/hpa.yaml new file mode 100644 index 000000000..cec7ac307 --- /dev/null +++ b/kubernetes/helm/libreoffice-online/templates/hpa.yaml @@ -0,0 +1,32 @@ +{{- if .Values.global.app.scaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ .Values.hpa.name }} + labels: + app: {{ template "name" . }} + chart: {{ template "chartname" . }} + release: {{ .Release.Name }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ default .Values.global.app.name .Values.deployment.name }} +{{- if gt .Values.global.app.scaling.min 1.0 }} + minReplicas: {{ .Values.global.app.scaling.min }} +{{- end }} + maxReplicas: {{ .Values.global.app.scaling.max }} + metrics: +{{- if gt .Values.global.app.scaling.target.memory 1.0 }} + - type: Resource + resource: + name: memory + targetAverageUtilization: {{ .Values.global.app.scaling.target.memory }} +{{- end }} +{{- if gt .Values.global.app.scaling.target.cpu 1.0 }} + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ .Values.global.app.scaling.target.cpu }} +{{- end }} +{{- end }} diff --git a/kubernetes/helm/libreoffice-online/templates/service.yaml b/kubernetes/helm/libreoffice-online/templates/service.yaml new file mode 100644 index 000000000..29498c904 --- /dev/null +++ b/kubernetes/helm/libreoffice-online/templates/service.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Values.global.app.service.name }} + labels: + app: {{ template "name" . }} + chart: {{ template "chartname" . }} + release: {{ .Release.Name }} +spec: + type: {{ .Values.global.app.service.type }} + externalTrafficPolicy: Local + ports: + - port: {{ .Values.global.app.service.externalPort }} + targetPort: {{ .Values.global.app.service.internalPort }} + protocol: TCP + name: {{ .Values.global.app.service.name }} + selector: + app: {{ template "name" . }} + release: {{ .Release.Name }} diff --git a/kubernetes/helm/libreoffice-online/values.yaml b/kubernetes/helm/libreoffice-online/values.yaml new file mode 100644 index 000000000..f464d62ac --- /dev/null +++ b/kubernetes/helm/libreoffice-online/values.yaml @@ -0,0 +1,77 @@ +# Default values for libreoffice-online. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. +global: + app: + name: libreoffice-online + urlScheme: HTTP # either HTTP or HTTPS + scaling: + enabled: true + min: 1 + max: 10 + target: + cpu: 70 + memory: 70 + monitoring: + activate: false + port: 9980 + path: "/lool/adminMonitorInfo" + service: + name: libreoffice-online + type: NodePort + externalPort: 9980 + internalPort: 9980 + ingress: {} + +replicaCount: 3 +image: + pullPolicy: Always + repository: libreoffice/online + tag: master + +probes: + urlScheme: HTTP # either HTTP or HTTPS + port: 9980 + readiness: + activate: true + path: / + initialDelaySeconds: 60 + periodSeconds: 10 + timeoutSeconds: 30 + successThreshold: 1 + failureThreshold: 3 + liveness: + activate: true + path: / + initialDelaySeconds: 60 + periodSeconds: 10 + timeoutSeconds: 30 + successThreshold: 1 + failureThreshold: 3 + +deployment: + name: libreoffice-online + type: RollingUpdate + minReadySeconds: 0 + maxUnavailable: 1 + maxSurge: 1 + +environmentVariablesLool: {} + +service: + name: libreoffice-online + +hpa: + name: libreoffice-online + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 2000m + # memory: 256Mi + # requests: + # cpu: 100m + # memory: 128Mi _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits