From fc407aa7c062d88e01fe71bb6de86ac5b4d8c2a1 Mon Sep 17 00:00:00 2001 From: Alexander Dahmen Date: Tue, 21 Jan 2025 17:00:57 +0100 Subject: [PATCH 1/4] Remove GetServiceStatusExecute for ske service Function was deprecated on 2024-04-16 and was now removed. Signed-off-by: Alexander Dahmen --- internal/pkg/services/ske/utils/utils.go | 1 - internal/pkg/services/ske/utils/utils_test.go | 14 -------------- 2 files changed, 15 deletions(-) diff --git a/internal/pkg/services/ske/utils/utils.go b/internal/pkg/services/ske/utils/utils.go index 8834a54a3..452d4b584 100644 --- a/internal/pkg/services/ske/utils/utils.go +++ b/internal/pkg/services/ske/utils/utils.go @@ -32,7 +32,6 @@ const ( ) type SKEClient interface { - GetServiceStatusExecute(ctx context.Context, projectId string) (*ske.ProjectResponse, error) ListClustersExecute(ctx context.Context, projectId string) (*ske.ListClustersResponse, error) ListProviderOptionsExecute(ctx context.Context) (*ske.ProviderOptions, error) } diff --git a/internal/pkg/services/ske/utils/utils_test.go b/internal/pkg/services/ske/utils/utils_test.go index d07207663..e19c16116 100644 --- a/internal/pkg/services/ske/utils/utils_test.go +++ b/internal/pkg/services/ske/utils/utils_test.go @@ -12,7 +12,6 @@ import ( "github.com/google/go-cmp/cmp" "github.com/google/uuid" - "github.com/stackitcloud/stackit-sdk-go/core/oapierror" "github.com/stackitcloud/stackit-sdk-go/services/ske" ) @@ -65,25 +64,12 @@ users: ) type skeClientMocked struct { - serviceDisabled bool - getServiceStatusFails bool - getServiceStatusResp *ske.ProjectResponse listClustersFails bool listClustersResp *ske.ListClustersResponse listProviderOptionsFails bool listProviderOptionsResp *ske.ProviderOptions } -func (m *skeClientMocked) GetServiceStatusExecute(_ context.Context, _ string) (*ske.ProjectResponse, error) { - if m.getServiceStatusFails { - return nil, fmt.Errorf("could not get service status") - } - if m.serviceDisabled { - return nil, &oapierror.GenericOpenAPIError{StatusCode: 404} - } - return m.getServiceStatusResp, nil -} - func (m *skeClientMocked) ListClustersExecute(_ context.Context, _ string) (*ske.ListClustersResponse, error) { if m.listClustersFails { return nil, fmt.Errorf("could not list clusters") From 6cfd67730050b6581863dce336e6bade1300235e Mon Sep 17 00:00:00 2001 From: Alexander Dahmen Date: Tue, 21 Jan 2025 18:04:42 +0100 Subject: [PATCH 2/4] Adjust ske datatypes Signed-off-by: Alexander Dahmen --- internal/cmd/ske/cluster/create/create_test.go | 5 +++-- internal/cmd/ske/cluster/update/update_test.go | 5 +++-- internal/cmd/ske/options/options.go | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/internal/cmd/ske/cluster/create/create_test.go b/internal/cmd/ske/cluster/create/create_test.go index cc2c6bd58..cf04a4066 100644 --- a/internal/cmd/ske/cluster/create/create_test.go +++ b/internal/cmd/ske/cluster/create/create_test.go @@ -3,6 +3,7 @@ package create import ( "context" "testing" + "time" "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" "github.com/stackitcloud/stackit-cli/internal/pkg/print" @@ -60,8 +61,8 @@ var testPayload = &ske.CreateOrUpdateClusterPayload{ MachineImageVersion: utils.Ptr(true), }, TimeWindow: &ske.TimeWindow{ - End: utils.Ptr("0000-01-01T05:00:00+02:00"), - Start: utils.Ptr("0000-01-01T03:00:00+02:00"), + End: utils.Ptr(time.Date(0000, 01, 01, 5, 0, 0, 0, time.UTC)), + Start: utils.Ptr(time.Date(0000, 01, 01, 3, 0, 0, 0, time.UTC)), }, }, } diff --git a/internal/cmd/ske/cluster/update/update_test.go b/internal/cmd/ske/cluster/update/update_test.go index 4bcab1e72..7199ecc38 100644 --- a/internal/cmd/ske/cluster/update/update_test.go +++ b/internal/cmd/ske/cluster/update/update_test.go @@ -3,6 +3,7 @@ package update import ( "context" "testing" + "time" "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags" "github.com/stackitcloud/stackit-cli/internal/pkg/print" @@ -60,8 +61,8 @@ var testPayload = ske.CreateOrUpdateClusterPayload{ MachineImageVersion: utils.Ptr(true), }, TimeWindow: &ske.TimeWindow{ - End: utils.Ptr("0000-01-01T05:00:00+02:00"), - Start: utils.Ptr("0000-01-01T03:00:00+02:00"), + End: utils.Ptr(time.Date(0000, 01, 01, 5, 0, 0, 0, time.UTC)), + Start: utils.Ptr(time.Date(0000, 01, 01, 3, 0, 0, 0, time.UTC)), }, }, } diff --git a/internal/cmd/ske/options/options.go b/internal/cmd/ske/options/options.go index fd0976997..51a8abb93 100644 --- a/internal/cmd/ske/options/options.go +++ b/internal/cmd/ske/options/options.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" "strings" + "time" "github.com/goccy/go-yaml" "github.com/stackitcloud/stackit-cli/internal/pkg/args" @@ -238,7 +239,7 @@ func buildKubernetesVersionsTable(resp *ske.ProviderOptions) (tables.Table, erro } expirationDate := "" if v.ExpirationDate != nil { - expirationDate = *v.ExpirationDate + expirationDate = v.ExpirationDate.Format(time.RFC3339) } table.AddRow(*v.Version, *v.State, expirationDate, string(featureGate)) } @@ -265,7 +266,7 @@ func buildMachineImagesTable(resp *ske.ProviderOptions) tables.Table { expirationDate := "-" if version.ExpirationDate != nil { - expirationDate = *version.ExpirationDate + expirationDate = version.ExpirationDate.Format(time.RFC3339) } table.AddRow(*image.Name, *version.Version, *version.State, expirationDate, criNamesString) } From 3ac6b3b036f87c2c68942eb665b318a17a9ffc8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BCdiger=20Schmitz?= <152157960+bahkauv70@users.noreply.github.com> Date: Thu, 23 Jan 2025 15:59:08 +0100 Subject: [PATCH 3/4] chore: fix testcase setup --- internal/cmd/ske/cluster/create/create_test.go | 4 ++-- internal/cmd/ske/cluster/update/update_test.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/cmd/ske/cluster/create/create_test.go b/internal/cmd/ske/cluster/create/create_test.go index cf04a4066..7e2496c84 100644 --- a/internal/cmd/ske/cluster/create/create_test.go +++ b/internal/cmd/ske/cluster/create/create_test.go @@ -61,8 +61,8 @@ var testPayload = &ske.CreateOrUpdateClusterPayload{ MachineImageVersion: utils.Ptr(true), }, TimeWindow: &ske.TimeWindow{ - End: utils.Ptr(time.Date(0000, 01, 01, 5, 0, 0, 0, time.UTC)), - Start: utils.Ptr(time.Date(0000, 01, 01, 3, 0, 0, 0, time.UTC)), + End: utils.Ptr(time.Date(0, 1, 1, 5, 0, 0, 0, time.FixedZone("test-zone", 2*60*60))), + Start: utils.Ptr(time.Date(0, 1, 1, 3, 0, 0, 0, time.FixedZone("test-zone", 2*60*60))), }, }, } diff --git a/internal/cmd/ske/cluster/update/update_test.go b/internal/cmd/ske/cluster/update/update_test.go index 7199ecc38..32a1cfed5 100644 --- a/internal/cmd/ske/cluster/update/update_test.go +++ b/internal/cmd/ske/cluster/update/update_test.go @@ -61,8 +61,8 @@ var testPayload = ske.CreateOrUpdateClusterPayload{ MachineImageVersion: utils.Ptr(true), }, TimeWindow: &ske.TimeWindow{ - End: utils.Ptr(time.Date(0000, 01, 01, 5, 0, 0, 0, time.UTC)), - Start: utils.Ptr(time.Date(0000, 01, 01, 3, 0, 0, 0, time.UTC)), + End: utils.Ptr(time.Date(0, 1, 1, 5, 0, 0, 0, time.FixedZone("test-zone", 2*60*60))), + Start: utils.Ptr(time.Date(0, 1, 1, 3, 0, 0, 0, time.FixedZone("test-zone", 2*60*60))), }, }, } From 2bf1c956a4f4b0351d4eebe25c2cfc672bd7d07c Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Thu, 23 Jan 2025 14:32:39 +0000 Subject: [PATCH 4/4] fix(deps): update module github.com/stackitcloud/stackit-sdk-go/services/ske to v0.21.1 --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 307f9bd8a..5f512f130 100644 --- a/go.mod +++ b/go.mod @@ -28,7 +28,7 @@ require ( github.com/stackitcloud/stackit-sdk-go/services/serverbackup v0.5.0 github.com/stackitcloud/stackit-sdk-go/services/serviceaccount v0.5.0 github.com/stackitcloud/stackit-sdk-go/services/serviceenablement v0.4.0 - github.com/stackitcloud/stackit-sdk-go/services/ske v0.21.0 + github.com/stackitcloud/stackit-sdk-go/services/ske v0.21.1 github.com/stackitcloud/stackit-sdk-go/services/sqlserverflex v0.9.0 github.com/zalando/go-keyring v0.2.6 golang.org/x/mod v0.22.0 diff --git a/go.sum b/go.sum index b079e7bc4..781c3b93c 100644 --- a/go.sum +++ b/go.sum @@ -157,8 +157,8 @@ github.com/stackitcloud/stackit-sdk-go/services/serviceaccount v0.5.0 h1:yf9BxAZ github.com/stackitcloud/stackit-sdk-go/services/serviceaccount v0.5.0/go.mod h1:Wpqj80yGruCNYGr2yxqhRaLLj4gPSkhJqZyWRXUh/QU= github.com/stackitcloud/stackit-sdk-go/services/serviceenablement v0.4.0 h1:K5fVTcJxjOVwJBa3kiWRsYNAq+I3jAYdU1U+f6no5lE= github.com/stackitcloud/stackit-sdk-go/services/serviceenablement v0.4.0/go.mod h1:zyg0hpiNdZLRbelkJb2KDf9OHQKLqqcTpePQ1qHL5dE= -github.com/stackitcloud/stackit-sdk-go/services/ske v0.21.0 h1:Pew85wQJe2e9K8ZRzxeFSimI29aqUZwOT/Ty0N1K+c0= -github.com/stackitcloud/stackit-sdk-go/services/ske v0.21.0/go.mod h1:iZyh3DMi2fUZxAIseykjKfDo2wf2FIDwpF43I22b8uk= +github.com/stackitcloud/stackit-sdk-go/services/ske v0.21.1 h1:oO+wCobC4OfH+vpfJQEnCUQuKVILRj5mQojBbzWgzDA= +github.com/stackitcloud/stackit-sdk-go/services/ske v0.21.1/go.mod h1:iZyh3DMi2fUZxAIseykjKfDo2wf2FIDwpF43I22b8uk= github.com/stackitcloud/stackit-sdk-go/services/sqlserverflex v0.9.0 h1:OYWT7B63isBPyVuPxd3yobvky7/nhcXQxaBgPki5nR4= github.com/stackitcloud/stackit-sdk-go/services/sqlserverflex v0.9.0/go.mod h1:vrl+OVJkjjupkvfkqY2T3HAB6x2x0S6zDhdFB5BWEnU= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=