Skip to content

Commit

Permalink
Add S3/Swift object storage config and other configs from nextcloud/d…
Browse files Browse the repository at this point in the history
…ocker

- Add new S3 test to ci.

- Add nextcloud.trustedDomains

- Clean up run-test job to test

Signed-off-by: jessebot <[email protected]>
  • Loading branch information
jessebot committed Jul 25, 2024
1 parent bf6cc4a commit bb77a8b
Show file tree
Hide file tree
Showing 14 changed files with 644 additions and 175 deletions.
23 changes: 23 additions & 0 deletions .github/minio_test_values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## minio helm chart values for use in ci tests:
# https://github.com/minio/minio/blob/master/helm/minio/values.yaml

# make service name predictable
fullnameOverride: minio

## minio mode, i.e. standalone or distributed
mode: standalone

## Configure resource requests and limits
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
resources:
requests:
memory: 1Gi

## Enable persistence using Persistent Volume Claims
## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/
persistence:
enabled: false

# default credentials
rootUser: nextcloud
rootPassword: rootpass123
26 changes: 26 additions & 0 deletions .github/test_upload_job.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
apiVersion: batch/v1
kind: Job
metadata:
name: create-nextcloud-file
namespace: nextcloud
spec:
template:
metadata:
name: create-nextcloud-file
spec:
containers:
- name: create-nextcloud-file
image: curlimages/curl
command:
- /bin/sh
- -c
- |
echo "testing123" > test_upload.txt && \
curl \
-w "%{http_code}" \
-u admin:changeme \
-T test_upload.txt \
"http://nextcloud.nextcloud.svc.cluster.local:8080/remote.php/dav/files/admin/test_upload.txt" && \
echo -e "\nTried to uploaded a file, test_upload.txt, to Nextcloud."
restartPolicy: Never
40 changes: 37 additions & 3 deletions .github/workflows/lint-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
if: steps.list-changed.outputs.changed == 'true'
run: ct lint --target-branch ${{ github.event.repository.default_branch }}

run-tests:
test:
runs-on: ubuntu-22.04
needs: [changes, lint]
# only run this job if there are helm chart file changes
Expand All @@ -82,6 +82,12 @@ jobs:
- name: Horizontal Pod Autoscaling Enabled
helm_args: '--helm-extra-set-args "--set=hpa.enabled=true --set=hpa.minPods=2 --set=hpa.maxPods=3 --set=hpa.targetCPUUtilizationPercentage=75"'

# test the helm chart with s3 as the primary storage
- name: S3 Enabled as Primary Storage
# we need to skip the clean up so we can test adding a file
helm_args: |
--namespace nextcloud --skip-clean-up --helm-extra-set-args "--set=fullnameOverride=nextcloud --set=nextcloud.objectStore.s3.enabled=true --set=nextcloud.objectStore.s3.accessKey=nextcloud --set=nextcloud.objectStore.s3.secretKey=rootpass123 --set=nextcloud.objectStore.s3.host=minio.nextcloud.svc.cluster.local --set=nextcloud.objectStore.s3.port=9000 --set=nextcloud.objectStore.s3.ssl=false --set=nextcloud.objectStore.s3.bucket=nextcloud --set=nextcloud.objectStore.s3.usePathStyle=true --set=image.flavor=fpm --set=nginx.enabled=true --set=nextcloud.host=nextcloud --set=nextcloud.trustedDomains[0]='*'"
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -112,15 +118,43 @@ jobs:
uses: helm/[email protected]
if: steps.list-changed.outputs.changed == 'true'

- name: Install MinIO for testing S3 as Primary Storage
if: matrix.test_cases.name == 'S3 Enabled as Primary Storage'
# installs minio community helm chart here:
# https://github.com/minio/minio/tree/master/helm/minio
run: |
helm repo add minio https://charts.min.io/ && \
helm install minio \
--namespace nextcloud \
--create-namespace \
--wait \
--wait-for-jobs \
--timeout 2m0s \
--values .github/minio_test_values.yaml \
minio/minio
- name: Run chart-testing (install ${{ matrix.test_cases.name }})
id: install
if: steps.list-changed.outputs.changed == 'true'
run: ct install --target-branch ${{ github.event.repository.default_branch }} ${{ matrix.test_cases.helm_args }}

- name: Try adding a file to Nextcloud
if: matrix.test_cases.name == 'S3 Enabled as Primary Storage'
# applies a kubernetes job that uploads a file and then checks log of finished pod
run: |
kubectl config set-context --current --namespace=nextcloud && \
kubectl apply -f ./.github/test_upload_job.yaml --wait=true && \
sleep 2 && \
kubectl wait --for=condition=Complete --timeout=2m job/create-nextcloud-file && \
echo "Here's the logs from the job:" && \
kubectl logs --tail=-1 -f -l batch.kubernetes.io/job-name=create-nextcloud-file && \
echo "Here's the logs from the nextcloud pod:" && \
kubectl logs -l app.kubernetes.io/name=nextcloud
summary:
runs-on: ubuntu-latest-low
needs: [changes, run-tests]
needs: [changes, test]
if: always()
steps:
- name: Summary
run: if ${{ needs.changes.outputs.src != 'false' && needs.run-tests.result != 'success' }}; then exit 1; fi
run: if ${{ needs.changes.outputs.src != 'false' && needs.test.result != 'success' }}; then exit 1; fi
2 changes: 1 addition & 1 deletion charts/nextcloud/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: nextcloud
version: 5.3.2
version: 5.4.0
appVersion: 29.0.4
description: A file sharing server that puts the control and security of your own data back into your hands.
keywords:
Expand Down
Loading

0 comments on commit bb77a8b

Please sign in to comment.