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

     1  apiVersion: v1
     2  kind: ConfigMap
     3  metadata:
     4    name: mysql-scripts
     5    labels:
     6      {{- include "mysql.labels" . | nindent 4 }}
     7  data:
     8    set_config_variables.sh: |
     9      #!/bin/bash
    10      function set_config_variables(){
    11        echo "set config variables [$1]"
    12        config_file="/conf/$1.cnf"
    13        config_content=$(sed -n '/\['$1'\]/,/\[/ { /\['$1'\]/d; /\[/q; p; }' $config_file)
    14        while read line
    15        do
    16          if [[ $line =~ ^[a-zA-Z_][a-zA-Z0-9_]*=[a-zA-Z0-9_.]*$ ]]; then
    17            echo $line
    18            eval "export $line"
    19          elif ! [[ $line =~ ^[[:space:]]*# ]]; then 
    20            echo "bad format: $line"
    21          fi
    22        done <<< "$(echo -e "$config_content")"
    23      }
    24    setup.sh: |
    25      #!/bin/bash
    26      rmdir /docker-entrypoint-initdb.d && mkdir -p /data/mysql/docker-entrypoint-initdb.d && ln -s /data/mysql/docker-entrypoint-initdb.d /docker-entrypoint-initdb.d;
    27      exec docker-entrypoint.sh
    28    switchover-without-candidate.sh: |-
    29      #!/bin/bash
    30    agamotto.sh: |-
    31      #!/bin/sh
    32      if [ "$KB_PROXY_ENABLED" != "on" ]; then
    33        /bin/agamotto --config=/opt/agamotto/agamotto-config.yaml
    34      else
    35        /bin/agamotto --config=/opt/agamotto/agamotto-config-with-proxy.yaml
    36      fi