Uploaded image for project: 'AMQ Streams'
  1. AMQ Streams
  2. ENTMQST-6273

Diagnostic Tools(Report.sh) throws an error if there are two replicasets of ClusterOperator

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Undefined Undefined
    • None
    • 2.7.0.GA
    • None
    • None
    • False
    • Hide

      None

      Show
      None
    • False

      • Diagnostic Tools(Report.sh) throws an error if there are two replicasets of ClusterOperator
        •  Error from server (NotFound): replicasets.apps "strimzi-cluster-operator-xxx\nstrimzi-cluster-operator-yyy" not found
           
      • Directly, strimzi-cluster-operator is managed as a Deployment, but Replicasets and Pods are created internally by OpenShift from that Deployment definition.
      • The Replicaset of the strimzi-cluster-operator is normally only one, but when changing the strimzi-cluster-operator, such as version upgrades, two replicasets may be created temporarily.
      • Below is the code around L247 in Diagnostic Tools(Report.sh). I think the error is probably caused by L257, where it is assumed that there is only one name in '$CO_RS', but there are two replicasets. Pods use a for loop to deal with multiple Pods, so a similar solution would be implemented for Replicaset.
        echo "clusteroperator"
        CO_DEPLOY=$($KUBE_CLIENT get deploy strimzi-cluster-operator -o name -n "$NAMESPACE" --ignore-not-found)
        if [[ -n $CO_DEPLOY ]]; then
          echo "    $CO_DEPLOY"
          CO_DEPLOY=$(echo "$CO_DEPLOY" | cut -d "/" -f 2) && readonly CO_DEPLOY
          $KUBE_CLIENT get deploy "$CO_DEPLOY" -o yaml -n "$NAMESPACE" > "$OUT_DIR"/reports/deployments/"$CO_DEPLOY".yaml
          CO_RS=$($KUBE_CLIENT get rs -l strimzi.io/kind=cluster-operator -o name -n "$NAMESPACE" --ignore-not-found)
          if [[ -n $CO_RS ]]; then
            echo "    $CO_RS"
            CO_RS=$(echo "$CO_RS" | cut -d "/" -f 2) && readonly CO_RS
            $KUBE_CLIENT get rs "$CO_RS" -o yaml -n "$NAMESPACE" > "$OUT_DIR"/reports/replicasets/"$CO_RS".yaml
          fi
          mapfile -t CO_PODS < <($KUBE_CLIENT get po -l strimzi.io/kind=cluster-operator -o name -n "$NAMESPACE" --ignore-not-found)
          if [[ ${#CO_PODS[@]} -ne 0 ]]; then
            for pod in "${CO_PODS[@]}"; do
              echo "    $pod"
              CO_POD=$(echo "$pod" | cut -d "/" -f 2)
              $KUBE_CLIENT get po "$CO_POD" -o yaml -n "$NAMESPACE" > "$OUT_DIR"/reports/pods/"$CO_POD".yaml
              get_pod_logs "$CO_POD"
            done
          fi
        

              kliberti Kyle Liberti
              rhn-support-tyamashi Tomonari Yamashita
              Maros Orsak Maros Orsak
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: