Skip to content

Commit

Permalink
dev: use creator params
Browse files Browse the repository at this point in the history
  • Loading branch information
sunsingerus committed May 17, 2024
1 parent 91f4d2e commit 26025ee
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
4 changes: 2 additions & 2 deletions pkg/controller/chi/worker-chi-reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -1237,7 +1237,7 @@ func (w *worker) fetchPVC(
if volume.OperatorShouldCreatePVC(host, volumeClaimTemplate) {
// Operator is in charge of PVCs
// Create PVC model.
pvc = w.task.creator.CreatePVC(pvcName, host, &volumeClaimTemplate.Spec)
pvc = w.task.creator.CreatePVC(pvcName, namespace, host, &volumeClaimTemplate.Spec)
w.a.V(1).M(host).Info("PVC (%s/%s/%s/%s) model provided by the operator", namespace, host.GetName(), volumeMount.Name, pvcName)
return pvc, volumeClaimTemplate, true, nil
}
Expand Down Expand Up @@ -1270,6 +1270,6 @@ func (w *worker) reconcilePVC(
}

w.applyPVCResourcesRequests(pvc, template)
pvc = w.task.creator.PreparePersistentVolumeClaim(pvc, host, template)
pvc = w.task.creator.AdjustPersistentVolumeClaim(pvc, host, template)
return w.c.updatePersistentVolumeClaim(ctx, pvc)
}
27 changes: 19 additions & 8 deletions pkg/controller/chi/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,25 @@ func (c *Controller) newWorker(q queue.PriorityQueue, sys bool) *worker {

// newContext creates new reconcile task
func (w *worker) newTask(chi *api.ClickHouseInstallation) {
w.task = newTask(chiCreator.NewCreator(chi, config.NewClickHouseConfigFilesGenerator(chi, &config.ConfigGeneratorOptions{
Users: chi.GetSpec().Configuration.Users,
Profiles: chi.GetSpec().Configuration.Profiles,
Quotas: chi.GetSpec().Configuration.Quotas,
Settings: chi.GetSpec().Configuration.Settings,
Files: chi.GetSpec().Configuration.Files,
DistributedDDL: chi.GetSpec().Defaults.DistributedDDL,
})))
w.task = newTask(
chiCreator.NewCreator(
chi,
config.NewClickHouseConfigFilesGenerator(
chi,
&config.ConfigGeneratorOptions{
Users: chi.GetSpec().Configuration.Users,
Profiles: chi.GetSpec().Configuration.Profiles,
Quotas: chi.GetSpec().Configuration.Quotas,
Settings: chi.GetSpec().Configuration.Settings,
Files: chi.GetSpec().Configuration.Files,
DistributedDDL: chi.GetSpec().Defaults.DistributedDDL,
},
),
chiCreator.NewContainerManager(chiCreator.ContainerManagerTypeClickHouse),
chiCreator.NewProbeManager(chiCreator.ProbeManagerTypeClickHouse),
chiCreator.NewServiceManager(chiCreator.ServiceManagerTypeClickHouse),
),
)
}

// timeToStart specifies time that operator does not accept changes
Expand Down

0 comments on commit 26025ee

Please sign in to comment.