INNER CODE UNIT · Go
newDebugCmd
rabbitmq/cluster-operator · kubectl-rabbitmq/commands.go:135
func newDebugCmd(getExecutor func() *kubectlExecutor) *cobra.Command {
return &cobra.Command{
Use: "debug INSTANCE",
Short: "Set log level to 'debug' on all nodes",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
executor := getExecutor()
instance := args[0]
// Get list of pods
output, err := executor.ExecuteWithOutput("get", "pods", "-l", fmt.Sprintf("app.kubernetes.io/name=%s", instance), "-o", "custom-columns=name:.metadata.name", "--no-headers")
if err != nil {
return err
}
pods := strings.Split(strings.TrimSpace(string(output)), "\n")
for _, pod := range pods {
if pod == "" {