Skip to content

Commit a1d95ae

Browse files
kizuna-lekapecloud-bot
authored andcommitted
fix: prohibit stop when post-provision is not completed (#9910)
(cherry picked from commit 84bf428)
1 parent 027e44e commit a1d95ae

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

controllers/apps/component/transformer_component_status.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ func (t *componentStatusTransformer) reconcileStatus(transCtx *componentTransfor
171171
switch {
172172
case isDeleting:
173173
t.setComponentStatusPhase(transCtx, appsv1.DeletingComponentPhase, nil, "component is Deleting")
174-
case stopped && hasRunningPods:
174+
case stopped && (hasRunningPods || !checkPostProvisionDone(transCtx)):
175175
t.setComponentStatusPhase(transCtx, appsv1.StoppingComponentPhase, nil, "component is Stopping")
176176
case stopped:
177177
t.setComponentStatusPhase(transCtx, appsv1.StoppedComponentPhase, nil, "component is Stopped")

controllers/apps/component/transformer_component_workload.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ func (t *componentWorkloadTransformer) reconcileReplicasStatus(ctx context.Conte
183183

184184
func (t *componentWorkloadTransformer) handleUpdate(transCtx *componentTransformContext, cli model.GraphClient, dag *graph.DAG,
185185
synthesizedComp *component.SynthesizedComponent, comp *appsv1.Component, runningITS, protoITS *workloads.InstanceSet) error {
186-
start, stop, err := t.handleWorkloadStartNStop(synthesizedComp, runningITS, &protoITS)
186+
start, stop, err := t.handleWorkloadStartNStop(transCtx, synthesizedComp, runningITS, &protoITS)
187187
if err != nil {
188188
return err
189189
}
@@ -213,16 +213,16 @@ func (t *componentWorkloadTransformer) handleUpdate(transCtx *componentTransform
213213
return nil
214214
}
215215

216-
func (t *componentWorkloadTransformer) handleWorkloadStartNStop(
217-
synthesizedComp *component.SynthesizedComponent, runningITS *workloads.InstanceSet, protoITS **workloads.InstanceSet) (bool, bool, error) {
216+
func (t *componentWorkloadTransformer) handleWorkloadStartNStop(transCtx *componentTransformContext, synthesizedComp *component.SynthesizedComponent,
217+
runningITS *workloads.InstanceSet, protoITS **workloads.InstanceSet) (bool, bool, error) {
218218
var (
219219
stop = isCompStopped(synthesizedComp)
220220
start = !stop && isWorkloadStopped(runningITS)
221221
)
222222
if start || stop {
223223
*protoITS = runningITS.DeepCopy() // don't modify the runningITS except for the replicas
224224
}
225-
if stop {
225+
if stop && checkPostProvisionDone(transCtx) {
226226
return start, stop, t.stopWorkload(synthesizedComp, runningITS, *protoITS)
227227
}
228228
if start {

0 commit comments

Comments
 (0)