Skip to content
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

Remove deprecated powervs-provider-id-fmt code #1404

Merged
merged 1 commit into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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