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-358 add MySQL 8.3 and MySQL 8.4 support #676

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion 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 @@ -192,12 +192,12 @@

MYSQL_VERSION=$(mysqld -V | awk '{print $3}' | awk -F'.' '{print $1"."$2}')

if [ "$MYSQL_VERSION" != '8.0' ]; then
if ! [[ "$MYSQL_VERSION" =~ ^(8\.0|8\.4)$ ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[shfmt] reported by reviewdog 🐶

Suggested change
if ! [[ "$MYSQL_VERSION" =~ ^(8\.0|8\.4)$ ]]; then
if ! [[ $MYSQL_VERSION =~ ^(8\.0|8\.4)$ ]]; then

echo "Percona Distribution for MySQL Operator does not support $MYSQL_VERSION"
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 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 @@ -353,7 +353,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 356 in build/ps-entrypoint.sh

View workflow job for this annotation

GitHub Actions / shellcheck

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

Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.
Raw output
./build/ps-entrypoint.sh:356: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 @@ -401,7 +401,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 404 in build/ps-entrypoint.sh

View workflow job for this annotation

GitHub Actions / shellcheck

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

cluster_name appears unused. Verify use (or export if used externally).
Raw output
./build/ps-entrypoint.sh:404: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 Down
2 changes: 1 addition & 1 deletion e2e-tests/conf/client.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
spec:
containers:
- name: mysql-client
image: percona/percona-server:8.0.33
image: percona/percona-server:8.4
command:
- sleep
- infinity
6 changes: 3 additions & 3 deletions e2e-tests/vars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
export DEPLOY_DIR="${DEPLOY_DIR:-${ROOT_REPO}/deploy}"
export TESTS_DIR="${TESTS_DIR:-${ROOT_REPO}/e2e-tests}"
export TESTS_CONFIG_DIR="${TESTS_CONFIG_DIR:-${TESTS_DIR}/conf}"
export TEMP_DIR="/tmp/kuttl/ps/${test_name}"

Check warning on line 8 in e2e-tests/vars.sh

View workflow job for this annotation

GitHub Actions / shellcheck

[shellcheck] e2e-tests/vars.sh#L8 <ShellCheck.SC2154>

test_name is referenced but not assigned.
Raw output
./e2e-tests/vars.sh:8:32: warning: test_name is referenced but not assigned. (ShellCheck.SC2154)

export GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
export VERSION=${VERSION:-$(echo "${GIT_BRANCH}" | sed -e 's^/^-^g; s^[.]^-^g;' | tr '[:upper:]' '[:lower:]')}

export IMAGE=${IMAGE:-"perconalab/percona-server-mysql-operator:${VERSION}"}
export IMAGE_MYSQL=${IMAGE_MYSQL:-"perconalab/percona-server-mysql-operator:main-psmysql"}
export IMAGE_BACKUP=${IMAGE_BACKUP:-"perconalab/percona-server-mysql-operator:main-backup"}
export IMAGE_MYSQL=${IMAGE_MYSQL:-"percona/percona-server:8.4"}
export IMAGE_BACKUP=${IMAGE_BACKUP:-"percona/percona-xtrabackup:8.4"}
export IMAGE_ORCHESTRATOR=${IMAGE_ORCHESTRATOR:-"perconalab/percona-server-mysql-operator:main-orchestrator"}
export IMAGE_ROUTER=${IMAGE_ROUTER:-"perconalab/percona-server-mysql-operator:main-router"}
export IMAGE_ROUTER=${IMAGE_ROUTER:-"percona/percona-mysql-router:8.4"}
export IMAGE_TOOLKIT=${IMAGE_TOOLKIT:-"perconalab/percona-server-mysql-operator:main-toolkit"}
export IMAGE_HAPROXY=${IMAGE_HAPROXY:-"perconalab/percona-server-mysql-operator:main-haproxy"}
export PMM_SERVER_VERSION=${PMM_SERVER_VERSION:-"9.9.9"}
Expand All @@ -22,7 +22,7 @@
export IMAGE_PMM_SERVER=${IMAGE_PMM_SERVER:-"perconalab/pmm-server:dev-latest"}
export CERT_MANAGER_VER="1.15.1"

date=$(which gdate || which date)

Check warning on line 25 in e2e-tests/vars.sh

View workflow job for this annotation

GitHub Actions / shellcheck

[shellcheck] e2e-tests/vars.sh#L25 <ShellCheck.SC2034>

date appears unused. Verify use (or export if used externally).
Raw output
./e2e-tests/vars.sh:25:1: warning: date appears unused. Verify use (or export if used externally). (ShellCheck.SC2034)

if command -v oc &> /dev/null; then
if oc get projects; then
Expand Down
Loading