feat: Adds Nextcloud pre-install hook and ArgoCD ignore rules

Introduces a `before-starting` hook that creates a `CAN_INSTALL` file, signaling Nextcloud to proceed with its installation process.

Configures ArgoCD to ignore differences in `batch/Job` resources' `spec.selector` and `spec.template.metadata.labels`. This prevents spurious out-of-sync states caused by Kubernetes mutating these fields on job creation, improving application synchronization stability.
This commit is contained in:
Felix Wolf 2026-04-04 18:17:32 +02:00
parent 1b57f76543
commit c85ee51590
5 changed files with 50 additions and 1 deletions

View file

@ -0,0 +1,16 @@
#@ load("@ytt:overlay", "overlay")
#@overlay/match by=overlay.all, expects="1+"
---
#@overlay/match-child-defaults missing_ok=True
spec:
ignoreDifferences:
- group: batch
kind: Job
jsonPointers:
- /spec/selector
- /spec/template/metadata/labels
syncPolicy:
syncOptions:
#@overlay/append
- RespectIgnoreDifferences=true

View file

@ -53,6 +53,9 @@ nextcloud:
opcache.save_comments=1 opcache.save_comments=1
opcache.revalidate_freq=60 opcache.revalidate_freq=60
hooks:
before-starting: touch /var/www/html/config/CAN_INSTALL
extraSidecarContainers: extraSidecarContainers:
- name: caddy - name: caddy
image: caddy:2-alpine image: caddy:2-alpine

View file

@ -11,6 +11,12 @@ spec:
destination: destination:
namespace: nextcloud namespace: nextcloud
server: https://kubernetes.default.svc server: https://kubernetes.default.svc
ignoreDifferences:
- group: batch
jsonPointers:
- /spec/selector
- /spec/template/metadata/labels
kind: Job
project: env-production project: env-production
source: source:
path: rendered/envs/production/nextcloud path: rendered/envs/production/nextcloud
@ -23,3 +29,4 @@ spec:
syncOptions: syncOptions:
- CreateNamespace=true - CreateNamespace=true
- ServerSideApply=true - ServerSideApply=true
- RespectIgnoreDifferences=true

View file

@ -0,0 +1,15 @@
apiVersion: v1
data:
before-starting.sh: touch /var/www/html/config/CAN_INSTALL
kind: ConfigMap
metadata:
annotations:
a8r.io/repository: ssh://git@git.tr1ceracop.de:222/gitea_admin/k8s-and-chill.git
labels:
app.kubernetes.io/instance: nextcloud
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: nextcloud
app.kubernetes.io/version: 33.0.0
helm.sh/chart: nextcloud-9.0.4
name: nextcloud-hooks
namespace: nextcloud

View file

@ -27,7 +27,7 @@ spec:
template: template:
metadata: metadata:
annotations: annotations:
hooks-hash: 9525c2748a6c7cd0e28ec740623d0b3fa5a75c83b51ccfd136bc89c76737b204 hooks-hash: 47a89ca9deff73131884ece615e1cabb1f600fec60aa8f20244ae3c5bb58f948
nextcloud-config-hash: 0d229123637fe9f641f41261891a44b761ff32c52f973314650897e768f3456d nextcloud-config-hash: 0d229123637fe9f641f41261891a44b761ff32c52f973314650897e768f3456d
php-config-hash: b638f66fd8d65de8364dbad6efc59a6524c7b2e2377b5623cf5e921e4d3d2400 php-config-hash: b638f66fd8d65de8364dbad6efc59a6524c7b2e2377b5623cf5e921e4d3d2400
labels: labels:
@ -208,6 +208,10 @@ spec:
- mountPath: /usr/local/etc/php/conf.d/uploadLimit.ini - mountPath: /usr/local/etc/php/conf.d/uploadLimit.ini
name: nextcloud-phpconfig name: nextcloud-phpconfig
subPath: uploadLimit.ini subPath: uploadLimit.ini
- mountPath: /docker-entrypoint-hooks.d/before-starting/helm.sh
name: nextcloud-hooks
readOnly: true
subPath: before-starting.sh
- command: - command:
- /cron.sh - /cron.sh
env: env:
@ -416,6 +420,10 @@ spec:
- configMap: - configMap:
name: nextcloud-phpconfig name: nextcloud-phpconfig
name: nextcloud-phpconfig name: nextcloud-phpconfig
- configMap:
defaultMode: 493
name: nextcloud-hooks
name: nextcloud-hooks
- configMap: - configMap:
name: nextcloud-caddy-config name: nextcloud-caddy-config
name: caddy-config name: caddy-config