Skip to content

Commit 6d7a424

Browse files
Merge pull request #844 from reedcort/SREP-2822-remove-override
Update remove override flag to display recommended-cluster-size
2 parents 47b9b80 + 4bd1903 commit 6d7a424

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

cmd/cluster/resize/requestserving_node.go

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,8 @@ func (r *requestServingNodesOpts) sendCustomerServiceLog() error {
417417
func (r *requestServingNodesOpts) handleRemoveOverride(ctx context.Context, hostedCluster *hypershiftv1beta1.HostedCluster, clusterName, hcNamespace string) error {
418418
overrideAnnotation := "hypershift.openshift.io/cluster-size-override"
419419
currentOverride, hasOverride := hostedCluster.Annotations[overrideAnnotation]
420+
recommendAnnotation := "hypershift.openshift.io/recommended-cluster-size"
421+
currentRecommendatation, hasRecommendatation := hostedCluster.Annotations[recommendAnnotation]
420422

421423
if !hasOverride || currentOverride == "" {
422424
printer.PrintlnGreen("\nNo cluster-size-override annotation found. Cluster is already using default sizing behavior.")
@@ -430,7 +432,16 @@ func (r *requestServingNodesOpts) handleRemoveOverride(ctx context.Context, host
430432
printer.PrintlnGreen(fmt.Sprintf("Current hosted-cluster-size: %s", currentSize))
431433
}
432434

435+
if hasRecommendatation && currentRecommendatation != "" {
436+
printer.PrintlnGreen(fmt.Sprintf("Recommended cluster size: %s", currentRecommendatation))
437+
}
438+
433439
fmt.Printf("\nThis will remove the cluster-size-override annotation from cluster %s\n", clusterName)
440+
if hasRecommendatation && currentRecommendatation != "" {
441+
fmt.Printf("The cluster will revert to the recommended size: %s\n", currentRecommendatation)
442+
} else {
443+
fmt.Println("The cluster will revert to automatic sizing based on the worker node pool size.")
444+
}
434445
if !utils.ConfirmPrompt() {
435446
return errors.New("operation cancelled by user")
436447
}
@@ -458,12 +469,17 @@ func (r *requestServingNodesOpts) handleRemoveOverride(ctx context.Context, host
458469
if newSize != "" {
459470
printer.PrintlnGreen(fmt.Sprintf("Current hosted-cluster-size: %s", newSize))
460471
}
472+
473+
newRecommended, hasNewRecommended := updatedHC.Annotations[recommendAnnotation]
474+
if hasNewRecommended && newRecommended != "" {
475+
printer.PrintlnGreen(fmt.Sprintf("Recommended cluster size: %s", newRecommended))
476+
}
461477
}
462478

463479
fmt.Println("\nOverride removed successfully!")
464480
fmt.Println("\nUse the following commands to monitor the cluster:")
465481
fmt.Printf("\nVerify cluster size (annotation and label):\n")
466-
fmt.Printf(" oc get hostedcluster -n %s -oyaml | grep -E '(cluster-size-override|hosted-cluster-size)'\n", hcNamespace)
482+
fmt.Printf(" oc get hostedcluster -n %s -oyaml | grep -E '(cluster-size-override|hosted-cluster-size|recommended-cluster-size)'\n", hcNamespace)
467483
fmt.Printf("\nMonitor nodes:\n")
468484
fmt.Printf(" oc get nodes -l hypershift.openshift.io/cluster-namespace=%s\n", hcNamespace)
469485

0 commit comments

Comments
 (0)