💥 add all the files

This commit is contained in:
2024-07-01 16:18:43 +01:00
commit b7e3895065
9 changed files with 217 additions and 0 deletions
@@ -0,0 +1,14 @@
apiVersion: v1
data:
export_calendar.sh: |
#!/usr/bin/env bash
apk update
apk add curl
list='capgemini birmingham cesi papa blueberry personal-1 prometheus birthday maman capgemini_ca-gip shared_shared_by_calendar_sync'
for element in $list;do
curl -u $PI_USER_USERNAME:$PI_USER_PASSWORD https://nextcloud.tryton.geeraert.eu/remote.php/dav/calendars/pi/$element/\?export -o /backup/calendar_$element.ics
done
#curl -u $PI_USER_USERNAME:$PI_USER_PASSWORD https://nextcloud.tryton.geeraert.eu/remote.php/dav/calendars/pi/capgemini_ca-gip/\?export -o /backup/calendar.ics
kind: ConfigMap
metadata:
name: nextcloud-calendar-export-script
+52
View File
@@ -0,0 +1,52 @@
apiVersion: batch/v1
kind: Job
metadata:
name: contact-backup
namespace: nextcloud
spec:
ttlSecondsAfterFinished: 100
template:
spec:
containers:
- name: contact-backup
image: alpine
env:
- name: PI_USER_USERNAME
valueFrom:
secretKeyRef:
name: nextcloud-credentials
key: PI_USER_USERNAME
- name: PI_USER_PASSWORD
valueFrom:
secretKeyRef:
name: nextcloud-credentials
key: PI_USER_PASSWORD
command: ["/bin/sh","/config/export_calendar.sh"]
volumeMounts:
- name: calendar
mountPath: /backup
- name: scripts
mountPath: /config
volumes:
- name: calendar
persistentVolumeClaim:
claimName: calendar
- name: scripts
configMap:
name: nextcloud-calendar-export-script
defaultMode: 0555
restartPolicy: Never
backoffLimit: 4
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: calendar
namespace: nextcloud
spec:
storageClassName: nfs-backup-storage-intelligent
accessModes:
- ReadWriteMany
resources:
requests:
storage: 2Gi
+54
View File
@@ -0,0 +1,54 @@
apiVersion: batch/v1
kind: CronJob
metadata:
name: nextcloud-calendar-backup
namespace: nextcloud
spec:
schedule: "0 0 * * *"
jobTemplate:
spec:
ttlSecondsAfterFinished: 100
template:
spec:
containers:
- name: calendar-backup
image: alpine
env:
- name: PI_USER_USERNAME
valueFrom:
secretKeyRef:
name: nextcloud-credentials
key: PI_USER_USERNAME
- name: PI_USER_PASSWORD
valueFrom:
secretKeyRef:
name: nextcloud-credentials
key: PI_USER_PASSWORD
command: ["/bin/sh","/config/export_calendar.sh"]
volumeMounts:
- name: calendar
mountPath: /backup
- name: scripts
mountPath: /config
volumes:
- name: calendar
persistentVolumeClaim:
claimName: calendar
- name: scripts
configMap:
name: nextcloud-calendar-export-script
defaultMode: 0555
restartPolicy: Never
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: calendar
namespace: nextcloud
spec:
storageClassName: nfs-backup-storage-intelligent
accessModes:
- ReadWriteMany
resources:
requests:
storage: 2Gi
+53
View File
@@ -0,0 +1,53 @@
apiVersion: batch/v1
kind: CronJob
metadata:
name: nextcloud-contact-backup
namespace: nextcloud
spec:
schedule: "0 0 * * *"
jobTemplate:
spec:
ttlSecondsAfterFinished: 100
template:
spec:
containers:
- name: contact-backup
image: alpine/curl
env:
- name: PI_USER_USERNAME
valueFrom:
secretKeyRef:
name: nextcloud-credentials
key: PI_USER_USERNAME
- name: PI_USER_PASSWORD
valueFrom:
secretKeyRef:
name: nextcloud-credentials
key: PI_USER_PASSWORD
args:
- -u
- $(PI_USER_USERNAME):$(PI_USER_PASSWORD)
- https://nextcloud.tryton.geeraert.eu/remote.php/dav/addressbooks/users/pi/contacts/?export
- -o
- /backup/contact.vcf
volumeMounts:
- name: contact
mountPath: /backup
volumes:
- name: contact
persistentVolumeClaim:
claimName: contact
restartPolicy: Never
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: contact
namespace: nextcloud
spec:
storageClassName: nfs-backup-storage-intelligent
accessModes:
- ReadWriteMany
resources:
requests:
storage: 2Gi
@@ -0,0 +1,7 @@
namespace: nfs-provisioner-backup
bases:
- github.com/kubernetes-sigs/nfs-subdir-external-provisioner//deploy
resources:
- namespace.yaml
patchesStrategicMerge:
- patch_nfs_details.yaml
@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: nfs-provisioner-backup
@@ -0,0 +1,10 @@
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: nfs-backup-storage-intelligent
parameters:
pathPattern: "Backup/${.PVC.namespace}/${.PVC.name}"
archiveOnDelete: "false"
provisioner: k8s-sigs.io/nfs-subdir-external-provisioner
reclaimPolicy: Delete
volumeBindingMode: Immediate
Submodule nfs-subdir-external-provisioner/nfs-subdir-external-provisioner added at 59a3ca2cd1
@@ -0,0 +1,22 @@
# patch_nfs_details.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: nfs-client-provisioner
name: nfs-client-provisioner
spec:
template:
spec:
containers:
- name: nfs-client-provisioner
env:
- name: NFS_SERVER
value: 192.168.88.50
- name: NFS_PATH
value: /data/kubernetes/
volumes:
- name: nfs-client-root
nfs:
server: 192.168.88.50
path: /data/kubernetes/