()
| 103 | } |
| 104 | |
| 105 | func (c *controller) Commit() (ctrl.Result, error) { |
| 106 | defer c.emitFailureEvent() |
| 107 | |
| 108 | if c.err != nil { |
| 109 | return ctrl.Result{}, c.err |
| 110 | } |
| 111 | if c.oldTree.GetRoot() == nil { |
| 112 | return ctrl.Result{}, nil |
| 113 | } |
| 114 | builder := NewPlanBuilder(c.ctx, c.cli, c.oldTree, c.tree, c.recorder, c.logger) |
| 115 | if c.err = builder.Init(); c.err != nil { |
| 116 | return ctrl.Result{}, c.err |
| 117 | } |
| 118 | var plan graph.Plan |
| 119 | plan, c.err = builder.Build() |
| 120 | if c.err != nil { |
| 121 | return ctrl.Result{}, c.err |
| 122 | } |
| 123 | if c.err = plan.Execute(); c.err != nil { |
| 124 | if apierrors.IsConflict(c.err) { |
| 125 | return ctrl.Result{Requeue: true}, nil |
| 126 | } |
| 127 | return ctrl.Result{}, c.err |
| 128 | } |
| 129 | if c.res.Next == rtry { |
| 130 | return ctrl.Result{Requeue: true, RequeueAfter: c.res.RetryAfter}, nil |
| 131 | } |
| 132 | return ctrl.Result{}, nil |
| 133 | } |
| 134 | |
| 135 | func (c *controller) emitFailureEvent() { |
| 136 | if c.err == nil { |
nothing calls this directly
no test coverage detected