-
Notifications
You must be signed in to change notification settings - Fork 21
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
base: main
Are you sure you want to change the base?
Conversation
c213269
to
af1e398
Compare
var testCtx = context.WithValue(context.Background(), testCtxKey{}, "foo") | ||
var testClient = &ske.APIClient{} | ||
var testProjectId = uuid.NewString() | ||
var testRegion = "eu01" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
af1e398
to
14fcc0f
Compare
@h3adex finished the implementation for you so we can merge this soon :) |
|
||
if !model.AssumeYes { | ||
prompt := fmt.Sprintf("Are you sure you want to trigger hibernate for %q in project %q?", model.ClusterName, model.ProjectId) |
There was a problem hiding this comment.
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
stackit-cli/internal/cmd/ske/enable/enable.go
Lines 51 to 55 in c31dd87
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) | ||
} | ||
|
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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) | ||
} | ||
|
There was a problem hiding this comment.
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) | ||
} | ||
|
There was a problem hiding this comment.
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
Description
This PR adds the following commands:
Checklist
make fmt
make generate-docs
(will be checked by CI)make test
(will be checked by CI)make lint
(will be checked by CI)