Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue with installation with create management flag set to false #996

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,9 @@ func main() {
currentNamespace := utils.CurrentNamespace()

templateReconciler := controller.TemplateReconciler{
Client: mgr.GetClient(),
SystemNamespace: currentNamespace,
Client: mgr.GetClient(),
CreateManagement: createManagement,
SystemNamespace: currentNamespace,
DefaultRegistryConfig: helm.DefaultRegistryConfig{
URL: defaultRegistryURL,
RepoType: determinedRepositoryType,
Expand Down
5 changes: 1 addition & 4 deletions internal/controller/release_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -389,10 +389,7 @@ func (r *ReleaseReconciler) SetupWithManager(mgr ctrl.Manager) error {
if err != nil {
return err
}
//
if !r.CreateManagement {
return nil
}

// There's no Release objects created yet and we need to trigger reconcile
initChannel := make(chan event.GenericEvent, 1)
initChannel <- event.GenericEvent{Object: &kcm.Release{}}
Expand Down
17 changes: 3 additions & 14 deletions internal/controller/template_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ type TemplateReconciler struct {

SystemNamespace string
DefaultRegistryConfig helm.DefaultRegistryConfig
CreateManagement bool
}

type ClusterTemplateReconciler struct {
Expand Down Expand Up @@ -83,10 +84,6 @@ func (r *ClusterTemplateReconciler) Reconcile(ctx context.Context, req ctrl.Requ

management, err := r.getManagement(ctx, clusterTemplate)
if err != nil {
if apierrors.IsNotFound(err) {
l.Info("Management is not created yet, retrying")
return ctrl.Result{RequeueAfter: defaultRequeueTime}, nil
}
return ctrl.Result{}, err
}
if !management.DeletionTimestamp.IsZero() {
Expand Down Expand Up @@ -137,10 +134,6 @@ func (r *ServiceTemplateReconciler) Reconcile(ctx context.Context, req ctrl.Requ

management, err := r.getManagement(ctx, serviceTemplate)
if err != nil {
if apierrors.IsNotFound(err) {
l.Info("Management is not created yet, retrying")
return ctrl.Result{RequeueAfter: defaultRequeueTime}, nil
}
return ctrl.Result{}, err
}
if !management.DeletionTimestamp.IsZero() {
Expand Down Expand Up @@ -174,14 +167,10 @@ func (r *ProviderTemplateReconciler) Reconcile(ctx context.Context, req ctrl.Req
}

management, err := r.getManagement(ctx, providerTemplate)
if err != nil {
if apierrors.IsNotFound(err) {
l.Info("Management is not created yet, retrying")
return ctrl.Result{RequeueAfter: defaultRequeueTime}, nil
}
if r.CreateManagement && err != nil {
return ctrl.Result{}, err
}
if !management.DeletionTimestamp.IsZero() {
if management != nil && !management.DeletionTimestamp.IsZero() {
l.Info("Management is being deleted, skipping ProviderTemplate reconciliation")
return ctrl.Result{}, nil
}
Expand Down