Skip to content

Commit ac8eda7

Browse files
committed
feat(ske): improve ske create and update warnings
Signed-off-by: Mauritz Uphoff <[email protected]>
1 parent 8aa4d29 commit ac8eda7

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

go.mod

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ require (
4040
golang.org/x/mod v0.28.0
4141
)
4242

43+
replace (
44+
github.com/stackitcloud/stackit-sdk-go/services/ske => /Users/uphoffm/GolandProjects/stackit-sdk-go/services/ske
45+
)
46+
4347
require (
4448
github.com/hashicorp/go-retryablehttp v0.7.7 // indirect
4549
golang.org/x/telemetry v0.0.0-20250908211612-aef8a434d053 // indirect

stackit/internal/services/ske/cluster/resource.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -891,10 +891,29 @@ func (r *clusterResource) createOrUpdateCluster(ctx context.Context, diags *diag
891891
core.LogAndAddError(ctx, diags, "Error creating/updating cluster", fmt.Sprintf("Cluster creation waiting: %v", err))
892892
return
893893
}
894+
894895
if waitResp.Status.Error != nil && waitResp.Status.Error.Message != nil && *waitResp.Status.Error.Code == ske.RUNTIMEERRORCODE_OBSERVABILITY_INSTANCE_NOT_FOUND {
895896
core.LogAndAddWarning(ctx, diags, "Warning during creating/updating cluster", fmt.Sprintf("Cluster is in Impaired state due to an invalid observability instance id, the cluster is usable but metrics won't be forwarded: %s", *waitResp.Status.Error.Message))
896897
}
897898

899+
var errMsgs []string
900+
if waitResp.Status.Errors != nil && len(*waitResp.Status.Errors) > 0 {
901+
for _, clusterError := range *waitResp.Status.Errors {
902+
if clusterError.Code != nil && clusterError.Message != nil {
903+
errMsgs = append(errMsgs, fmt.Sprintf("- [%s] %s", *clusterError.Code, *clusterError.Message))
904+
}
905+
}
906+
907+
if len(errMsgs) > 0 {
908+
core.LogAndAddWarning(
909+
ctx,
910+
diags,
911+
"Warning during creating/updating cluster",
912+
fmt.Sprintf("Cluster creation/update encountered the following issues:\n%s", strings.Join(errMsgs, "\n")),
913+
)
914+
}
915+
}
916+
898917
err = mapFields(ctx, waitResp, model, region)
899918
if err != nil {
900919
core.LogAndAddError(ctx, diags, "Error creating/updating cluster", fmt.Sprintf("Processing API payload: %v", err))

0 commit comments

Comments
 (0)