diff --git a/pkg/comp-functions/functions/vshnnextcloud/deploy.go b/pkg/comp-functions/functions/vshnnextcloud/deploy.go index 6cfb0bb38..6c85d8e23 100644 --- a/pkg/comp-functions/functions/vshnnextcloud/deploy.go +++ b/pkg/comp-functions/functions/vshnnextcloud/deploy.go @@ -9,7 +9,6 @@ import ( "strings" "time" - valid "github.com/asaskevich/govalidator" xfnproto "github.com/crossplane/function-sdk-go/proto/v1beta1" xhelmv1 "github.com/vshn/appcat/v4/apis/helm/release/v1beta1" vshnv1 "github.com/vshn/appcat/v4/apis/vshn/v1" @@ -65,11 +64,14 @@ func DeployNextcloud(ctx context.Context, comp *vshnv1.VSHNNextcloud, svc *runti return runtime.NewWarningResult(fmt.Sprintf("cannot bootstrap instance namespace: %s", err)) } + var pgTime vshnv1.TimeOfDay + pgTime.SetTime(comp.GetMaintenanceTimeOfDay().GetTime().Add(20 * time.Minute)) + if comp.Spec.Parameters.Service.UseExternalPostgreSQL { svc.Log.Info("Adding postgresql instance") err = common.NewPostgreSQLDependencyBuilder(svc, comp). AddParameters(comp.Spec.Parameters.Service.PostgreSQLParameters). - SetCustomMaintenanceSchedule(comp.Spec.Parameters.Maintenance.TimeOfDay.AddTime(20 * time.Minute)). + SetCustomMaintenanceSchedule(pgTime). CreateDependency() if err != nil { return runtime.NewWarningResult(fmt.Sprintf("cannot create postgresql instance: %s", err)) @@ -262,7 +264,7 @@ func newValues(ctx context.Context, svc *runtime.ServiceRuntime, comp *vshnv1.VS } trustedDomain = append(trustedDomain, comp.Spec.Parameters.Service.FQDN...) - updatedNextcloudConfig := setBackgroundJobMaintenance(comp.Spec.Parameters.Maintenance.GetMaintenanceTimeOfDay(), nextcloudConfig) + updatedNextcloudConfig := setBackgroundJobMaintenance(*comp.GetMaintenanceTimeOfDay(), nextcloudConfig) values = map[string]any{ "nextcloud": map[string]any{ "host": comp.Spec.Parameters.Service.FQDN[0], @@ -433,14 +435,6 @@ func setBackgroundJobMaintenance(t vshnv1.TimeOfDay, nextcloudConfig string) str // Start Background Job Maintenance no earlier than 20 min after the regular Maintenance // and no later than 1 hour and 39 min after the regular Maintenance backgroundJobHour := t.GetTime().Add(40 * time.Minute).Add(time.Hour).Hour() - return strings.Replace(nextcloudConfig, "%maintenance_value%", strconv.Itoa(backgroundJobHour), 1) -} -func validateFQDNs(fqdns []string) error { - for _, fqdn := range fqdns { - if !valid.IsDNSName(fqdn) { - return fmt.Errorf("FQDN %s is not a valid DNS name", fqdn) - } - } - return nil + return strings.Replace(nextcloudConfig, "%maintenance_value%", strconv.Itoa(backgroundJobHour), 1) }