Skip to content

Commit

Permalink
Merge branch 'main' into helm_unittest
Browse files Browse the repository at this point in the history
  • Loading branch information
jessebot authored May 29, 2024
2 parents 9a2c2f1 + e39ca2a commit 7b025fd
Show file tree
Hide file tree
Showing 23 changed files with 320 additions and 233 deletions.
34 changes: 23 additions & 11 deletions .github/workflows/lint-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,39 @@ name: Lint and Test Charts

on:
pull_request:
paths-ignore:
- '.github/**'
- 'charts/**/README.md'
- 'CODE_OF_CONDUCT.md'
- 'CONTRIBUTING.md'
- 'LICENSE'
- 'README.md'

paths:
jobs:
changes:
runs-on: ubuntu-latest-low

outputs:
src: ${{ steps.changes.outputs.src}}

steps:
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: changes
continue-on-error: true
with:
filters: |
src:
- 'charts/nextcloud/Chart.yaml'
- 'charts/nextcloud/values.yaml'
- 'charts/nextcloud/templates/**'
lint-test:
runs-on: ubuntu-22.04
needs: changes
if: needs.changes.outputs.src != 'false'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install Helm
uses: azure/setup-helm@v3.5
uses: azure/setup-helm@v4
with:
version: v3.11.1
version: v3.14.4

- name: Add dependency chart repos
run: |
Expand Down Expand Up @@ -52,7 +64,7 @@ jobs:
helm unittest charts/nextcloud
- name: Create kind cluster
uses: helm/kind-action@v1.8.0
uses: helm/kind-action@v1.10.0
if: steps.list-changed.outputs.changed == 'true'

- name: Run chart-testing (install)
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ jobs:
# See https://github.com/helm/chart-releaser-action/issues/6
- name: Set up Helm
uses: azure/setup-helm@v3.5
uses: azure/setup-helm@v4
with:
version: v3.11.1
version: v3.14.4

- name: Add dependency chart repos
run: |
Expand Down
4 changes: 2 additions & 2 deletions charts/nextcloud/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v2
name: nextcloud
version: 4.5.10
appVersion: 28.0.1
version: 4.6.8
appVersion: 29.0.0
description: A file sharing server that puts the control and security of your own data back into your hands.
keywords:
- nextcloud
Expand Down
21 changes: 11 additions & 10 deletions charts/nextcloud/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ Is there a missing parameter for one of the Bitnami helm charts listed above? Pl

