1
0
Fork 0

Compare commits

..

2 Commits

Author SHA1 Message Date
Massaki Archambault 95e29071a9 update nextcloud 2023-06-10 18:15:39 -04:00
Massaki Archambault cb8f16b077 use kubernetes cron for nextcloud cronjob 2023-06-10 16:07:49 -04:00
6 changed files with 75 additions and 6 deletions

View File

@ -3,5 +3,5 @@ datasources:
- name: prometheus - name: prometheus
type: prometheus type: prometheus
access: proxy access: proxy
url: http://prometheus-operated.monitoring.svc.cluster.local:9090 url: http://prometheus-operated.monitoring.svc:9090
isDefault: true isDefault: true

View File

@ -39,7 +39,7 @@ spec:
mountPath: /server-config mountPath: /server-config
readOnly: true readOnly: true
containers: containers:
- image: homeassistant/home-assistant:2023.5.4 - image: homeassistant/home-assistant
name: home-assistant name: home-assistant
securityContext: securityContext:
privileged: true privileged: true

View File

@ -2,6 +2,7 @@ resources:
- ../postgres - ../postgres
- ../redis - ../redis
- nextcloud-deployment.yaml - nextcloud-deployment.yaml
- nextcloud-cronjob.yaml
- nextcloud-ingress.yaml - nextcloud-ingress.yaml
namePrefix: nextcloud- namePrefix: nextcloud-

View File

@ -0,0 +1,65 @@
apiVersion: batch/v1
kind: CronJob
metadata:
name: server-cron
labels:
app.kubernetes.io/name: nextcloud
app.kubernetes.io/component: cron
spec:
schedule: "*/5 * * * *"
concurrencyPolicy: Forbid
successfulJobsHistoryLimit: 1
failedJobsHistoryLimit: 1
jobTemplate:
metadata:
labels:
app.kubernetes.io/name: nextcloud
app.kubernetes.io/component: cron
spec:
backoffLimit: 0 # no retry
template:
metadata:
labels:
app.kubernetes.io/name: nextcloud
app.kubernetes.io/component: cron
spec:
restartPolicy: Never
serviceAccountName: server-cron
containers:
- name: run-nextcloud-cron
image: bitnami/kubectl
imagePullPolicy: IfNotPresent
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 php -f /var/www/html/cron.php'
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: server-cron
automountServiceAccountToken: true
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: pod-list-exec
rules:
- apiGroups: [""]
resources: ["pods", "pods/log"]
verbs: ["get", "list"]
- apiGroups: [""]
resources: ["pods/exec"]
verbs: ["create"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: server-cron
subjects:
- kind: ServiceAccount
name: server-cron
roleRef:
kind: Role
name: pod-list-exec
apiGroup: rbac.authorization.k8s.io

View File

@ -54,14 +54,14 @@ spec:
- name: TRUSTED_PROXIES - name: TRUSTED_PROXIES
value: 10.0.0.0/8 value: 10.0.0.0/8
- name: REDIS_HOST - name: REDIS_HOST
value: nextcloud-redis.$(NAMESPACE).svc.cluster.local value: nextcloud-redis.$(NAMESPACE).svc
- name: REDIS_HOST_PASSWORD - name: REDIS_HOST_PASSWORD
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: redis-credentials name: redis-credentials
key: password key: password
- name: POSTGRES_HOST - name: POSTGRES_HOST
value: nextcloud-postgres.$(NAMESPACE).svc.cluster.local value: nextcloud-postgres.$(NAMESPACE).svc
- name: POSTGRES_DB - name: POSTGRES_DB
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:

View File

@ -30,12 +30,15 @@ images:
- name: drone/drone-runner-kube - name: drone/drone-runner-kube
newTag: 1.0.0-rc.3 newTag: 1.0.0-rc.3
- name: nextcloud - name: nextcloud
newName: badjware/nextcloud-tweak newTag: 26.0.2
newTag: 25.0.3 - name: homeassistant/home-assistant
newTag: 2023.5.4
- name: postgres - name: postgres
newTag: 9.6.23 newTag: 9.6.23
- name: redis - name: redis
newTag: 6.2.10 newTag: 6.2.10
- name: bitnami/kubectl
newTag: "1.25"
# configMapGenerator: # configMapGenerator:
# - name: ecommerce-exporter-config # - name: ecommerce-exporter-config