Skip to content

Commit

Permalink
update helm-project-operator with new generated code
Browse files Browse the repository at this point in the history
Signed-off-by: Alexandre Lamarre <[email protected]>
  • Loading branch information
alexandreLamarre committed Jan 7, 2025
1 parent 3a8bec8 commit edbdc4e
Showing 1 changed file with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func Register(
}
return h.shouldManage(projectHelmChart), nil
},
helmprojectcontroller.FromProjectHelmChartHandlerToHandler(h.OnRemove),
fromProjectHelmChartHandlerToHandler(h.OnRemove),
)

err := h.initRemoveCleanupLabels()
Expand All @@ -147,6 +147,22 @@ func Register(
}
}

// FIXME: hack porting old wrangler generic handler wrappers to this function
func fromProjectHelmChartHandlerToHandler(sync func(string, *v1alpha1.ProjectHelmChart) (*v1alpha1.ProjectHelmChart, error)) generic.Handler {
return func(key string, obj runtime.Object) (ret runtime.Object, err error) {
var v *v1alpha1.ProjectHelmChart
if obj == nil {
v, err = sync(key, nil)
} else {
v, err = sync(key, obj.(*v1alpha1.ProjectHelmChart))
}
if v == nil {
return nil, err
}
return v, err
}
}

func (h *handler) shouldManage(projectHelmChart *v1alpha1.ProjectHelmChart) bool {
if projectHelmChart == nil {
return false
Expand Down

0 comments on commit edbdc4e

Please sign in to comment.