Skip to content

Commit

Permalink
chore: remove unnecessary scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
kubeJocker committed Oct 18, 2024
1 parent 928f5ec commit b3294b3
Showing 1 changed file with 6 additions and 30 deletions.
36 changes: 6 additions & 30 deletions addons/mysql/scripts/mysql-orchestrator-register.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
#!/bin/sh
set -ex

# meta mysql connection parameters
# mysql_port="3306"
# mysql_username="$MYSQL_ROOT_USER"
# mysql_password="$MYSQL_ROOT_PASSWORD"

# topology_user="$ORC_TOPOLOGY_USER"
# topology_password="$ORC_TOPOLOGY_PASSWORD"

# component_name="$KB_COMP_NAME"

# register first pod to orchestrator
# register a mysql instance to orchestrator
register_to_orchestrator() {
local host_ip=$1

Expand All @@ -35,8 +25,6 @@ register_to_orchestrator() {
exit 1
fi

# url for orchestrator to discover this host_ip

# send request to orchestrator for discovery
response=$(curl -s -o /dev/null -w "%{http_code}" $url)
if [ $response -eq 200 ]; then
Expand All @@ -48,29 +36,17 @@ register_to_orchestrator() {
echo "register $pod_name ($host_ip) to Orchestrator successful."
}

# Get the svc list from the environment variable
# and get the topology information of the current cluster from the orchestrator
main() {

if [ -z "$MSYQL_POD_NAME_LIST" ] || [ -z "$MSYQL_POD_HOST_IP_LIST" ]; then
echo "Error: Required environment variables MYSQL_POD_NAME_LIST or MSYQL_POD_HOST_IP_LIST are not set."
exit 1
fi

old_ifs="$IFS"
IFS=','
pod_name_list=($MYSQL_POD_NAME_LIST)
pod_ip_list=($KB_CLUSTER_COMPONENT_POD_IP_LIST)
IFS="$old_ifs"
echo "pod_name_list: $pod_name_list"
# register the first MySQL instance to Orchestrator,
# and Orchestrator will obtain the entire MySQL cluster topology info from this instance.
register_first_mysql_instance() {

# get first MySQL instance host name.
first_mysql_service_host_name=$(echo "${KB_CLUSTER_COMP_NAME}_MYSQL_0_SERVICE_HOST" | tr '-' '_' | tr '[:lower:]' '[:upper:]')
first_mysql_service_host=${!first_mysql_service_host_name}

register_to_orchestrator "$first_mysql_service_host"

echo "Initialization script completed!"
}
main

echo "completed"
register_first_mysql_instance

0 comments on commit b3294b3

Please sign in to comment.