|
@@ -80,7 +80,14 @@ func (r *ComponentReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
|
|
|
return ctrl.Result{}, nil
|
|
return ctrl.Result{}, nil
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- componentReconciler := r.getComponentReconciler(comp)
|
|
|
|
|
|
|
+ stack := &v1alpha1.Stack{}
|
|
|
|
|
+ if comp.Spec.StackRef == nil || comp.Spec.StackRef.Name == "" {
|
|
|
|
|
+ stack = nil
|
|
|
|
|
+ } else if err := r.Get(ctx, client.ObjectKey{Namespace: comp.Namespace, Name: comp.Spec.StackRef.Name}, stack); err != nil {
|
|
|
|
|
+ stack = nil
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ componentReconciler := r.getComponentReconciler(comp, stack)
|
|
|
dependencies, err := componentReconciler.ReconcileComponent(ctx, &tmpl, make(map[string]string))
|
|
dependencies, err := componentReconciler.ReconcileComponent(ctx, &tmpl, make(map[string]string))
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
apimeta.SetStatusCondition(&comp.Status.Conditions, metav1.Condition{
|
|
apimeta.SetStatusCondition(&comp.Status.Conditions, metav1.Condition{
|
|
@@ -150,8 +157,8 @@ func (r *ComponentReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
|
|
|
return ctrl.Result{}, nil
|
|
return ctrl.Result{}, nil
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func (r *ComponentReconciler) getComponentReconciler(comp *v1alpha1.Component) reconciler.ComponentReconciler {
|
|
|
|
|
- return reconciler.NewDefaultComponentReconciler(r.Client, r.Scheme, comp)
|
|
|
|
|
|
|
+func (r *ComponentReconciler) getComponentReconciler(comp *v1alpha1.Component, stack *v1alpha1.Stack) reconciler.ComponentReconciler {
|
|
|
|
|
+ return reconciler.NewDefaultComponentReconciler(r.Client, r.Scheme, stack, comp)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// SetupWithManager sets up the controller with the Manager.
|
|
// SetupWithManager sets up the controller with the Manager.
|