Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 4 additions & 0 deletions build/proxysql-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
}

cp /opt/percona/proxysql.cnf /etc/proxysql
if [[ -f /etc/proxysql/custom/proxysql.cnf ]]; then
cp /etc/proxysql/custom/proxysql.cnf /etc/proxysql/proxysql.cnf
fi

cp /opt/percona/proxysql-admin.cnf /etc

MYSQL_INTERFACES='0.0.0.0:3306;0.0.0.0:33062'
Expand All @@ -25,7 +29,7 @@
# Percona scheduler
PERCONA_SCHEDULER_CFG_TMPL=/opt/percona/proxysql_scheduler_config.tmpl
if [[ -f ${PERCONA_SCHEDULER_CFG_TMPL} && -n ${PERCONA_SCHEDULER_CFG} ]]; then
cp ${PERCONA_SCHEDULER_CFG_TMPL} ${PERCONA_SCHEDULER_CFG}

Check notice on line 32 in build/proxysql-entrypoint.sh

View workflow job for this annotation

GitHub Actions / shellcheck

[shellcheck] build/proxysql-entrypoint.sh#L32 <ShellCheck.SC2086>

Double quote to prevent globbing and word splitting.
Raw output
./build/proxysql-entrypoint.sh:32:35: info: Double quote to prevent globbing and word splitting. (ShellCheck.SC2086)
fi

# internal scheduler
Expand All @@ -35,9 +39,9 @@
sed_in_place "s/threads=2/threads=${MYSQL_THREADS:-2}/g" ${PROXY_CFG}

set +o xtrace # hide sensitive information
OPERATOR_PASSWORD_ESCAPED=$(sed 's/[][\-\!\#\$\%\&\(\)\*\+\,\.\:\;\<\=\>\?\@\^\_\~\{\}]/\\&/g' <<<"${OPERATOR_PASSWORD}")

Check notice on line 42 in build/proxysql-entrypoint.sh

View workflow job for this annotation

GitHub Actions / shellcheck

[shellcheck] build/proxysql-entrypoint.sh#L42 <ShellCheck.SC2001>

