Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't scale down Longhorn pods before pvmigrate runs #4868

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions pkg/cli/longhorn.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,6 @@ func NewLonghornPrepareForMigration(cli CLI) *cobra.Command {
}
logger.Print("All Longhorn volumes and nodes are healthy.")

if err := scaleDownPodsUsingLonghorn(cmd.Context(), logger, cli); err != nil {
return fmt.Errorf("error scaling down pods using longhorn volumes: %w", err)
}
logger.Print("Environment is ready for the Longhorn migration.")
return nil
},
Expand Down Expand Up @@ -253,28 +250,6 @@ func scaleUpPodsUsingLonghorn(ctx context.Context, logger *log.Logger, cli clien
return nil
}

// scaleDownPodsUsingLonghorn scales down all pods using Longhorn volumes.
func scaleDownPodsUsingLonghorn(ctx context.Context, logger *log.Logger, cli client.Client) error {
logger.Print("Scaling down pods using Longhorn volumes.")
if err := scaleEkco(ctx, logger, cli, 0); err != nil {
return fmt.Errorf("error scaling down ekco operator: %w", err)
}
if err := scaleDownPrometheus(ctx, logger, cli); err != nil {
return fmt.Errorf("error scaling down prometheus: %w", err)
}
objects, err := getObjectsUsingLonghorn(ctx, cli)
if err != nil {
return fmt.Errorf("error getting objects using longhorn: %w", err)
}
for _, obj := range objects {
if err := scaleDownObject(ctx, logger, cli, obj); err != nil {
return err
}
}
logger.Print("Pods using Longhorn volumes have been scaled down.")
return nil
}

func isPrometheusInstalled(ctx context.Context, cli client.Client) (bool, error) {
nsn := types.NamespacedName{Name: prometheusNamespace}
if err := cli.Get(ctx, nsn, &corev1.Namespace{}); err != nil {
Expand Down