reconcile: allow cfg of manager in atomic action
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
This commit is contained in:
parent
ac9c2c3142
commit
f156c3550e
|
|
@ -328,7 +328,7 @@ func (r *HelmReleaseReconciler) reconcileRelease(ctx context.Context, patchHelpe
|
||||||
}
|
}
|
||||||
|
|
||||||
// Off we go!
|
// Off we go!
|
||||||
if err = intreconcile.NewAtomicRelease(patchHelper, cfg, r.EventRecorder).Reconcile(ctx, &intreconcile.Request{
|
if err = intreconcile.NewAtomicRelease(patchHelper, cfg, r.EventRecorder, r.FieldManager).Reconcile(ctx, &intreconcile.Request{
|
||||||
Object: obj,
|
Object: obj,
|
||||||
Chart: loadedChart,
|
Chart: loadedChart,
|
||||||
Values: values,
|
Values: values,
|
||||||
|
|
|
||||||
|
|
@ -80,16 +80,18 @@ type AtomicRelease struct {
|
||||||
configFactory *action.ConfigFactory
|
configFactory *action.ConfigFactory
|
||||||
eventRecorder record.EventRecorder
|
eventRecorder record.EventRecorder
|
||||||
strategy releaseStrategy
|
strategy releaseStrategy
|
||||||
|
fieldManager string
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewAtomicRelease returns a new AtomicRelease reconciler configured with the
|
// NewAtomicRelease returns a new AtomicRelease reconciler configured with the
|
||||||
// provided values.
|
// provided values.
|
||||||
func NewAtomicRelease(patchHelper *patch.SerialPatcher, cfg *action.ConfigFactory, recorder record.EventRecorder) *AtomicRelease {
|
func NewAtomicRelease(patchHelper *patch.SerialPatcher, cfg *action.ConfigFactory, recorder record.EventRecorder, fieldManager string) *AtomicRelease {
|
||||||
return &AtomicRelease{
|
return &AtomicRelease{
|
||||||
patchHelper: patchHelper,
|
patchHelper: patchHelper,
|
||||||
eventRecorder: recorder,
|
eventRecorder: recorder,
|
||||||
configFactory: cfg,
|
configFactory: cfg,
|
||||||
strategy: &cleanReleaseStrategy{},
|
strategy: &cleanReleaseStrategy{},
|
||||||
|
fieldManager: fieldManager,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -188,7 +190,7 @@ func (r *AtomicRelease) Reconcile(ctx context.Context, req *Request) error {
|
||||||
conditions.MarkTrue(req.Object, meta.ReconcilingCondition, "Progressing", "Running '%s' %s action with timeout of %s",
|
conditions.MarkTrue(req.Object, meta.ReconcilingCondition, "Progressing", "Running '%s' %s action with timeout of %s",
|
||||||
next.Name(), next.Type(), timeoutForAction(next, req.Object).String())
|
next.Name(), next.Type(), timeoutForAction(next, req.Object).String())
|
||||||
// Patch the object to reflect the new condition.
|
// Patch the object to reflect the new condition.
|
||||||
if err = r.patchHelper.Patch(ctx, req.Object, patch.WithOwnedConditions{Conditions: OwnedConditions}, patch.WithFieldOwner("helm-controller")); err != nil {
|
if err = r.patchHelper.Patch(ctx, req.Object, patch.WithOwnedConditions{Conditions: OwnedConditions}, patch.WithFieldOwner(r.fieldManager)); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -214,7 +216,7 @@ func (r *AtomicRelease) Reconcile(ctx context.Context, req *Request) error {
|
||||||
previous = append(previous, next.Type())
|
previous = append(previous, next.Type())
|
||||||
|
|
||||||
// Patch the release to reflect progress.
|
// Patch the release to reflect progress.
|
||||||
if err = r.patchHelper.Patch(ctx, req.Object, patch.WithOwnedConditions{Conditions: OwnedConditions}, patch.WithFieldOwner("helm-controller")); err != nil {
|
if err = r.patchHelper.Patch(ctx, req.Object, patch.WithOwnedConditions{Conditions: OwnedConditions}, patch.WithFieldOwner(r.fieldManager)); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -163,7 +163,7 @@ func TestAtomicRelease_Reconcile(t *testing.T) {
|
||||||
Chart: testutil.BuildChart(testutil.ChartWithTestHook()),
|
Chart: testutil.BuildChart(testutil.ChartWithTestHook()),
|
||||||
Values: nil,
|
Values: nil,
|
||||||
}
|
}
|
||||||
g.Expect(NewAtomicRelease(patchHelper, cfg, recorder).Reconcile(context.TODO(), req)).ToNot(HaveOccurred())
|
g.Expect(NewAtomicRelease(patchHelper, cfg, recorder, "helm-controller").Reconcile(context.TODO(), req)).ToNot(HaveOccurred())
|
||||||
|
|
||||||
g.Expect(obj.Status.Conditions).To(conditions.MatchConditions([]metav1.Condition{
|
g.Expect(obj.Status.Conditions).To(conditions.MatchConditions([]metav1.Condition{
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue