Skip to content

Commit 8771e9c

Browse files
Improve logging in MachinePools.go
Signed-off-by: Anish Asthana <[email protected]> Co-authored-by: Michael Clifford <[email protected]>
1 parent 03df083 commit 8771e9c

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

controllers/machinepools.go

+11-5
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,14 @@ func scaleMachinePool(aw *arbv1.AppWrapper, userRequestedInstanceType string, re
4242
machinePoolID := strings.ReplaceAll(aw.Name+"-"+userRequestedInstanceType, ".", "-")
4343
createMachinePool, err := cmv1.NewMachinePool().ID(machinePoolID).InstanceType(userRequestedInstanceType).Replicas(replicas).Labels(m).Build()
4444
if err != nil {
45-
klog.Infof("Error creating machinepool %v", err)
45+
klog.Errorf(`Error building MachinePool: %v`, err)
4646
}
47-
48-
klog.Infof("Create machinepool with instance type %v and name %v", userRequestedInstanceType, createMachinePool.ID())
49-
clusterMachinePools.Add().Body(createMachinePool).SendContext(context.Background())
47+
klog.Infof("Built MachinePool with instance type %v and name %v", userRequestedInstanceType, createMachinePool.ID())
48+
response, err := clusterMachinePools.Add().Body(createMachinePool).SendContext(context.Background())
49+
if err != nil {
50+
klog.Errorf(`Error creating MachinePool: %v`, err)
51+
}
52+
klog.Infof("Created MachinePool: %v", response)
5053
}
5154

5255
func deleteMachinePool(aw *arbv1.AppWrapper) {
@@ -118,7 +121,10 @@ func getOCMClusterID(r *AppWrapperReconciler) error {
118121
// Get the client for the resource that manages the collection of clusters:
119122
collection := connection.ClustersMgmt().V1().Clusters()
120123

121-
response, _ := collection.List().Search(fmt.Sprintf("external_id = '%s'", internalClusterID)).Size(1).Page(1).SendContext(ctx)
124+
response, err := collection.List().Search(fmt.Sprintf("external_id = '%s'", internalClusterID)).Size(1).Page(1).SendContext(ctx)
125+
if err != nil {
126+
klog.Errorf(`Error getting cluster id: %v`, err)
127+
}
122128

123129
response.Items().Each(func(cluster *cmv1.Cluster) bool {
124130
ocmClusterID = cluster.ID()

0 commit comments

Comments
 (0)