Skip to content

Commit b6d9557

Browse files
committed
Don't consider stderr CLI output to be an error
Between RabbitMQ v3.8.14 and v3.8.15, the command `rabbitmq-queues rebalance quorum` outputs warn messages like `10:59:50.674 [warn] Node :"[email protected]" only contains 1 queues, do nothing` to stderr. Although this CLI command exits with 0, the operator considers this as a failure, retrying to execute that command. The operator logs the following: `2021-03-19T08:39:56.305Z ERROR controller-runtime.manager.controller.rabbitmqcluster Reconciler error {"reconciler group": "rabbitmq.com", "reconciler kind": "RabbitmqCluster", "name": "r1", "namespace": "default", "error": "failed to run queue rebalance on pod r1-server-0:` In general when CLI commands output to stderr, it doesn't mean that there was an error. So, in this commit we only consider non-zero exit codes as error.
1 parent 7117161 commit b6d9557

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

config/crd/bases/rabbitmq.com_rabbitmqclusters.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3499,7 +3499,7 @@ spec:
34993499
additionalPlugins:
35003500
description: 'List of plugins to enable in addition to essential plugins: rabbitmq_management, rabbitmq_prometheus, and rabbitmq_peer_discovery_k8s.'
35013501
items:
3502-
description: kubebuilder validating tags 'Pattern' and 'MaxLength' must be specified on string type. Alias type 'string' as 'Plugin' to specify schema validation on items of the list 'AdditionalPlugins'
3502+
description: A Plugin to enable on the RabbitmqCluster.
35033503
maxLength: 100
35043504
pattern: ^\w+$
35053505
type: string

controllers/pod_executor.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package controllers
33
import (
44
"bufio"
55
"bytes"
6-
"fmt"
6+
77
corev1 "k8s.io/api/core/v1"
88
"k8s.io/client-go/kubernetes"
99
"k8s.io/client-go/kubernetes/scheme"
@@ -48,12 +48,6 @@ func (p *rabbitmqPodExecutor) Exec(clientset *kubernetes.Clientset, clusterConfi
4848
Stdin: nil,
4949
Tty: false,
5050
})
51-
if err != nil {
52-
return stdOut.String(), stdErr.String(), err
53-
}
54-
if stdErr.Len() > 0 {
55-
return stdOut.String(), stdErr.String(), fmt.Errorf("%v", stdErr)
56-
}
5751

58-
return stdOut.String(), "", nil
52+
return stdOut.String(), stdErr.String(), err
5953
}

0 commit comments

Comments
 (0)