From 5e7f80878f2252c6ab13c16102de90c784a2624d Mon Sep 17 00:00:00 2001 From: Prajyot Parab Date: Fri, 8 Sep 2023 18:32:15 +0530 Subject: [PATCH] Remove deprecated powervs-provider-id-fmt code (#1404) Signed-off-by: Prajyot-Parab --- cloud/scope/powervs_machine.go | 3 +-- main.go | 17 ----------------- pkg/options/options.go | 8 -------- 3 files changed, 1 insertion(+), 27 deletions(-) diff --git a/cloud/scope/powervs_machine.go b/cloud/scope/powervs_machine.go index 32028599a..e40c7bc31 100644 --- a/cloud/scope/powervs_machine.go +++ b/cloud/scope/powervs_machine.go @@ -589,8 +589,7 @@ func (m *PowerVSMachineScope) GetZone() string { // SetProviderID will set the provider id for the machine. func (m *PowerVSMachineScope) SetProviderID(id *string) { // Based on the ProviderIDFormat version the providerID format will be decided. - if options.ProviderIDFormatType(options.PowerVSProviderIDFormat) == options.PowerVSProviderIDFormatV2 || - options.ProviderIDFormatType(options.ProviderIDFormat) == options.ProviderIDFormatV2 { + if options.ProviderIDFormatType(options.ProviderIDFormat) == options.ProviderIDFormatV2 { if id != nil { m.IBMPowerVSMachine.Spec.ProviderID = pointer.String(fmt.Sprintf("ibmpowervs://%s/%s/%s/%s", m.GetRegion(), m.GetZone(), m.IBMPowerVSMachine.Spec.ServiceInstanceID, *id)) } diff --git a/main.go b/main.go index 186d7ae2c..1e7a19efd 100644 --- a/main.go +++ b/main.go @@ -165,15 +165,6 @@ func initFlags(fs *pflag.FlagSet) { "The minimum interval at which watched resources are reconciled.", ) - // Deprecated: Use provider-id-fmt flag go set provider id format for Power VS. - fs.StringVar( - &options.PowerVSProviderIDFormat, - "powervs-provider-id-fmt", - string(options.PowerVSProviderIDFormatV1), - "ProviderID format is used set the Provider ID format for Machine", - ) - _ = fs.MarkDeprecated("powervs-provider-id-fmt", "please use provider-id-fmt flag") - fs.StringVar( &options.ProviderIDFormat, "provider-id-fmt", @@ -190,14 +181,6 @@ func initFlags(fs *pflag.FlagSet) { } func validateFlags() error { - switch options.ProviderIDFormatType(options.PowerVSProviderIDFormat) { - case options.PowerVSProviderIDFormatV1: - setupLog.Info("Power VS ProviderID format is set to v1 version") - case options.PowerVSProviderIDFormatV2: - setupLog.Info("Power VS ProviderID format is set to v2 version") - default: - return fmt.Errorf("invalid value for flag powervs-provider-id-fmt: %s, Supported values: v1, v2 ", options.PowerVSProviderIDFormat) - } switch options.ProviderIDFormatType(options.ProviderIDFormat) { case options.ProviderIDFormatV1: setupLog.Info("Using v1 version of ProviderID format") diff --git a/pkg/options/options.go b/pkg/options/options.go index f91bb1a4d..36de563db 100644 --- a/pkg/options/options.go +++ b/pkg/options/options.go @@ -20,14 +20,6 @@ package options type ProviderIDFormatType string const ( - // PowerVSProviderIDFormatV1 will set provider id to machine as ibmpowervs:/// - // Deprecated: Use ProviderIDFormatV1. - PowerVSProviderIDFormatV1 ProviderIDFormatType = "v1" - - // PowerVSProviderIDFormatV2 will set provider id to machine as ibmpowervs:///// - // Deprecated: Use ProviderIDFormatV2. - PowerVSProviderIDFormatV2 ProviderIDFormatType = "v2" - // ProviderIDFormatV1 will set provider id to machine as follows // For VPC machines: ibmvpc:/// // For Power VS machines: ibmpowervs:///