mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Fix shellcheck lint errors in test/kubemark/resources/start-kubemark-master.sh
This commit is contained in:
parent
f72ac1f5b7
commit
adf4bf1741
@ -145,7 +145,6 @@
|
|||||||
./test/images/volume/rbd/create_block.sh
|
./test/images/volume/rbd/create_block.sh
|
||||||
./test/images/volume/rbd/mon.sh
|
./test/images/volume/rbd/mon.sh
|
||||||
./test/images/volume/rbd/osd.sh
|
./test/images/volume/rbd/osd.sh
|
||||||
./test/kubemark/resources/start-kubemark-master.sh
|
|
||||||
./test/kubemark/run-e2e-tests.sh
|
./test/kubemark/run-e2e-tests.sh
|
||||||
./test/kubemark/start-kubemark.sh
|
./test/kubemark/start-kubemark.sh
|
||||||
./test/kubemark/stop-kubemark.sh
|
./test/kubemark/stop-kubemark.sh
|
||||||
|
@ -107,7 +107,7 @@ function find-attached-pd() {
|
|||||||
if [[ ! -e /dev/disk/by-id/${pd_name} ]]; then
|
if [[ ! -e /dev/disk/by-id/${pd_name} ]]; then
|
||||||
echo ""
|
echo ""
|
||||||
fi
|
fi
|
||||||
device_info=$(ls -l /dev/disk/by-id/${pd_name})
|
device_info=$(ls -l "/dev/disk/by-id/${pd_name}")
|
||||||
relative_path=${device_info##* }
|
relative_path=${device_info##* }
|
||||||
echo "/dev/disk/by-id/${relative_path}"
|
echo "/dev/disk/by-id/${relative_path}"
|
||||||
}
|
}
|
||||||
@ -288,9 +288,9 @@ function start-kubelet {
|
|||||||
#
|
#
|
||||||
# $1 is the file to create.
|
# $1 is the file to create.
|
||||||
function prepare-log-file {
|
function prepare-log-file {
|
||||||
touch $1
|
touch "$1"
|
||||||
chmod 644 $1
|
chmod 644 "$1"
|
||||||
chown root:root $1
|
chown root:root "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
# A helper function for copying addon manifests and set dir/files
|
# A helper function for copying addon manifests and set dir/files
|
||||||
@ -301,10 +301,13 @@ function prepare-log-file {
|
|||||||
function setup-addon-manifests {
|
function setup-addon-manifests {
|
||||||
local -r src_dir="${KUBE_ROOT}/$2"
|
local -r src_dir="${KUBE_ROOT}/$2"
|
||||||
local -r dst_dir="/etc/kubernetes/$1/$2"
|
local -r dst_dir="/etc/kubernetes/$1/$2"
|
||||||
|
|
||||||
if [[ ! -d "${dst_dir}" ]]; then
|
if [[ ! -d "${dst_dir}" ]]; then
|
||||||
mkdir -p "${dst_dir}"
|
mkdir -p "${dst_dir}"
|
||||||
fi
|
fi
|
||||||
local files=$(find "${src_dir}" -maxdepth 1 -name "*.yaml")
|
|
||||||
|
local files
|
||||||
|
files=$(find "${src_dir}" -maxdepth 1 -name "*.yaml")
|
||||||
if [[ -n "${files}" ]]; then
|
if [[ -n "${files}" ]]; then
|
||||||
cp "${src_dir}/"*.yaml "${dst_dir}"
|
cp "${src_dir}/"*.yaml "${dst_dir}"
|
||||||
fi
|
fi
|
||||||
@ -508,7 +511,7 @@ function compute-kube-apiserver-params {
|
|||||||
params+=" --token-auth-file=/etc/srv/kubernetes/known_tokens.csv"
|
params+=" --token-auth-file=/etc/srv/kubernetes/known_tokens.csv"
|
||||||
params+=" --secure-port=443"
|
params+=" --secure-port=443"
|
||||||
params+=" --basic-auth-file=/etc/srv/kubernetes/basic_auth.csv"
|
params+=" --basic-auth-file=/etc/srv/kubernetes/basic_auth.csv"
|
||||||
params+=" --target-ram-mb=$((${NUM_NODES} * 60))"
|
params+=" --target-ram-mb=$((NUM_NODES * 60))"
|
||||||
params+=" --service-cluster-ip-range=${SERVICE_CLUSTER_IP_RANGE}"
|
params+=" --service-cluster-ip-range=${SERVICE_CLUSTER_IP_RANGE}"
|
||||||
params+=" --admission-control=${CUSTOM_ADMISSION_PLUGINS}"
|
params+=" --admission-control=${CUSTOM_ADMISSION_PLUGINS}"
|
||||||
params+=" --authorization-mode=Node,RBAC"
|
params+=" --authorization-mode=Node,RBAC"
|
||||||
@ -598,7 +601,7 @@ function start-kubemaster-component() {
|
|||||||
local -r component=$1
|
local -r component=$1
|
||||||
prepare-log-file /var/log/"${component}".log
|
prepare-log-file /var/log/"${component}".log
|
||||||
local -r src_file="${KUBE_ROOT}/${component}.yaml"
|
local -r src_file="${KUBE_ROOT}/${component}.yaml"
|
||||||
local -r params=$(compute-${component}-params)
|
local -r params=$("compute-${component}-params")
|
||||||
|
|
||||||
# Evaluate variables.
|
# Evaluate variables.
|
||||||
sed -i -e "s@{{params}}@${params}@g" "${src_file}"
|
sed -i -e "s@{{params}}@${params}@g" "${src_file}"
|
||||||
@ -609,18 +612,18 @@ function start-kubemaster-component() {
|
|||||||
elif [ "${component}" == "kube-addon-manager" ]; then
|
elif [ "${component}" == "kube-addon-manager" ]; then
|
||||||
setup-addon-manifests "addons" "kubemark-rbac-bindings"
|
setup-addon-manifests "addons" "kubemark-rbac-bindings"
|
||||||
else
|
else
|
||||||
local -r component_docker_tag=$(cat ${KUBE_BINDIR}/${component}.docker_tag)
|
local -r component_docker_tag=$(cat "${KUBE_BINDIR}/${component}.docker_tag")
|
||||||
sed -i -e "s@{{${component}_docker_tag}}@${component_docker_tag}@g" "${src_file}"
|
sed -i -e "s@{{${component}_docker_tag}}@${component_docker_tag}@g" "${src_file}"
|
||||||
if [ "${component}" == "kube-apiserver" ]; then
|
if [ "${component}" == "kube-apiserver" ]; then
|
||||||
local audit_policy_config_mount=""
|
local audit_policy_config_mount=""
|
||||||
local audit_policy_config_volume=""
|
local audit_policy_config_volume=""
|
||||||
if [[ "${ENABLE_APISERVER_ADVANCED_AUDIT:-}" == "true" ]]; then
|
if [[ "${ENABLE_APISERVER_ADVANCED_AUDIT:-}" == "true" ]]; then
|
||||||
read -d '' audit_policy_config_mount << EOF
|
read -r -d '' audit_policy_config_mount << EOF
|
||||||
- name: auditpolicyconfigmount
|
- name: auditpolicyconfigmount
|
||||||
mountPath: ${audit_policy_file}
|
mountPath: ${audit_policy_file}
|
||||||
readOnly: true
|
readOnly: true
|
||||||
EOF
|
EOF
|
||||||
read -d '' audit_policy_config_volume << EOF
|
read -r -d '' audit_policy_config_volume << EOF
|
||||||
- name: auditpolicyconfigmount
|
- name: auditpolicyconfigmount
|
||||||
hostPath:
|
hostPath:
|
||||||
path: ${audit_policy_file}
|
path: ${audit_policy_file}
|
||||||
@ -669,7 +672,8 @@ fi
|
|||||||
main_etcd_mount_point="/mnt/disks/master-pd"
|
main_etcd_mount_point="/mnt/disks/master-pd"
|
||||||
mount-pd "google-master-pd" "${main_etcd_mount_point}"
|
mount-pd "google-master-pd" "${main_etcd_mount_point}"
|
||||||
# Contains all the data stored in etcd.
|
# Contains all the data stored in etcd.
|
||||||
mkdir -m 700 -p "${main_etcd_mount_point}/var/etcd"
|
mkdir -p "${main_etcd_mount_point}/var/etcd"
|
||||||
|
chmod 700 "${main_etcd_mount_point}/var/etcd"
|
||||||
ln -s -f "${main_etcd_mount_point}/var/etcd" /var/etcd
|
ln -s -f "${main_etcd_mount_point}/var/etcd" /var/etcd
|
||||||
mkdir -p /etc/srv
|
mkdir -p /etc/srv
|
||||||
# Setup the dynamically generated apiserver auth certs and keys to pd.
|
# Setup the dynamically generated apiserver auth certs and keys to pd.
|
||||||
@ -692,7 +696,8 @@ fi
|
|||||||
event_etcd_mount_point="/mnt/disks/master-event-pd"
|
event_etcd_mount_point="/mnt/disks/master-event-pd"
|
||||||
mount-pd "google-master-event-pd" "${event_etcd_mount_point}"
|
mount-pd "google-master-event-pd" "${event_etcd_mount_point}"
|
||||||
# Contains all the data stored in event etcd.
|
# Contains all the data stored in event etcd.
|
||||||
mkdir -m 700 -p "${event_etcd_mount_point}/var/etcd/events"
|
mkdir -p "${event_etcd_mount_point}/var/etcd/events"
|
||||||
|
chmod 700 "${event_etcd_mount_point}/var/etcd/events"
|
||||||
ln -s -f "${event_etcd_mount_point}/var/etcd/events" /var/etcd/events
|
ln -s -f "${event_etcd_mount_point}/var/etcd/events" /var/etcd/events
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user