diff --git a/pkg/comp-functions/functions/vshnnextcloud/deploy.go b/pkg/comp-functions/functions/vshnnextcloud/deploy.go index 013d7a9eb..25c530e1c 100644 --- a/pkg/comp-functions/functions/vshnnextcloud/deploy.go +++ b/pkg/comp-functions/functions/vshnnextcloud/deploy.go @@ -20,6 +20,7 @@ import ( corev1 "k8s.io/api/core/v1" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" ) const ( @@ -382,11 +383,16 @@ func newRelease(ctx context.Context, svc *runtime.ServiceRuntime, comp *vshnv1.V return nil, fmt.Errorf("cannot get observed release values: %w", err) } - _, err = maintenance.SetReleaseVersion(ctx, comp.Spec.Parameters.Service.Version, values, observedValues, []string{"image", "tag"}) + version, err := maintenance.SetReleaseVersion(ctx, comp.Spec.Parameters.Service.Version, values, observedValues, []string{"image", "tag"}) if err != nil { return nil, fmt.Errorf("cannot set keycloak version for release: %w", err) } + err = configureCronSidecar(values, version) + if err != nil { + return nil, fmt.Errorf("cannot set keycloak version for cron sidecar: %w", err) + } + release, err := common.NewRelease(ctx, svc, comp, values) release.Spec.ForProvider.Chart.Name = "nextcloud" @@ -394,6 +400,57 @@ func newRelease(ctx context.Context, svc *runtime.ServiceRuntime, comp *vshnv1.V return release, err } +func configureCronSidecar(values map[string]interface{}, version string) error { + extraSidecarContainers := []any{ + map[string]any{ + "name": "cron", + "command": []any{ + "/cron.sh", + }, + "image": "nextcloud:" + version, + "volumeMounts": []any{ + map[string]any{ + "mountPath": "/var/www", + "name": "nextcloud-main", + "subpath": "root", + }, + map[string]any{ + "mountPath": "/var/www/html", + "name": "nextcloud-main", + "subPath": "html", + }, + map[string]any{ + "mountPath": "/var/www/html/data", + "name": "nextcloud-main", + "subPath": "data", + }, + map[string]any{ + "mountPath": "/var/www/html/config", + "name": "nextcloud-main", + "subPath": "config", + }, + map[string]any{ + "mountPath": "/var/www/html/custom_apps", + "name": "nextcloud-main", + "subPath": "custom_apps", + }, + map[string]any{ + "mountPath": "/var/www/tmp", + "name": "nextcloud-main", + "subPath": "tmp", + }, + map[string]any{ + "mountPath": "/var/www/html/themes", + "name": "nextcloud-main", + "subPath": "themes", + }, + }, + }, + } + + return unstructured.SetNestedSlice(values, extraSidecarContainers, []string{"nextcloud", "extraSidecarContainers"}...) +} + func addApacheConfig(svc *runtime.ServiceRuntime, comp *vshnv1.VSHNNextcloud) error { cm := &v1.ConfigMap{