The [Nextcloud](https://hub.docker.com/_/nextcloud/) image stores the nextcloud data and configurations at the `/var/www/html` paths of the container.
Persistent Volume Claims are used to keep the data across deployments. This is known to work with GKE, EKS, K3s, and minikube.
Nextcloud will *not* delete the PVCs when uninstalling the helm chart.


| Parameter | Description | Default |
Expand Down Expand Up @@ -463,16 +464,16 @@ nextcloud:
extraVolumeMounts:
- name: hugepages
mountPath: /dev/hugepages
resources:
requests:
hugepages-2Mi: 500Mi
# note that Kubernetes currently requires cpu or memory requests and limits before hugepages are allowed.
memory: 500Mi
limits:
# limit and request must be the same for hugepages. They are a fixed resource.
hugepages-2Mi: 500Mi
# note that Kubernetes currently requires cpu or memory requests and limits before hugepages are allowed.
memory: 1Gi
resources:
requests:
hugepages-2Mi: 500Mi
# note that Kubernetes currently requires cpu or memory requests and limits before hugepages are allowed.
memory: 500Mi
limits:
# limit and request must be the same for hugepages. They are a fixed resource.
hugepages-2Mi: 500Mi
# note that Kubernetes currently requires cpu or memory requests and limits before hugepages are allowed.
memory: 1Gi
```
## HPA (Clustering)
Expand Down
2 changes: 1 addition & 1 deletion charts/nextcloud/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Create image name that is used in the deployment
{{- if .Values.image.tag -}}
{{- printf "%s:%s" .Values.image.repository .Values.image.tag -}}
{{- else -}}
{{- printf "%s:%s-%s" .Values.image.repository .Chart.AppVersion (default "apache" .Values.image.flavor) -}}
{{- printf "%s:%s-%s" .Values.image.repository .Chart.AppVersion .Values.image.flavor -}}
{{- end -}}
{{- end -}}

Expand Down
18 changes: 18 additions & 0 deletions charts/nextcloud/templates/configmap-hooks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{- if not (values .Values.nextcloud.hooks | compact | empty) }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "nextcloud.fullname" . }}-hooks
labels:
app.kubernetes.io/name: {{ include "nextcloud.name" . }}
helm.sh/chart: {{ include "nextcloud.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
data:
{{- range $hook, $shell := .Values.nextcloud.hooks }}
{{- if $shell }}
{{ $hook }}.sh: {{ $shell | quote }}
{{- end }}
{{- end }}
{{- end }}
1 change: 1 addition & 0 deletions charts/nextcloud/templates/db-secret.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{{- if or .Values.mariadb.enabled .Values.externalDatabase.enabled .Values.postgresql.enabled }}
{{- if not .Values.externalDatabase.existingSecret.enabled }}
---
apiVersion: v1
kind: Secret
metadata:
Expand Down
37 changes: 26 additions & 11 deletions charts/nextcloud/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ spec:
{{- if .Values.nginx.enabled }}
nginx-config-hash: {{ print .Values.nginx.config.default "-" .Values.nginx.config.custom | sha256sum }}
{{- end }}
hooks-hash: {{ toYaml .Values.nextcloud.hooks | sha256sum }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
Expand All @@ -63,13 +64,13 @@ spec:
postStart:
exec:
command:
{{- toYaml . | nindent 18 -}}
{{- toYaml . | nindent 18 }}
{{- end }}
{{- with .preStopCommand }}
preStop:
exec:
command:
{{- toYaml . | nindent 18 -}}
{{- toYaml . | nindent 18 }}
{{- end }}
{{- end }}
env:
Expand Down Expand Up @@ -136,6 +137,14 @@ spec:
{{- end }}
volumeMounts:
{{- include "nextcloud.volumeMounts" . | trim | nindent 12 }}
{{- range $hook, $shell := .Values.nextcloud.hooks }}
{{- if $shell }}
- name: nextcloud-hooks
mountPath: /docker-entrypoint-hooks.d/{{ $hook }}/helm.sh
subPath: {{ $hook }}.sh
readOnly: true
{{- end }}
{{- end }}
{{- if .Values.nginx.enabled }}
- name: {{ .Chart.Name }}-nginx
image: "{{ .Values.nginx.image.repository }}:{{ .Values.nginx.image.tag }}"
Expand All @@ -151,8 +160,8 @@ spec:
path: /status.php
port: {{ $.Values.nextcloud.containerPort }}
httpHeaders:
- name: Host
value: {{ $.Values.nextcloud.host | quote }}
- name: Host
value: {{ $.Values.nextcloud.host | quote }}
initialDelaySeconds: {{ .initialDelaySeconds }}
periodSeconds: {{ .periodSeconds }}
timeoutSeconds: {{ .timeoutSeconds }}
Expand All @@ -167,8 +176,8 @@ spec:
path: /status.php
port: {{ $.Values.nextcloud.containerPort }}
httpHeaders:
- name: Host
value: {{ $.Values.nextcloud.host | quote }}
- name: Host
value: {{ $.Values.nextcloud.host | quote }}
initialDelaySeconds: {{ .initialDelaySeconds }}
periodSeconds: {{ .periodSeconds }}
timeoutSeconds: {{ .timeoutSeconds }}
Expand All @@ -183,8 +192,8 @@ spec:
path: /status.php
port: {{ $.Values.nextcloud.containerPort }}
httpHeaders:
- name: Host
value: {{ $.Values.nextcloud.host | quote }}
- name: Host
value: {{ $.Values.nextcloud.host | quote }}
initialDelaySeconds: {{ .initialDelaySeconds }}
periodSeconds: {{ .periodSeconds }}
timeoutSeconds: {{ .timeoutSeconds }}
Expand Down Expand Up @@ -238,20 +247,20 @@ spec:
image: {{ include "nextcloud.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
command:
- /cron.sh
- /cron.sh
{{- with .Values.cronjob.lifecycle }}
lifecycle:
{{- with .postStartCommand }}
postStart:
exec:
command:
{{- toYaml . | nindent 18 -}}
{{- toYaml . | nindent 18 }}
{{- end }}
{{- with .preStopCommand }}
preStop:
exec:
command:
{{- toYaml . | nindent 18 -}}
{{- toYaml . | nindent 18 }}
{{- end }}
{{- end }}
env:
Expand Down Expand Up @@ -348,6 +357,12 @@ spec:
configMap:
name: {{ template "nextcloud.fullname" . }}-nginxconfig
{{- end }}
{{- if not (values .Values.nextcloud.hooks | compact | empty) }}
- name: nextcloud-hooks
configMap:
name: {{ template "nextcloud.fullname" . }}-hooks
defaultMode: 0o755
{{- end }}
{{- with .Values.nextcloud.extraVolumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
Expand Down
13 changes: 8 additions & 5 deletions charts/nextcloud/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{- if .Values.hpa.enabled -}}
{{- if .Values.hpa.enabled }}
---
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
Expand All @@ -14,7 +15,9 @@ spec:
kind: Deployment
apiVersion: apps/v1
name: {{ template "nextcloud.fullname" . }}
minReplicas: {{ .Values.hpa.minPods }}
maxReplicas: {{ .Values.hpa.maxPods }}
targetCPUUtilizationPercentage: {{ .Values.hpa.cputhreshold }}
{{- end }}
{{- with .Values.hpa }}
minReplicas: {{ .minPods }}
maxReplicas: {{ .maxPods }}
targetCPUUtilizationPercentage: {{ .cputhreshold }}
{{- end }}{{/* end-with .hpa */}}
{{- end }}
57 changes: 29 additions & 28 deletions charts/nextcloud/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{- if .Values.ingress.enabled }}
---
apiVersion: {{ include "nextcloud.ingress.apiVersion" . }}
kind: Ingress
metadata:
Expand All @@ -9,37 +10,37 @@ metadata:
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/component: app
{{- if .Values.ingress.labels }}
{{ toYaml .Values.ingress.labels | indent 4 }}
{{- end }}
{{- if .Values.ingress.annotations }}
{{- with .Values.ingress.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.ingress.annotations }}
annotations:
{{ toYaml .Values.ingress.annotations | indent 4 }}
{{- end }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.className }}
ingressClassName: {{ .Values.ingress.className }}
{{- with .Values.ingress.className }}
ingressClassName: {{ . }}
{{- end }}
rules:
- host: {{ .Values.nextcloud.host }}
http:
paths:
- path: {{ .Values.ingress.path }}
{{- if eq (include "nextcloud.ingress.apiVersion" $) "networking.k8s.io/v1" }}
pathType: {{ .Values.ingress.pathType }}
{{- end }}
backend:
{{- if eq (include "nextcloud.ingress.apiVersion" $) "networking.k8s.io/v1" }}
service:
name: {{ template "nextcloud.fullname" . }}
port:
number: {{ .Values.service.port }}
{{- else }}
serviceName: {{ template "nextcloud.fullname" . }}
servicePort: {{ .Values.service.port }}
{{- end }}
{{- if .Values.ingress.tls }}
- host: {{ .Values.nextcloud.host }}
http:
paths:
- path: {{ .Values.ingress.path }}
{{- if (eq (include "nextcloud.ingress.apiVersion" $) "networking.k8s.io/v1") }}
pathType: {{ .Values.ingress.pathType }}
{{- end }}
backend:
{{- if (eq (include "nextcloud.ingress.apiVersion" $) "networking.k8s.io/v1") }}
service:
name: {{ template "nextcloud.fullname" . }}
port:
number: {{ .Values.service.port }}
{{- else }}
serviceName: {{ template "nextcloud.fullname" . }}
servicePort: {{ .Values.service.port }}
{{- end }}
{{- with .Values.ingress.tls }}
tls:
{{ toYaml .Values.ingress.tls | indent 4 }}
{{- end -}}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
Loading

0 comments on commit 7b025fd

Please sign in to comment.