-
Notifications
You must be signed in to change notification settings - Fork 30
K8SPS-265 add special characters #951
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
base: main
Are you sure you want to change the base?
Changes from 10 commits
81a3dca
c3366a9
3b0ded3
eb31c2d
44b9a90
55033b8
293e890
b380d88
242a4f7
0976cfe
fdbb8b1
a1199db
714180e
4f07f91
ff54297
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -43,8 +43,15 @@ fi | |||||||||||||
|
||||||||||||||
set +o xtrace | ||||||||||||||
temp=$(mktemp) | ||||||||||||||
sed -r "s|^[#]?user=.*$|user=${TOPOLOGY_USER}|" "${ORC_CONF_PATH}/orc-topology.cnf" >"${temp}" | ||||||||||||||
sed -r "s|^[#]?password=.*$|password=${TOPOLOGY_PASSWORD:-$ORC_TOPOLOGY_PASSWORD}|" "${ORC_CONF_PATH}/orc-topology.cnf" >"${temp}" | ||||||||||||||
|
||||||||||||||
ESCAPED_PASSWORD=$(printf '%s' "${TOPOLOGY_PASSWORD:-$ORC_TOPOLOGY_PASSWORD}" | sed -e 's/[&"\\]/\\&/g') | ||||||||||||||
ESCAPED_PASSWORD="\"${ESCAPED_PASSWORD}\"" # Wrap in double quotes for .cnf | ||||||||||||||
|
||||||||||||||
sed -r \ | ||||||||||||||
-e "s|^[#]?user=.*$|user=${TOPOLOGY_USER}|" \ | ||||||||||||||
-e "s|^[#]?password=.*$|password=${ESCAPED_PASSWORD}|" \ | ||||||||||||||
"${ORC_CONF_PATH}/orc-topology.cnf" > "${temp}" | ||||||||||||||
Comment on lines
+51
to
+53
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [shfmt] reported by reviewdog 🐶
Suggested change
|
||||||||||||||
|
||||||||||||||
cat "${temp}" >"${ORC_CONF_PATH}/config/orc-topology.cnf" | ||||||||||||||
rm "${temp}" | ||||||||||||||
set -o xtrace | ||||||||||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -6,18 +6,23 @@ ROUTER_DIR=${ROUTER_DIR:-/tmp/router} | |||||
OPERATOR_USER=${OPERATOR_USER:-operator} | ||||||
NAMESPACE=$(</var/run/secrets/kubernetes.io/serviceaccount/namespace) | ||||||
|
||||||
urlencode() { | ||||||
python3 -c 'import urllib.parse, sys; print(urllib.parse.quote(sys.argv[1]))' "$1" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [shfmt] reported by reviewdog 🐶
Suggested change
|
||||||
} | ||||||
|
||||||
if [ -f "/etc/mysql/mysql-users-secret/${OPERATOR_USER}" ]; then | ||||||
OPERATOR_PASS=$(<"/etc/mysql/mysql-users-secret/${OPERATOR_USER}") | ||||||
OPERATOR_PASS_ESCAPED=$(urlencode "$OPERATOR_PASS") | ||||||
fi | ||||||
|
||||||
mysqlrouter --force \ | ||||||
--bootstrap "${OPERATOR_USER}:${OPERATOR_PASS}@${MYSQL_SERVICE_NAME}-0.${MYSQL_SERVICE_NAME}.${NAMESPACE}.svc" \ | ||||||
--bootstrap "${OPERATOR_USER}:${OPERATOR_PASS_ESCAPED}@${MYSQL_SERVICE_NAME}-0.${MYSQL_SERVICE_NAME}.${NAMESPACE}.svc" \ | ||||||
--conf-bind-address 0.0.0.0 \ | ||||||
--conf-set-option http_auth_backend:default_auth_backend.backend=file \ | ||||||
--conf-set-option http_auth_backend:default_auth_backend.filename="${ROUTER_DIR}/realm.txt" \ | ||||||
--directory "${ROUTER_DIR}" | ||||||
|
||||||
echo ${OPERATOR_PASS} | mysqlrouter_passwd set "${ROUTER_DIR}/realm.txt" ${OPERATOR_USER} | ||||||
echo "${OPERATOR_PASS_ESCAPED}" | mysqlrouter_passwd set "${ROUTER_DIR}/realm.txt" "${OPERATOR_USER}" | ||||||
|
||||||
sed -i 's/logging_folder=.*/logging_folder=/g' "${ROUTER_DIR}/mysqlrouter.conf" | ||||||
sed -i "/\[logger\]/a destination=/dev/stdout" "${ROUTER_DIR}/mysqlrouter.conf" | ||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,15 +1,20 @@ | ||||||
#!/bin/bash | ||||||
|
||||||
urlencode() { | ||||||
python3 -c 'import urllib.parse, sys; print(urllib.parse.quote(sys.argv[1]))' "$1" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [shfmt] reported by reviewdog 🐶
Suggested change
|
||||||
} | ||||||
|
||||||
OPERATOR_PASS=$(</etc/mysql/mysql-users-secret/operator) | ||||||
OPERATOR_PASS_ESCAPED=$(urlencode "$OPERATOR_PASS") | ||||||
|
||||||
if ! curl -k -s -u operator:"${OPERATOR_PASS}" https://localhost:8443/api/20190715/routes/bootstrap_rw/health | grep true; then | ||||||
if ! curl -k -s -u operator:"${OPERATOR_PASS_ESCAPED}" https://localhost:8443/api/20190715/routes/bootstrap_rw/health | grep true; then | ||||||
echo "Read-write route is not healthy" | ||||||
exit 1 | ||||||
fi | ||||||
|
||||||
if ! curl -k -s -u operator:"${OPERATOR_PASS}" https://localhost:8443/api/20190715/routes/bootstrap_ro/health | grep true; then | ||||||
if ! curl -k -s -u operator:"${OPERATOR_PASS_ESCAPED}" https://localhost:8443/api/20190715/routes/bootstrap_ro/health | grep true; then | ||||||
echo "Read-only route is not healthy" | ||||||
exit 1 | ||||||
fi | ||||||
|
||||||
exit 0 | ||||||
exit 0 |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,7 +1,12 @@ | ||||||
#!/bin/bash | ||||||
|
||||||
urlencode() { | ||||||
python3 -c 'import urllib.parse, sys; print(urllib.parse.quote(sys.argv[1]))' "$1" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [shfmt] reported by reviewdog 🐶
Suggested change
|
||||||
} | ||||||
|
||||||
OPERATOR_PASS=$(</etc/mysql/mysql-users-secret/operator) | ||||||
OPERATOR_PASS_ESCAPED=$(urlencode "$OPERATOR_PASS") | ||||||
|
||||||
if [[ $(curl -k -s -u operator:"${OPERATOR_PASS}" -o /dev/null -w %{http_code} https://localhost:8443/api/20190715/router/status) != 200 ]]; then | ||||||
if [[ $(curl -k -s -u operator:"${OPERATOR_PASS_ESCAPED}" -o /dev/null -w %{http_code} https://localhost:8443/api/20190715/router/status) != 200 ]]; then | ||||||
Check warning on line 10 in build/router_startup_check.sh
|
||||||
echo "Router is not ready" | ||||||
fi | ||||||
fi |
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -1039,6 +1039,11 @@ deploy_cmctl() { | |||||||||
kubectl apply -n "${NAMESPACE}" -f "${TESTS_CONFIG_DIR}/cmctl.yml" | ||||||||||
} | ||||||||||
|
||||||||||
get_user_pass() { | ||||||||||
local user="${1:-root}" | ||||||||||
kubectl -n "${NAMESPACE}" get secret test-secrets -o jsonpath="{.data.${user}}" | base64 --decode | ||||||||||
Comment on lines
+1043
to
+1044
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [shfmt] reported by reviewdog 🐶
Suggested change
|
||||||||||
} | ||||||||||
|
||||||||||
get_operator_version() { | ||||||||||
kubectl get crd -n "$NAMESPACE" perconaservermysqls.ps.percona.com -o jsonpath='{.metadata.labels.app\.kubernetes\.io/version}' | ||||||||||
} | ||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,6 @@ commands: | |
apply_s3_storage_secrets | ||
deploy_operator | ||
deploy_non_tls_cluster_secrets | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So we are removing this cause the operator does not trigger the password generation if the key/value pair exists, right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because I want operator generate random passwords and we use it in our tests. (now we use passwords from predefined file and it's like |
||
deploy_tls_cluster_secrets | ||
deploy_client | ||
deploy_minio | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[shfmt] reported by reviewdog 🐶