1
0
Fork 0

add imaginary service

This commit is contained in:
Massaki Archambault 2023-06-16 17:10:34 -04:00
parent abebc8a94e
commit 0c0cd2b291
9 changed files with 84 additions and 17 deletions

View File

@ -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

View File

@ -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

View File

@ -0,0 +1,8 @@
resources:
- imaginary-deployment.yaml
- imaginary-autoscaler.yaml
namePrefix: imaginary-
commonLabels:
app.kubernetes.io/name: imaginary

View File

@ -16,9 +16,6 @@ configMapGenerator:
files: files:
- php-user.ini=configurations/php-user.ini - php-user.ini=configurations/php-user.ini
- apache-user.cfg=configurations/apache-user.conf - apache-user.cfg=configurations/apache-user.conf
- name: cron-scripts
files:
- cron-previewgenerator.sh=scripts/cron-previewgenerator.sh
- name: kustomize-generated-config - name: kustomize-generated-config
literals: literals:
- NEXTCLOUD_EXTERNAL_HOST=cloud.badjware.dev - NEXTCLOUD_EXTERNAL_HOST=cloud.badjware.dev

View File

@ -98,9 +98,6 @@ spec:
mountPath: /etc/apache2/conf-enabled/apache-user.conf mountPath: /etc/apache2/conf-enabled/apache-user.conf
subPath: apache-user.conf subPath: apache-user.conf
readOnly: true readOnly: true
- name: cron-scripts
mountPath: /scripts
readOnly: true
volumes: volumes:
- name: nextcloud-pv - name: nextcloud-pv
persistentVolumeClaim: persistentVolumeClaim:
@ -108,9 +105,6 @@ spec:
- name: server-config - name: server-config
configMap: configMap:
name: server-config name: server-config
- name: cron-scripts
configMap:
name: cron-scripts
--- ---
apiVersion: v1 apiVersion: v1
kind: PersistentVolumeClaim kind: PersistentVolumeClaim

View File

@ -32,4 +32,4 @@ spec:
command: ["/bin/bash"] command: ["/bin/bash"]
args: args:
- -xc - -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'

View File

@ -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

View File

@ -41,10 +41,10 @@ spec:
containerPort: 5432 containerPort: 5432
resources: resources:
requests: requests:
cpu: 750m cpu: 1000m
memory: 1Gi memory: 1Gi
limits: limits:
cpu: 1000m cpu: 2000m
memory: 1Gi memory: 1Gi
volumeMounts: volumeMounts:
- name: postgres-pvc - name: postgres-pvc

View File

@ -1,5 +1,6 @@
resources: resources:
- namespace.yaml - namespace.yaml
- ../../bases/nextcloud - ../../bases/nextcloud
- ../../bases/imaginary
namespace: nextcloud namespace: nextcloud