Skip to content

Commit 723ee0c

Browse files
authored
Ensure error is not ommitted (#62)
We observed panics at https://github.com/IBM/ibm-object-csi-driver-operator/blob/1a5ddd2f042154644d473923f4b742ae9cb0e554/controllers/util/common/common.go#L287 Which indicates that the nodes object might be "empty". From looking at the code it's most likely that the List call with k8sClient failed. However as the err variable is initiated only in the scope of this if clause the latter error check did not catch the error Signed-off-by: Benjamin Isinger <[email protected]>
1 parent 1a5ddd2 commit 723ee0c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

controllers/util/common/common.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,8 @@ func (ch *ControllerHelper) GetClusterInfo(inConfig rest.Config) error {
271271
}
272272

273273
if k8sClient != nil {
274-
list, err := k8sClient.CoreV1().Nodes().List(context.TODO(), metav1.ListOptions{})
274+
var list *corev1.NodeList
275+
list, err = k8sClient.CoreV1().Nodes().List(context.TODO(), metav1.ListOptions{})
275276
if err == nil {
276277
nodes = *list
277278
}

0 commit comments

Comments
 (0)