mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 17:30:00 +00:00
Remove remnants of basic auth from cluster bootstrap.
This commit is contained in:
parent
f235adc4d2
commit
b87762966d
@ -721,23 +721,10 @@ function create-master-pki {
|
|||||||
# After the first boot and on upgrade, these files exist on the master-pd
|
# After the first boot and on upgrade, these files exist on the master-pd
|
||||||
# and should never be touched again (except perhaps an additional service
|
# and should never be touched again (except perhaps an additional service
|
||||||
# account, see NB below.) One exception is if METADATA_CLOBBERS_CONFIG is
|
# account, see NB below.) One exception is if METADATA_CLOBBERS_CONFIG is
|
||||||
# enabled. In that case the basic_auth.csv file will be rewritten to make
|
# enabled.
|
||||||
# sure it matches the metadata source of truth.
|
|
||||||
function create-master-auth {
|
function create-master-auth {
|
||||||
echo "Creating master auth files"
|
echo "Creating master auth files"
|
||||||
local -r auth_dir="/etc/srv/kubernetes"
|
local -r auth_dir="/etc/srv/kubernetes"
|
||||||
local -r basic_auth_csv="${auth_dir}/basic_auth.csv"
|
|
||||||
if [[ -n "${KUBE_PASSWORD:-}" && -n "${KUBE_USER:-}" ]]; then
|
|
||||||
if [[ -e "${basic_auth_csv}" && "${METADATA_CLOBBERS_CONFIG:-false}" == "true" ]]; then
|
|
||||||
# If METADATA_CLOBBERS_CONFIG is true, we want to rewrite the file
|
|
||||||
# completely, because if we're changing KUBE_USER and KUBE_PASSWORD, we
|
|
||||||
# have nothing to match on. The file is replaced just below with
|
|
||||||
# append_or_replace_prefixed_line.
|
|
||||||
rm "${basic_auth_csv}"
|
|
||||||
fi
|
|
||||||
append_or_replace_prefixed_line "${basic_auth_csv}" "${KUBE_PASSWORD},${KUBE_USER}," "admin,system:masters"
|
|
||||||
fi
|
|
||||||
|
|
||||||
local -r known_tokens_csv="${auth_dir}/known_tokens.csv"
|
local -r known_tokens_csv="${auth_dir}/known_tokens.csv"
|
||||||
if [[ -e "${known_tokens_csv}" && "${METADATA_CLOBBERS_CONFIG:-false}" == "true" ]]; then
|
if [[ -e "${known_tokens_csv}" && "${METADATA_CLOBBERS_CONFIG:-false}" == "true" ]]; then
|
||||||
rm "${known_tokens_csv}"
|
rm "${known_tokens_csv}"
|
||||||
|
Loading…
Reference in New Issue
Block a user