Skip to content

Commit d8221ac

Browse files
authored
Fix extra slash in Machine.spec.providerID (#26)
During the reverse engineering of the GCP and AWS providers I erroneously assumed the provider IDs needs three slashes behind `cloudscale:`. In reality it is `gcp://`+`/instance` for those providers. Cloudscale does not have this extra slash. All machines should be updated to the correct ID on the first reconcile with the fixed code. Node objects get the correct ID from the cloudscale CCM already.
1 parent e32ee25 commit d8221ac

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

pkg/machine/actuator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ func machineAddressesFromCloudscaleServer(s cloudscale.Server) []corev1.NodeAddr
359359
}
360360

361361
func formatProviderID(uuid string) string {
362-
return fmt.Sprintf("cloudscale:///%s", uuid)
362+
return fmt.Sprintf("cloudscale://%s", uuid)
363363
}
364364

365365
func providerStatusFromCloudscaleServer(s cloudscale.Server) csv1beta1.CloudscaleMachineProviderStatus {

pkg/machine/actuator_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ func Test_Actuator_Create_ComplexMachineE2E(t *testing.T) {
162162
updatedMachine := &machinev1beta1.Machine{}
163163
require.NoError(t, c.Get(ctx, client.ObjectKeyFromObject(machine), updatedMachine))
164164
if assert.NotNil(t, updatedMachine.Spec.ProviderID) {
165-
assert.Equal(t, "cloudscale:///created-server-uuid", *updatedMachine.Spec.ProviderID)
165+
assert.Equal(t, "cloudscale://created-server-uuid", *updatedMachine.Spec.ProviderID)
166166
}
167167

168168
// Labels are just for show with kubectl get
@@ -595,7 +595,7 @@ func Test_Actuator_Update(t *testing.T) {
595595
var updatedMachine machinev1beta1.Machine
596596
require.NoError(t, c.Get(ctx, client.ObjectKeyFromObject(machine), &updatedMachine))
597597
if assert.NotNil(t, updatedMachine.Spec.ProviderID) {
598-
assert.Equal(t, "cloudscale:///machine-uuid", *updatedMachine.Spec.ProviderID)
598+
assert.Equal(t, "cloudscale://machine-uuid", *updatedMachine.Spec.ProviderID)
599599
}
600600
}
601601

0 commit comments

Comments
 (0)