Skip to content

Commit

Permalink
⚡ use resolve version on reconciliation
Browse files Browse the repository at this point in the history
  • Loading branch information
petar-cvit committed May 2, 2024
1 parent 2031b24 commit 5631c8b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cyclops-ctrl/internal/controller/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ func (m *Modules) ResourcesForModule(ctx *gin.Context) {
t, err := m.templatesRepo.GetTemplate(
module.Spec.TemplateRef.URL,
module.Spec.TemplateRef.Path,
module.Spec.TemplateRef.Version,
module.Status.TemplateResolvedVersion,
)
if err != nil {
fmt.Println(err)
Expand Down
7 changes: 6 additions & 1 deletion cyclops-ctrl/internal/modulecontroller/module_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,15 @@ func (r *ModuleReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctr

r.logger.Info("upsert module", "namespaced name", req.NamespacedName)

templateVersion := module.Status.TemplateResolvedVersion
if len(templateVersion) == 0 {
templateVersion = module.Spec.TemplateRef.Version
}

template, err := r.templatesRepo.GetTemplate(
module.Spec.TemplateRef.URL,
module.Spec.TemplateRef.Path,
module.Spec.TemplateRef.Version,
templateVersion,
)
if err != nil {
r.logger.Error(err, "error fetching module template", "namespaced name", req.NamespacedName)
Expand Down

0 comments on commit 5631c8b

Please sign in to comment.