mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 04:33:26 +00:00
fix gce.conf multi-value parameter processing
This commit is contained in:
parent
db2977fb11
commit
af42fbd3d0
@ -215,14 +215,19 @@ EOF
|
|||||||
if [[ -n "${NODE_INSTANCE_PREFIX:-}" ]]; then
|
if [[ -n "${NODE_INSTANCE_PREFIX:-}" ]]; then
|
||||||
use_cloud_config="true"
|
use_cloud_config="true"
|
||||||
if [[ -n "${NODE_TAGS:-}" ]]; then
|
if [[ -n "${NODE_TAGS:-}" ]]; then
|
||||||
local -r node_tags="${NODE_TAGS}"
|
# split NODE_TAGS into an array by comma.
|
||||||
|
IFS=',' read -r -a node_tags <<< ${NODE_TAGS}
|
||||||
else
|
else
|
||||||
local -r node_tags="${NODE_INSTANCE_PREFIX}"
|
local -r node_tags="${NODE_INSTANCE_PREFIX}"
|
||||||
fi
|
fi
|
||||||
cat <<EOF >>/etc/gce.conf
|
cat <<EOF >>/etc/gce.conf
|
||||||
node-tags = ${node_tags}
|
|
||||||
node-instance-prefix = ${NODE_INSTANCE_PREFIX}
|
node-instance-prefix = ${NODE_INSTANCE_PREFIX}
|
||||||
EOF
|
EOF
|
||||||
|
for tag in ${node_tags[@]}; do
|
||||||
|
cat <<EOF >>/etc/gce.conf
|
||||||
|
node-tags = ${tag}
|
||||||
|
EOF
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
if [[ -n "${MULTIZONE:-}" ]]; then
|
if [[ -n "${MULTIZONE:-}" ]]; then
|
||||||
use_cloud_config="true"
|
use_cloud_config="true"
|
||||||
@ -232,9 +237,13 @@ EOF
|
|||||||
fi
|
fi
|
||||||
if [[ -n "${GCE_ALPHA_FEATURES:-}" ]]; then
|
if [[ -n "${GCE_ALPHA_FEATURES:-}" ]]; then
|
||||||
use_cloud_config="true"
|
use_cloud_config="true"
|
||||||
cat <<EOF >>/etc/gce.conf
|
# split GCE_ALPHA_FEATURES into an array by comma.
|
||||||
alpha-features = ${GCE_ALPHA_FEATURES}
|
IFS=',' read -r -a alpha_features <<< ${GCE_ALPHA_FEATURES}
|
||||||
|
for feature in ${alpha_features[@]}; do
|
||||||
|
cat <<EOF >>/etc/gce.conf
|
||||||
|
alpha-features = ${feature}
|
||||||
EOF
|
EOF
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
if [[ -n "${SECONDARY_RANGE_NAME:-}" ]]; then
|
if [[ -n "${SECONDARY_RANGE_NAME:-}" ]]; then
|
||||||
use_cloud_config="true"
|
use_cloud_config="true"
|
||||||
|
@ -585,14 +585,19 @@ EOF
|
|||||||
if [[ -n "${NODE_INSTANCE_PREFIX:-}" ]]; then
|
if [[ -n "${NODE_INSTANCE_PREFIX:-}" ]]; then
|
||||||
use_cloud_config="true"
|
use_cloud_config="true"
|
||||||
if [[ -n "${NODE_TAGS:-}" ]]; then
|
if [[ -n "${NODE_TAGS:-}" ]]; then
|
||||||
local -r node_tags="${NODE_TAGS}"
|
# split NODE_TAGS into an array by comma.
|
||||||
|
IFS=',' read -r -a node_tags <<< ${NODE_TAGS}
|
||||||
else
|
else
|
||||||
local -r node_tags="${NODE_INSTANCE_PREFIX}"
|
local -r node_tags="${NODE_INSTANCE_PREFIX}"
|
||||||
fi
|
fi
|
||||||
cat <<EOF >>/etc/gce.conf
|
cat <<EOF >>/etc/gce.conf
|
||||||
node-tags = ${node_tags}
|
|
||||||
node-instance-prefix = ${NODE_INSTANCE_PREFIX}
|
node-instance-prefix = ${NODE_INSTANCE_PREFIX}
|
||||||
EOF
|
EOF
|
||||||
|
for tag in ${node_tags[@]}; do
|
||||||
|
cat <<EOF >>/etc/gce.conf
|
||||||
|
node-tags = ${tag}
|
||||||
|
EOF
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
if [[ -n "${MULTIZONE:-}" ]]; then
|
if [[ -n "${MULTIZONE:-}" ]]; then
|
||||||
use_cloud_config="true"
|
use_cloud_config="true"
|
||||||
@ -602,9 +607,13 @@ EOF
|
|||||||
fi
|
fi
|
||||||
if [[ -n "${GCE_ALPHA_FEATURES:-}" ]]; then
|
if [[ -n "${GCE_ALPHA_FEATURES:-}" ]]; then
|
||||||
use_cloud_config="true"
|
use_cloud_config="true"
|
||||||
cat <<EOF >>/etc/gce.conf
|
# split GCE_ALPHA_FEATURES into an array by comma.
|
||||||
alpha-features = ${GCE_ALPHA_FEATURES}
|
IFS=',' read -r -a alpha_features <<< ${GCE_ALPHA_FEATURES}
|
||||||
|
for feature in ${alpha_features[@]}; do
|
||||||
|
cat <<EOF >>/etc/gce.conf
|
||||||
|
alpha-features = ${feature}
|
||||||
EOF
|
EOF
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
if [[ -n "${SECONDARY_RANGE_NAME:-}" ]]; then
|
if [[ -n "${SECONDARY_RANGE_NAME:-}" ]]; then
|
||||||
use_cloud_config="true"
|
use_cloud_config="true"
|
||||||
|
@ -149,6 +149,7 @@ type GCECloud struct {
|
|||||||
AlphaFeatureGate *AlphaFeatureGate
|
AlphaFeatureGate *AlphaFeatureGate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: replace gcfg with json
|
||||||
type ConfigGlobal struct {
|
type ConfigGlobal struct {
|
||||||
TokenURL string `gcfg:"token-url"`
|
TokenURL string `gcfg:"token-url"`
|
||||||
TokenBody string `gcfg:"token-body"`
|
TokenBody string `gcfg:"token-body"`
|
||||||
@ -173,7 +174,7 @@ type ConfigGlobal struct {
|
|||||||
// located in (i.e. where the controller will be running). If this is
|
// located in (i.e. where the controller will be running). If this is
|
||||||
// blank, then the local zone will be discovered via the metadata server.
|
// blank, then the local zone will be discovered via the metadata server.
|
||||||
LocalZone string `gcfg:"local-zone"`
|
LocalZone string `gcfg:"local-zone"`
|
||||||
// Possible values: List of api names separated by comma. Default to none.
|
// Default to none.
|
||||||
// For example: MyFeatureFlag
|
// For example: MyFeatureFlag
|
||||||
AlphaFeatures []string `gcfg:"alpha-features"`
|
AlphaFeatures []string `gcfg:"alpha-features"`
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user