github.com/1aal/kubeblocks@v0.0.0-20231107070852-e1c03e598921/deploy/nebula/templates/scripts.yaml (about)

     1  apiVersion: v1
     2  kind: ConfigMap
     3  metadata:
     4    name: nebula-storaged-scripts
     5    labels:
     6      {{- include "nebula.labels" . | nindent 4 }}
     7  data:
     8    pre-stop.sh: |
     9      #!/bin/sh
    10      idx=${KB_POD_NAME##*-}
    11      current_component_replicas=`cat /etc/annotations/component-replicas`
    12      if [ ! $idx -lt $current_component_replicas ] && [ $current_component_replicas -ne 0 ]; then
    13        storagedhost=$(echo DROP HOSTS \"${KB_POD_FQDN}{{ .Values.clusterDomain }}\":9779)
    14        touch /tmp/nebula-storaged-hosts
    15        echo DROP HOSTS \"$KB_POD_FQDN{{ .Values.clusterDomain }}\":9779 > /tmp/nebula-storaged-hosts
    16        exec /usr/local/bin/nebula-console --addr $GRAPHD_SVC_NAME --port $GRAPHD_SVC_PORT --user root --password nebula -f /tmp/nebula-storaged-hosts
    17        rm /tmp/nebula-storaged-hosts
    18      fi
    19    post-start.sh: |
    20      #!/bin/sh
    21      echo "Waiting for graphd service $GRAPHD_SVC_NAME to be ready..."
    22      until /usr/local/bin/nebula-console --addr $GRAPHD_SVC_NAME --port $GRAPHD_SVC_PORT --user root --password nebula -e "show spaces"; do sleep 2; done
    23      touch  /tmp/nebula-storaged-hosts
    24      echo ADD HOSTS \"${KB_POD_FQDN}{{ .Values.clusterDomain }}\":9779 > /tmp/nebula-storaged-hosts
    25      exec /usr/local/bin/nebula-console --addr $GRAPHD_SVC_NAME --port $GRAPHD_SVC_PORT --user root --password nebula -f /tmp/nebula-storaged-hosts
    26      rm /tmp/nebula-storaged-hosts
    27      echo "Start Console succeeded!"