Skip to content

Commit 01a5ec3

Browse files
authored
Merge pull request kubernetes#78315 from dekkagaijin/mip
specify additional static auth for components by env var
2 parents 914f80d + 5a9af2e commit 01a5ec3

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

cluster/gce/gci/configure-helper.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,15 @@ function create-master-auth {
611611
if [[ -n "${ADDON_MANAGER_TOKEN:-}" ]]; then
612612
append_or_replace_prefixed_line "${known_tokens_csv}" "${ADDON_MANAGER_TOKEN}," "system:addon-manager,uid:system:addon-manager,system:masters"
613613
fi
614+
if [[ -n "${EXTRA_STATIC_AUTH_COMPONENTS:-}" ]]; then
615+
# Create a static Bearer token and kubeconfig for extra, comma-separated components.
616+
IFS="," read -r -a extra_components <<< "${EXTRA_STATIC_AUTH_COMPONENTS:-}"
617+
for extra_component in "${extra_components[@]}"; do
618+
local token="$(secure_random 32)"
619+
append_or_replace_prefixed_line "${known_tokens_csv}" "${token}," "system:${extra_component},uid:system:${extra_component}"
620+
create-kubeconfig "${extra_component}" "${token}"
621+
done
622+
fi
614623
local use_cloud_config="false"
615624
cat <<EOF >/etc/gce.conf
616625
[global]

0 commit comments

Comments
 (0)