diff --git a/.goreleaser.yml b/.goreleaser.yml index e5deb8b5b..ad68bbf58 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -63,21 +63,21 @@ archives: 386: i386 amd64: x86_64 format: binary -brew: - name: kudo-cli - github: - owner: kudobuilder - name: homebrew-tap - commit_author: - name: kudoreleasebot - email: release@kudo.dev - folder: Formula - homepage: https://kudo.dev - description: Interact with KUDO via the kubectl plugin - dependencies: - - kubernetes-cli - install: | - bin.install "kubectl-kudo" +brews: + - name: kudo-cli + github: + owner: kudobuilder + name: homebrew-tap + commit_author: + name: kudoreleasebot + email: release@kudo.dev + folder: Formula + homepage: https://kudo.dev + description: Interact with KUDO via the kubectl plugin + dependencies: + - kubernetes-cli + install: | + bin.install "kubectl-kudo" checksum: name_template: 'checksums.txt' snapshot: diff --git a/pkg/controller/instance/instance_controller.go b/pkg/controller/instance/instance_controller.go index 76c667630..53427298b 100644 --- a/pkg/controller/instance/instance_controller.go +++ b/pkg/controller/instance/instance_controller.go @@ -310,7 +310,7 @@ func createPlanAndUpdateReference(c client.Client, r record.EventRecorder, schem planExecution := newPlanExecution(instance, planName, scheme) log.Printf("Creating PlanExecution of planExecution %s for instance %s", planName, instance.Name) - r.Event(instance, "Normal", "CreatePlanExecution", fmt.Sprintf("Creating \"%v\" planExecution execution", planName)) + r.Event(instance, "Normal", "CreatePlanExecution", fmt.Sprintf("Creating \"%v\" planExecution on %s", planName, instance.Name)) // Make this instance the owner of the PlanExecution if err := controllerutil.SetControllerReference(instance, planExecution, scheme); err != nil { diff --git a/pkg/controller/planexecution/planexecution_controller.go b/pkg/controller/planexecution/planexecution_controller.go index fae0c632e..0c7727ff7 100644 --- a/pkg/controller/planexecution/planexecution_controller.go +++ b/pkg/controller/planexecution/planexecution_controller.go @@ -165,26 +165,28 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error { &handler.EnqueueRequestsFromMapFunc{ ToRequests: handler.ToRequestsFunc( func(a handler.MapObject) []reconcile.Request { + // instance in instance -> reconcile plan for outer instance requests := mapToOwningInstanceActivePlan(a) - if len(requests) == 0 { - inst := &kudov1alpha1.Instance{} - err = mgr.GetClient().Get(context.TODO(), client.ObjectKey{ - Name: a.Meta.GetName(), - Namespace: a.Meta.GetNamespace(), - }, inst) - - if err == nil { - // for every updated/added instance also trigger reconcile for its active plan - requests = append(requests, reconcile.Request{ - NamespacedName: types.NamespacedName{ - Name: inst.Status.ActivePlan.Name, - Namespace: inst.Status.ActivePlan.Namespace, - }, - }) - } else { - log.Printf("PlanExecutionController: received event from Instance %s/%s but instance of that name does not exist", a.Meta.GetNamespace(), a.Meta.GetName()) - } + + // instance in instance -> reconcile plan for inner instance + inst := &kudov1alpha1.Instance{} + err = mgr.GetClient().Get(context.TODO(), client.ObjectKey{ + Name: a.Meta.GetName(), + Namespace: a.Meta.GetNamespace(), + }, inst) + + if err == nil { + // for every updated/added instance also trigger reconcile for its active plan + requests = append(requests, reconcile.Request{ + NamespacedName: types.NamespacedName{ + Name: inst.Status.ActivePlan.Name, + Namespace: inst.Status.ActivePlan.Namespace, + }, + }) + } else { + log.Printf("PlanExecutionController: received event from Instance %s/%s but instance of that name does not exist", a.Meta.GetNamespace(), a.Meta.GetName()) } + return requests }), }, @@ -313,6 +315,8 @@ func (r *ReconcilePlanExecution) Reconcile(request reconcile.Request) (reconcile return reconcile.Result{}, err } + log.Printf("Going to execute plan %s on instance %s", planExecution.Name, instance.Name) + // now we're actually starting with the execution of plan/phase/step for i, phase := range planExecution.Status.Phases { // If we still want to execute phases in this plan check if phase is healthy