diff --git a/kustomize/bases/imaginary/imaginary-autoscaler.yaml b/kustomize/bases/imaginary/imaginary-autoscaler.yaml new file mode 100644 index 0000000..85d833d --- /dev/null +++ b/kustomize/bases/imaginary/imaginary-autoscaler.yaml @@ -0,0 +1,29 @@ +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: server-autoscaler +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: server + minReplicas: 2 + maxReplicas: 4 + metrics: + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: 60 + behavior: + scaleUp: + policies: + - type: Pods + value: 100 + periodSeconds: 10 + scaleDown: + policies: + - type: Pods + value: 1 + periodSeconds: 300 diff --git a/kustomize/bases/imaginary/imaginary-deployment.yaml b/kustomize/bases/imaginary/imaginary-deployment.yaml new file mode 100644 index 0000000..5d5ccd7 --- /dev/null +++ b/kustomize/bases/imaginary/imaginary-deployment.yaml @@ -0,0 +1,43 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: server + labels: + app.kubernetes.io/name: imaginary +spec: + selector: + matchLabels: + app.kubernetes.io/name: imaginary + template: + metadata: + labels: + app.kubernetes.io/name: imaginary + spec: + containers: + - image: nextcloud/aio-imaginary + name: imaginary + args: ["-enable-url-source", "-cpus", "1"] + ports: + - name: http + containerPort: 9000 + resources: + requests: + cpu: 1000m + memory: 1Gi + limits: + cpu: 1500m + memory: 1Gi +--- +apiVersion: v1 +kind: Service +metadata: + name: server + labels: + app.kubernetes.io/name: imaginary +spec: + selector: + app.kubernetes.io/name: imaginary + ports: + - name: http + port: 80 + targetPort: http \ No newline at end of file diff --git a/kustomize/bases/imaginary/kustomization.yaml b/kustomize/bases/imaginary/kustomization.yaml new file mode 100644 index 0000000..387ea9a --- /dev/null +++ b/kustomize/bases/imaginary/kustomization.yaml @@ -0,0 +1,8 @@ +resources: + - imaginary-deployment.yaml + - imaginary-autoscaler.yaml + +namePrefix: imaginary- + +commonLabels: + app.kubernetes.io/name: imaginary \ No newline at end of file diff --git a/kustomize/bases/nextcloud/kustomization.yaml b/kustomize/bases/nextcloud/kustomization.yaml index 53eafd2..0422fe1 100644 --- a/kustomize/bases/nextcloud/kustomization.yaml +++ b/kustomize/bases/nextcloud/kustomization.yaml @@ -16,9 +16,6 @@ configMapGenerator: files: - php-user.ini=configurations/php-user.ini - apache-user.cfg=configurations/apache-user.conf - - name: cron-scripts - files: - - cron-previewgenerator.sh=scripts/cron-previewgenerator.sh - name: kustomize-generated-config literals: - NEXTCLOUD_EXTERNAL_HOST=cloud.badjware.dev diff --git a/kustomize/bases/nextcloud/nextcloud-deployment.yaml b/kustomize/bases/nextcloud/nextcloud-deployment.yaml index 793d4fa..ac73a61 100644 --- a/kustomize/bases/nextcloud/nextcloud-deployment.yaml +++ b/kustomize/bases/nextcloud/nextcloud-deployment.yaml @@ -98,9 +98,6 @@ spec: mountPath: /etc/apache2/conf-enabled/apache-user.conf subPath: apache-user.conf readOnly: true - - name: cron-scripts - mountPath: /scripts - readOnly: true volumes: - name: nextcloud-pv persistentVolumeClaim: @@ -108,9 +105,6 @@ spec: - name: server-config configMap: name: server-config - - name: cron-scripts - configMap: - name: cron-scripts --- apiVersion: v1 kind: PersistentVolumeClaim diff --git a/kustomize/bases/nextcloud/previewgenerator-cronjob.yaml b/kustomize/bases/nextcloud/previewgenerator-cronjob.yaml index c4e6cd3..15add89 100644 --- a/kustomize/bases/nextcloud/previewgenerator-cronjob.yaml +++ b/kustomize/bases/nextcloud/previewgenerator-cronjob.yaml @@ -32,4 +32,4 @@ spec: command: ["/bin/bash"] args: - -xc - - kubectl exec "$(kubectl get pods -l 'app.kubernetes.io/component=server' -o name)" -- /bin/bash -c '( if ! which sudo &>/dev/null; then apt update && apt install sudo; fi ) && sudo -u www-data bash -x /scripts/cron-previewgenerator.sh' + - kubectl exec "$(kubectl get pods -l 'app.kubernetes.io/component=server' -o name)" -- /bin/bash -c '( if ! which sudo &>/dev/null; then apt update && apt install sudo; fi ) && sudo -u www-data php -f /var/www/html/occ preview:pre-generate' diff --git a/kustomize/bases/nextcloud/scripts/cron-previewgenerator.sh b/kustomize/bases/nextcloud/scripts/cron-previewgenerator.sh deleted file mode 100644 index ffe1fa9..0000000 --- a/kustomize/bases/nextcloud/scripts/cron-previewgenerator.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -php -f /var/www/html/occ config:app:set --value="32 64 256 1024 1920" previewgenerator squareSizes && -php -f /var/www/html/occ config:app:set --value="64 128 1024 1080 2030" previewgenerator widthSizes && -php -f /var/www/html/occ config:app:set --value="64 256 1024 1080 1920" previewgenerator heightSizes && -php -f /var/www/html/occ preview:pre-generate -vvv \ No newline at end of file diff --git a/kustomize/bases/postgres/postgres-statefulset.yaml b/kustomize/bases/postgres/postgres-statefulset.yaml index 7d78d5d..aa34b1a 100644 --- a/kustomize/bases/postgres/postgres-statefulset.yaml +++ b/kustomize/bases/postgres/postgres-statefulset.yaml @@ -41,10 +41,10 @@ spec: containerPort: 5432 resources: requests: - cpu: 750m + cpu: 1000m memory: 1Gi limits: - cpu: 1000m + cpu: 2000m memory: 1Gi volumeMounts: - name: postgres-pvc diff --git a/kustomize/overlays/nextcloud/kustomization.yaml b/kustomize/overlays/nextcloud/kustomization.yaml index e7f6622..d9496d9 100644 --- a/kustomize/overlays/nextcloud/kustomization.yaml +++ b/kustomize/overlays/nextcloud/kustomization.yaml @@ -1,5 +1,6 @@ resources: - namespace.yaml - ../../bases/nextcloud + - ../../bases/imaginary namespace: nextcloud