See if you can use ${variable//search/replace} instead.
Raw output
./build/proxysql-entrypoint.sh:42:29: info: See if you can use ${variable//search/replace} instead. (ShellCheck.SC2001)
MONITOR_PASSWORD_ESCAPED=$(sed 's/[][\-\!\#\$\%\&\(\)\*\+\,\.\:\;\<\=\>\?\@\^\_\~\{\}]/\\&/g' <<<"${MONITOR_PASSWORD}")

Check notice on line 43 in build/proxysql-entrypoint.sh

View workflow job for this annotation

GitHub Actions / shellcheck

[shellcheck] build/proxysql-entrypoint.sh#L43 <ShellCheck.SC2001>

See if you can use ${variable//search/replace} instead.
Raw output
./build/proxysql-entrypoint.sh:43:28: info: See if you can use ${variable//search/replace} instead. (ShellCheck.SC2001)
PROXY_ADMIN_PASSWORD_ESCAPED=$(sed 's/[][\-\!\#\$\%\&\(\)\*\+\,\.\:\;\<\=\>\?\@\^\_\~\{\}]/\\&/g' <<<"${PROXY_ADMIN_PASSWORD}")

Check notice on line 44 in build/proxysql-entrypoint.sh

View workflow job for this annotation

GitHub Actions / shellcheck

[shellcheck] build/proxysql-entrypoint.sh#L44 <ShellCheck.SC2001>

See if you can use ${variable//search/replace} instead.
Raw output
./build/proxysql-entrypoint.sh:44:32: info: See if you can use ${variable//search/replace} instead. (ShellCheck.SC2001)

sed_in_place "s/\"admin:admin\"/\"${PROXY_ADMIN_USER:-admin}:${PROXY_ADMIN_PASSWORD_ESCAPED:-admin}\"/g" ${PROXY_CFG}
sed_in_place "s/cluster_username=\"admin\"/cluster_username=\"${PROXY_ADMIN_USER:-admin}\"/g" ${PROXY_CFG}
Expand All @@ -55,21 +59,21 @@
# Percona scheduler
if [[ -f ${PERCONA_SCHEDULER_CFG} ]]; then
set +o xtrace # hide sensitive information
sed_in_place "s/SCHEDULER_PROXYSQLPASSWORD/'${PROXY_ADMIN_PASSWORD_ESCAPED:-admin}'/" ${PERCONA_SCHEDULER_CFG}

Check notice on line 62 in build/proxysql-entrypoint.sh

View workflow job for this annotation

GitHub Actions / shellcheck

[shellcheck] build/proxysql-entrypoint.sh#L62 <ShellCheck.SC2086>

Double quote to prevent globbing and word splitting.
Raw output
./build/proxysql-entrypoint.sh:62:88: info: Double quote to prevent globbing and word splitting. (ShellCheck.SC2086)
sed_in_place "s/SCHEDULER_CLUSTERPASSWORD/'${OPERATOR_PASSWORD_ESCAPED:-operator}'/" ${PERCONA_SCHEDULER_CFG}

Check notice on line 63 in build/proxysql-entrypoint.sh

View workflow job for this annotation

GitHub Actions / shellcheck

[shellcheck] build/proxysql-entrypoint.sh#L63 <ShellCheck.SC2086>

Double quote to prevent globbing and word splitting.
Raw output
./build/proxysql-entrypoint.sh:63:87: info: Double quote to prevent globbing and word splitting. (ShellCheck.SC2086)
sed_in_place "s/SCHEDULER_MONITORPASSWORD/'${MONITOR_PASSWORD_ESCAPED:-monitor}'/" ${PERCONA_SCHEDULER_CFG}

Check notice on line 64 in build/proxysql-entrypoint.sh

View workflow job for this annotation

GitHub Actions / shellcheck

[shellcheck] build/proxysql-entrypoint.sh#L64 <ShellCheck.SC2086>

Double quote to prevent globbing and word splitting.
Raw output
./build/proxysql-entrypoint.sh:64:85: info: Double quote to prevent globbing and word splitting. (ShellCheck.SC2086)
set -o xtrace # hide sensitive information

sed_in_place "s/SCHEDULER_PROXYSQLHOST/'$(hostname -f)'/" ${PERCONA_SCHEDULER_CFG}

Check notice on line 67 in build/proxysql-entrypoint.sh

View workflow job for this annotation

GitHub Actions / shellcheck

[shellcheck] build/proxysql-entrypoint.sh#L67 <ShellCheck.SC2086>

Double quote to prevent globbing and word splitting.
Raw output
./build/proxysql-entrypoint.sh:67:60: info: Double quote to prevent globbing and word splitting. (ShellCheck.SC2086)
sed_in_place "s/SCHEDULER_CLUSTERHOST/'${PXC_SERVICE}.$(hostname -f | cut -d '.' -f3-)'/" ${PERCONA_SCHEDULER_CFG}

Check notice on line 68 in build/proxysql-entrypoint.sh

View workflow job for this annotation

GitHub Actions / shellcheck

[shellcheck] build/proxysql-entrypoint.sh#L68 <ShellCheck.SC2086>

Double quote to prevent globbing and word splitting.
Raw output
./build/proxysql-entrypoint.sh:68:92: info: Double quote to prevent globbing and word splitting. (ShellCheck.SC2086)
sed_in_place "s/SCHEDULER_CLUSTERPORT/'${CLUSTER_PORT:-3306}'/" ${PERCONA_SCHEDULER_CFG}

Check notice on line 69 in build/proxysql-entrypoint.sh

View workflow job for this annotation

GitHub Actions / shellcheck

[shellcheck] build/proxysql-entrypoint.sh#L69 <ShellCheck.SC2086>

Double quote to prevent globbing and word splitting.
Raw output
./build/proxysql-entrypoint.sh:69:66: info: Double quote to prevent globbing and word splitting. (ShellCheck.SC2086)
sed_in_place "s/SCHEDULER_MAXCONNECTIONS/${SCHEDULER_MAXCONNECTIONS}/g" ${PERCONA_SCHEDULER_CFG}

Check notice on line 70 in build/proxysql-entrypoint.sh

View workflow job for this annotation

GitHub Actions / shellcheck

[shellcheck] build/proxysql-entrypoint.sh#L70 <ShellCheck.SC2086>

Double quote to prevent globbing and word splitting.
Raw output
./build/proxysql-entrypoint.sh:70:74: info: Double quote to prevent globbing and word splitting. (ShellCheck.SC2086)
sed_in_place "s/SCHEDULER_NODECHECKINTERVAL/${SCHEDULER_NODECHECKINTERVAL}/g" ${PERCONA_SCHEDULER_CFG}

Check notice on line 71 in build/proxysql-entrypoint.sh

View workflow job for this annotation

GitHub Actions / shellcheck

[shellcheck] build/proxysql-entrypoint.sh#L71 <ShellCheck.SC2086>

Double quote to prevent globbing and word splitting.
Raw output
./build/proxysql-entrypoint.sh:71:80: info: Double quote to prevent globbing and word splitting. (ShellCheck.SC2086)
sed_in_place "s/SCHEDULER_CHECKTIMEOUT/${SCHEDULER_CHECKTIMEOUT}/g" ${PERCONA_SCHEDULER_CFG}

Check notice on line 72 in build/proxysql-entrypoint.sh

View workflow job for this annotation

GitHub Actions / shellcheck

[shellcheck] build/proxysql-entrypoint.sh#L72 <ShellCheck.SC2086>

Double quote to prevent globbing and word splitting.
Raw output
./build/proxysql-entrypoint.sh:72:70: info: Double quote to prevent globbing and word splitting. (ShellCheck.SC2086)
sed_in_place "s/SCHEDULER_PINGTIMEOUT/${SCHEDULER_PINGTIMEOUT}/g" ${PERCONA_SCHEDULER_CFG}

Check notice on line 73 in build/proxysql-entrypoint.sh

View workflow job for this annotation

GitHub Actions / shellcheck

[shellcheck] build/proxysql-entrypoint.sh#L73 <ShellCheck.SC2086>

Double quote to prevent globbing and word splitting.
Raw output
./build/proxysql-entrypoint.sh:73:68: info: Double quote to prevent globbing and word splitting. (ShellCheck.SC2086)
sed_in_place "s/SCHEDULER_RETRYDOWN/${SCHEDULER_RETRYDOWN}/g" ${PERCONA_SCHEDULER_CFG}

Check notice on line 74 in build/proxysql-entrypoint.sh

View workflow job for this annotation

GitHub Actions / shellcheck

[shellcheck] build/proxysql-entrypoint.sh#L74 <ShellCheck.SC2086>

Double quote to prevent globbing and word splitting.
Raw output
./build/proxysql-entrypoint.sh:74:64: info: Double quote to prevent globbing and word splitting. (ShellCheck.SC2086)
sed_in_place "s/SCHEDULER_RETRYUP/${SCHEDULER_RETRYUP}/g" ${PERCONA_SCHEDULER_CFG}

Check notice on line 75 in build/proxysql-entrypoint.sh

View workflow job for this annotation

GitHub Actions / shellcheck

[shellcheck] build/proxysql-entrypoint.sh#L75 <ShellCheck.SC2086>

Double quote to prevent globbing and word splitting.
Raw output
./build/proxysql-entrypoint.sh:75:60: info: Double quote to prevent globbing and word splitting. (ShellCheck.SC2086)
sed_in_place "s/SCHEDULER_WRITERALSOREADER/${SCHEDULER_WRITERALSOREADER}/g" ${PERCONA_SCHEDULER_CFG}

Check notice on line 76 in build/proxysql-entrypoint.sh

View workflow job for this annotation

GitHub Actions / shellcheck

[shellcheck] build/proxysql-entrypoint.sh#L76 <ShellCheck.SC2086>

Double quote to prevent globbing and word splitting.
Raw output
./build/proxysql-entrypoint.sh:76:78: info: Double quote to prevent globbing and word splitting. (ShellCheck.SC2086)
fi

## SSL/TLS support
Expand All @@ -81,14 +85,14 @@
if [ -f "${SSL_DIR}/ca.crt" ]; then
CA=${SSL_DIR}/ca.crt
if [[ -f ${PERCONA_SCHEDULER_CFG} ]]; then
sed_in_place "s:^sslCertificatePath.*= .*\"$:sslCertificatePath = \"${SSL_DIR}\":" ${PERCONA_SCHEDULER_CFG}

Check notice on line 88 in build/proxysql-entrypoint.sh

View workflow job for this annotation

GitHub Actions / shellcheck

[shellcheck] build/proxysql-entrypoint.sh#L88 <ShellCheck.SC2086>

Double quote to prevent globbing and word splitting.
Raw output
./build/proxysql-entrypoint.sh:88:86: info: Double quote to prevent globbing and word splitting. (ShellCheck.SC2086)
fi
fi
SSL_INTERNAL_DIR=${SSL_INTERNAL_DIR:-/etc/proxysql/ssl-internal}
if [ -f "${SSL_INTERNAL_DIR}/ca.crt" ]; then
CA=${SSL_INTERNAL_DIR}/ca.crt
if [[ -f ${PERCONA_SCHEDULER_CFG} ]]; then
sed_in_place "s:^sslCertificatePath.*= .*\"$:sslCertificatePath = \"${SSL_INTERNAL_DIR}\":" ${PERCONA_SCHEDULER_CFG}

Check notice on line 95 in build/proxysql-entrypoint.sh

View workflow job for this annotation

GitHub Actions / shellcheck

[shellcheck] build/proxysql-entrypoint.sh#L95 <ShellCheck.SC2086>

Double quote to prevent globbing and word splitting.
Raw output
./build/proxysql-entrypoint.sh:95:95: info: Double quote to prevent globbing and word splitting. (ShellCheck.SC2086)
fi
fi

Expand All @@ -108,9 +112,9 @@

# Percona scheduler
if [[ -f ${PERCONA_SCHEDULER_CFG} ]]; then
sed_in_place "s:^sslCa.*=.*\"$:sslCa = \"${CA##*/}\":" ${PERCONA_SCHEDULER_CFG}

Check notice on line 115 in build/proxysql-entrypoint.sh

View workflow job for this annotation

GitHub Actions / shellcheck

[shellcheck] build/proxysql-entrypoint.sh#L115 <ShellCheck.SC2086>

Double quote to prevent globbing and word splitting.
Raw output
./build/proxysql-entrypoint.sh:115:58: info: Double quote to prevent globbing and word splitting. (ShellCheck.SC2086)
sed_in_place "s:^sslKey.*=.*\"$:sslKey = \"${KEY##*/}\":" ${PERCONA_SCHEDULER_CFG}

Check notice on line 116 in build/proxysql-entrypoint.sh

View workflow job for this annotation

GitHub Actions / shellcheck

[shellcheck] build/proxysql-entrypoint.sh#L116 <ShellCheck.SC2086>

Double quote to prevent globbing and word splitting.
Raw output
./build/proxysql-entrypoint.sh:116:61: info: Double quote to prevent globbing and word splitting. (ShellCheck.SC2086)
sed_in_place "s:^sslClient.*=.*\"$:sslClient = \"${CERT##*/}\":" ${PERCONA_SCHEDULER_CFG}

Check notice on line 117 in build/proxysql-entrypoint.sh

View workflow job for this annotation

GitHub Actions / shellcheck

[shellcheck] build/proxysql-entrypoint.sh#L117 <ShellCheck.SC2086>

Double quote to prevent globbing and word splitting.
Raw output
./build/proxysql-entrypoint.sh:117:68: info: Double quote to prevent globbing and word splitting. (ShellCheck.SC2086)
fi
fi

Expand All @@ -122,7 +126,7 @@
cp "${SSL_DIR}/ca.crt" /var/lib/proxysql/proxysql-ca.pem
fi

test -e /opt/percona/hookscript/hook.sh && source /opt/percona/hookscript/hook.sh

Check notice on line 129 in build/proxysql-entrypoint.sh

View workflow job for this annotation

GitHub Actions / shellcheck

[shellcheck] build/proxysql-entrypoint.sh#L129 <ShellCheck.SC1091>

Not following: /opt/percona/hookscript/hook.sh: openBinaryFile: does not exist (No such file or directory)
Raw output
./build/proxysql-entrypoint.sh:129:51: info: Not following: /opt/percona/hookscript/hook.sh: openBinaryFile: does not exist (No such file or directory) (ShellCheck.SC1091)

# Start zombie reaper to clean up processes spawned by commands
# This is needed because percona-scheduler-admin may not properly reap all child processes
Expand Down Expand Up @@ -150,7 +154,7 @@
MAIN_PID=$!

# Forward signals to main process
forward_signal() {

Check notice on line 157 in build/proxysql-entrypoint.sh

View workflow job for this annotation

GitHub Actions / shellcheck

[shellcheck] build/proxysql-entrypoint.sh#L157 <ShellCheck.SC2329>

This function is never invoked. Check usage (or ignored if invoked indirectly).
Raw output
./build/proxysql-entrypoint.sh:157:1: info: This function is never invoked. Check usage (or ignored if invoked indirectly). (ShellCheck.SC2329)
kill -"$1" "$MAIN_PID" 2>/dev/null || true
}
trap 'forward_signal TERM' TERM
Expand Down
17 changes: 10 additions & 7 deletions deploy/cr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -404,12 +404,14 @@ spec:
#
# admin_variables =
# {
# admin_credentials="proxyadmin:admin_password"
# admin_credentials="admin:admin"
# mysql_ifaces="0.0.0.0:6032"
# refresh_interval=2000
# restapi_enabled=true
# restapi_port=6070
#
# cluster_username="proxyadmin"
# cluster_password="admin_password"
# cluster_username="admin"
# cluster_password="admin"
# checksum_admin_variables=false
# checksum_ldap_variables=false
# checksum_mysql_variables=false
Expand Down Expand Up @@ -444,11 +446,12 @@ spec:
# ping_timeout_server=200
# commands_stats=true
# sessions_sort=true
# have_ssl=true
# ssl_p2s_ca="/etc/proxysql/ssl-internal/ca.crt"
# ssl_p2s_cert="/etc/proxysql/ssl-internal/tls.crt"
# ssl_p2s_key="/etc/proxysql/ssl-internal/tls.key"
# have_ssl=false
# ssl_p2s_ca=""
# ssl_p2s_cert=""
# ssl_p2s_key=""
# ssl_p2s_cipher="ECDHE-RSA-AES128-GCM-SHA256"
# default_authentication_plugin="caching_sha2_password"
# }
# scheduler:
# enabled: false
Expand Down
2 changes: 1 addition & 1 deletion pkg/pxc/app/statefulset/proxysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func (c *Proxy) AppContainer(ctx context.Context, _ client.Client, spec *api.Pod
if api.ContainsVolume(availableVolumes, proxyConfigVolumeName) {
appc.VolumeMounts = append(appc.VolumeMounts, corev1.VolumeMount{
Name: proxyConfigVolumeName,
MountPath: "/etc/proxysql/",
MountPath: "/etc/proxysql/custom",
Copy link
Contributor

Choose a reason for hiding this comment

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

changing this without version check will cause a restart, no?

Copy link
Member Author

Choose a reason for hiding this comment

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

Right, yeah.. Updated

})
}

Expand Down
Loading