Skip to content

Commit

Permalink
Remove deprecated powervs-provider-id-fmt code (#1404)
Browse files Browse the repository at this point in the history
Signed-off-by: Prajyot-Parab <[email protected]>
  • Loading branch information
Prajyot-Parab authored Sep 8, 2023
1 parent 983675a commit 5e7f808
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 27 deletions.
3 changes: 1 addition & 2 deletions cloud/scope/powervs_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand Down
17 changes: 0 additions & 17 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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")
Expand Down
8 changes: 0 additions & 8 deletions pkg/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,6 @@ package options
type ProviderIDFormatType string

const (
// PowerVSProviderIDFormatV1 will set provider id to machine as ibmpowervs://<cluster_name>/<vm_hostname>
// Deprecated: Use ProviderIDFormatV1.
PowerVSProviderIDFormatV1 ProviderIDFormatType = "v1"

// PowerVSProviderIDFormatV2 will set provider id to machine as ibmpowervs://<region>/<zone>/<service_instance_id>/<powervs_machine_id>
// Deprecated: Use ProviderIDFormatV2.
PowerVSProviderIDFormatV2 ProviderIDFormatType = "v2"

// ProviderIDFormatV1 will set provider id to machine as follows
// For VPC machines: ibmvpc://<cluster_name>/<vm_hostname>
// For Power VS machines: ibmpowervs://<cluster_name>/<vm_hostname>
Expand Down

0 comments on commit 5e7f808

Please sign in to comment.