Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

K8SPS-377: do not use --skip-ssl for db init #723

Merged
merged 6 commits into from
Aug 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions build/ps-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
case "$f" in
*.sh)
echo "$0: running $f"
. "$f"

Check warning on line 61 in build/ps-entrypoint.sh

View workflow job for this annotation

GitHub Actions / shellcheck

[shellcheck] build/ps-entrypoint.sh#L61 <ShellCheck.SC1090>

ShellCheck can't follow non-constant source. Use a directive to specify location.
Raw output
./build/ps-entrypoint.sh:61:6: warning: ShellCheck can't follow non-constant source. Use a directive to specify location. (ShellCheck.SC1090)
;;
*.sql)
echo "$0: running $f"
Expand Down Expand Up @@ -197,7 +197,7 @@
exit 1
fi

if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then

Check warning on line 200 in build/ps-entrypoint.sh

View workflow job for this annotation

GitHub Actions / shellcheck

[shellcheck] build/ps-entrypoint.sh#L200 <ShellCheck.SC2166>

Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.
Raw output
./build/ps-entrypoint.sh:200:22: warning: Prefer [ p ] && [ q ] as [ p -a q ] is not well defined. (ShellCheck.SC2166)
# still need to check config, container may have started with --user
_check_config "$@"

Expand All @@ -213,7 +213,7 @@
touch /var/lib/mysql/bootstrap.lock
file_env 'MYSQL_ROOT_PASSWORD' '' 'root'
{ set +x; } 2>/dev/null
if [ -z "$MYSQL_ROOT_PASSWORD" -a -z "$MYSQL_ALLOW_EMPTY_PASSWORD" -a -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then

Check warning on line 216 in build/ps-entrypoint.sh

View workflow job for this annotation

GitHub Actions / shellcheck

[shellcheck] build/ps-entrypoint.sh#L216 <ShellCheck.SC2166>

Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.
Raw output
./build/ps-entrypoint.sh:216:34: warning: Prefer [ p ] && [ q ] as [ p -a q ] is not well defined. (ShellCheck.SC2166)

Check warning on line 216 in build/ps-entrypoint.sh

View workflow job for this annotation

GitHub Actions / shellcheck

[shellcheck] build/ps-entrypoint.sh#L216 <ShellCheck.SC2166>

Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.
Raw output
./build/ps-entrypoint.sh:216:70: warning: Prefer [ p ] && [ q ] as [ p -a q ] is not well defined. (ShellCheck.SC2166)
echo >&2 'error: database is uninitialized and password option is not specified '
echo >&2 ' You need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD'
exit 1
Expand All @@ -226,7 +226,7 @@
echo 'Initializing database'
# we initialize database into $TMPDIR because "--initialize-insecure" option does not work if directory is not empty
# in some cases storage driver creates unremovable artifacts (see K8SPXC-286), so $DATADIR cleanup is not possible
"$@" --initialize-insecure --skip-ssl --datadir="$TMPDIR"
"$@" --initialize-insecure --datadir="$TMPDIR"
egegunes marked this conversation as resolved.
Show resolved Hide resolved
mv "$TMPDIR"/* "$DATADIR/"
rm -rfv "$TMPDIR"
echo 'Database initialized'
Expand Down Expand Up @@ -271,7 +271,7 @@
rootCreate=
# default root to listen for connections from anywhere
file_env 'MYSQL_ROOT_HOST' '%'
if [ -n "$MYSQL_ROOT_HOST" -a "$MYSQL_ROOT_HOST" != 'localhost' ]; then

Check warning on line 274 in build/ps-entrypoint.sh

View workflow job for this annotation

GitHub Actions / shellcheck

[shellcheck] build/ps-entrypoint.sh#L274 <ShellCheck.SC2166>

Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.
Raw output
./build/ps-entrypoint.sh:274:30: warning: Prefer [ p ] && [ q ] as [ p -a q ] is not well defined. (ShellCheck.SC2166)
# no, we don't care if read finds a terminating character in this heredoc
# https://unix.stackexchange.com/questions/265149/why-is-set-o-errexit-breaking-this-read-heredoc-expression/265151#265151
read -r -d '' rootCreate <<-EOSQL || true
Expand Down Expand Up @@ -359,7 +359,7 @@
file_env 'MYSQL_USER'
file_env 'MYSQL_PASSWORD'
{ set +x; } 2>/dev/null
if [ "$MYSQL_USER" -a "$MYSQL_PASSWORD" ]; then

Check warning on line 362 in build/ps-entrypoint.sh

View workflow job for this annotation

GitHub Actions / shellcheck

[shellcheck] build/ps-entrypoint.sh#L362 <ShellCheck.SC2166>

Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.
Raw output
./build/ps-entrypoint.sh:362:22: warning: Prefer [ p ] && [ q ] as [ p -a q ] is not well defined. (ShellCheck.SC2166)
echo "CREATE USER '$MYSQL_USER'@'%' IDENTIFIED BY '$MYSQL_PASSWORD' ;" | "${mysql[@]}"

if [ "$MYSQL_DATABASE" ]; then
Expand Down Expand Up @@ -407,7 +407,7 @@
if [[ -f /var/lib/mysql/full-cluster-crash ]]; then
set +o xtrace
node_name=$(hostname -f)
cluster_name=$(hostname | cut -d '-' -f1) # TODO: This won't work if CR has `-` in its name.

Check warning on line 410 in build/ps-entrypoint.sh

View workflow job for this annotation

GitHub Actions / shellcheck

[shellcheck] build/ps-entrypoint.sh#L410 <ShellCheck.SC2034>

cluster_name appears unused. Verify use (or export if used externally).
Raw output
./build/ps-entrypoint.sh:410:2: warning: cluster_name appears unused. Verify use (or export if used externally). (ShellCheck.SC2034)
gtid_executed=$(</var/lib/mysql/full-cluster-crash)
namespace=$(</var/run/secrets/kubernetes.io/serviceaccount/namespace)

Expand All @@ -427,14 +427,14 @@

recovery_file='/var/lib/mysql/sleep-forever'
if [ -f "${recovery_file}" ]; then
set +o xtrace
echo "The $recovery_file file is detected, node is going to infinity loop"
echo "If you want to exit from infinity loop you need to remove $recovery_file file"
for (( ; ; )); do
if [ ! -f "${recovery_file}" ]; then
exit 0
fi
done
set +o xtrace
echo "The $recovery_file file is detected, node is going to infinity loop"
echo "If you want to exit from infinity loop you need to remove $recovery_file file"
for (( ; ; )); do
if [ ! -f "${recovery_file}" ]; then
exit 0
fi
done
fi

exec "$@"
Loading