Skip to content

Commit 45d7a18

Browse files
committed
fix typo and rename func name
1 parent 0e0d469 commit 45d7a18

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

controllers/cloudstackmachine_controller.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ func (r *CloudStackMachineReconciliationRunner) GetOrCreateVMInstance() (retRes
175175
return ctrl.Result{}, errors.New("bootstrap secret data not yet set")
176176
}
177177

178-
userData := processUserData(data, r)
178+
userData := processCustomMetadata(data, r)
179179
err := r.CSUser.GetOrCreateVMInstance(r.ReconciliationSubject, r.CAPIMachine, r.CSCluster, r.FailureDomain, r.AffinityGroup, userData)
180180

181181
if err == nil && !controllerutil.ContainsFinalizer(r.ReconciliationSubject, infrav1.MachineFinalizer) { // Fetched or Created?
@@ -186,10 +186,9 @@ func (r *CloudStackMachineReconciliationRunner) GetOrCreateVMInstance() (retRes
186186
return ctrl.Result{}, err
187187
}
188188

189-
func processUserData(data []byte, r *CloudStackMachineReconciliationRunner) string {
189+
func processCustomMetadata(data []byte, r *CloudStackMachineReconciliationRunner) string {
190190
// since cloudstack metadata does not allow custom data added into meta_data, following line is a workaround to specify a hostname name
191-
// {{ ds.meta_data.hostname }} is expected to be used as a name when kubelet register a node
192-
// if more custom data needed to injected, this can be refactored into a method -- processCustomMetadata()
191+
// {{ ds.meta_data.hostname }} is expected to be used as a node name when kubelet register a node
193192
userData := hostnameMatcher.ReplaceAllString(string(data), r.CAPIMachine.Name)
194193
userData = failuredomainMatcher.ReplaceAllString(userData, r.FailureDomain.Spec.Name)
195194
return userData

controllers/cloudstackmachine_controller_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ var _ = Describe("CloudStackMachineReconciler", func() {
7373
}, timeout).WithPolling(pollInterval).Should(BeTrue())
7474
})
7575

76-
It("Should replace ds.mete_data.hostname with capi machine name.", func() {
76+
It("Should replace ds.meta_data.hostname with capi machine name.", func() {
7777
// Mock a call to GetOrCreateVMInstance and set the machine to running.
7878
mockCloudClient.EXPECT().GetOrCreateVMInstance(
7979
gomock.Any(), gomock.Any(), gomock.Any(),

0 commit comments

Comments
 (0)