Skip to content

Commit

Permalink
chore: support to queue for volume expansion ops (#6894)
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyelei authored Mar 27, 2024
1 parent c5ff3e4 commit 2b22122
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 20 deletions.
14 changes: 0 additions & 14 deletions apis/apps/v1alpha1/opsrequest_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -412,13 +412,6 @@ func (r *OpsRequest) validateVolumeExpansion(ctx context.Context, cli client.Cli
if err := r.checkComponentExistence(cluster, componentNames); err != nil {
return err
}
runningOpsList, err := GetRunningOpsByOpsType(ctx, cli, r.Spec.ClusterRef, r.Namespace, string(VolumeExpansionType))
if err != nil {
return err
}
if len(runningOpsList) > 0 && runningOpsList[0].Name != r.Name {
return fmt.Errorf("existing other VolumeExpansion OpsRequest: %s is running in Cluster: %s, handle this OpsRequest first", runningOpsList[0].Name, cluster.Name)
}
return r.checkVolumesAllowExpansion(ctx, cli, cluster)
}

Expand All @@ -436,13 +429,6 @@ func (r *OpsRequest) validateSwitchover(ctx context.Context, cli client.Client,
if err := r.checkComponentExistence(cluster, componentNames); err != nil {
return err
}
runningOpsList, err := GetRunningOpsByOpsType(ctx, cli, r.Spec.ClusterRef, r.Namespace, string(SwitchoverType))
if err != nil {
return err
}
if len(runningOpsList) > 0 && runningOpsList[0].Name != r.Name {
return fmt.Errorf("existing other Switchover OpsRequest: %s is running in Cluster: %s, handle this OpsRequest first", runningOpsList[0].Name, cluster.Name)
}
return validateSwitchoverResourceList(ctx, cli, cluster, switchoverList)
}

Expand Down
4 changes: 0 additions & 4 deletions apis/apps/v1alpha1/opsrequest_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,10 +337,6 @@ var _ = Describe("OpsRequest webhook", func() {
patch := client.MergeFrom(opsRequest.DeepCopy())
opsRequest.Status.Phase = OpsRunningPhase
Expect(k8sClient.Status().Patch(ctx, opsRequest, patch)).ShouldNot(HaveOccurred())
// create another ops
opsRequest1 := createTestOpsRequest(clusterName, opsRequestName+"1", VolumeExpansionType)
opsRequest1.Spec.VolumeExpansionList = getSingleVolumeExpansionList(componentName, defaultVCTName, "3Gi")
Expect(testCtx.CreateObj(ctx, opsRequest1).Error()).Should(ContainSubstring("existing other VolumeExpansion OpsRequest"))
}

testHorizontalScaling := func(clusterDef *ClusterDefinition, _ *Cluster) {
Expand Down
4 changes: 2 additions & 2 deletions controllers/apps/operations/volume_expansion.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ const (
func init() {
// the volume expansion operation only supports online expansion now
volumeExpansionBehaviour := OpsBehaviour{
OpsHandler: volumeExpansionOpsHandler{},
OpsHandler: volumeExpansionOpsHandler{},
QueueBySelf: true,
}

opsMgr := GetOpsManager()
opsMgr.RegisterOps(appsv1alpha1.VolumeExpansionType, volumeExpansionBehaviour)
}
Expand Down

0 comments on commit 2b22122

Please sign in to comment.