Skip to content

feat(ske): add commands to trigger operations #873

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

h3adex
Copy link
Contributor

@h3adex h3adex commented Jul 17, 2025

Description

This PR adds the following commands:

stackit ske cluster hibernate (added a prompt for confirmation)
stackit ske cluster wakeup
stackit ske cluster maintenance (added a prompt for confirmation)
stackit ske cluster reconcile

Checklist

  • Issue was linked above
  • Code format was applied: make fmt
  • Examples were added / adjusted (see e.g. here)
  • Docs are up-to-date: make generate-docs (will be checked by CI)
  • Unit tests got implemented or updated
  • Unit tests are passing: make test (will be checked by CI)
  • No linter issues: make lint (will be checked by CI)

@h3adex h3adex requested a review from a team as a code owner July 17, 2025 15:12
@h3adex h3adex marked this pull request as draft July 17, 2025 15:12
@h3adex h3adex changed the title feat(ske): add commands to trigger hibernate, wakeup maintenance, and… feat(ske): add commands to trigger operations Jul 17, 2025
@h3adex h3adex force-pushed the feat/ske-triggers branch from c213269 to af1e398 Compare July 17, 2025 15:45
var testCtx = context.WithValue(context.Background(), testCtxKey{}, "foo")
var testClient = &ske.APIClient{}
var testProjectId = uuid.NewString()
var testRegion = "eu01"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

@rubenhoenle rubenhoenle marked this pull request as ready for review July 25, 2025 09:47
@rubenhoenle
Copy link
Member

@h3adex finished the implementation for you so we can merge this soon :)

Comment on lines +49 to +51

if !model.AssumeYes {
prompt := fmt.Sprintf("Are you sure you want to trigger hibernate for %q in project %q?", model.ClusterName, model.ProjectId)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The projectId can be replaced with the projectLabel and makes it easier for users, to validated if the project is correct

projectLabel, err := projectname.GetProjectName(ctx, params.Printer, params.CliVersion, cmd)
if err != nil {
params.Printer.Debug(print.ErrorLevel, "get project name: %v", err)
projectLabel = model.ProjectId
}

if err != nil {
return fmt.Errorf("hibernate SKE cluster: %w", err)
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know the command is described as trigger hibernate, but we could add a wait handler here and for this purpose, we there is already an existing waithandler CreateOrUpdateClusterWaitHandler https://github.com/stackitcloud/stackit-sdk-go/blob/b95f5b8024e9c461a08934817304dedf0696ddf9/services/ske/wait/wait.go#L44-L71

With the async flag it would be possible, to still have the option to just trigger a hibernate or wait until it's done

}

if !model.AssumeYes {
prompt := fmt.Sprintf("Are you sure you want to trigger maintenance for %q in project %q?", model.ClusterName, model.ProjectId)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here with the projectLabel like in the hibernate command

if err != nil {
return fmt.Errorf("trigger maintenance SKE cluster: %w", err)
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also here the wait handler can be added. I think here it's even more important, because the user may want to know, if the maintenance was finished. Without the wait handler, the user has to manually check with $ stackit ske cluster describe CLUSTER_NAME, if the maintenance is done

if err != nil {
return fmt.Errorf("wakeup SKE cluster: %w", err)
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here with the wait handler

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants