Use GKE specific configuration in startup scripts in GKE deployment.

This commit is contained in:
Ben Hu 2021-04-02 00:10:53 +00:00
parent a651804427
commit a2d094797d
2 changed files with 10 additions and 3 deletions

View File

@ -1269,9 +1269,12 @@ EOF
function create-kubeconfig {
local component=$1
local token=$2
echo "Creating kubeconfig file for component ${component}"
mkdir -p "/etc/srv/kubernetes/${component}"
cat <<EOF >"/etc/srv/kubernetes/${component}/kubeconfig"
if [[ -e "${KUBE_HOME}/bin/gke-internal-configure-helper.sh" ]]; then
gke-internal-create-kubeconfig "${component}" "${token}"
else
echo "Creating kubeconfig file for component ${component}"
mkdir -p "/etc/srv/kubernetes/${component}"
cat <<EOF >"/etc/srv/kubernetes/${component}/kubeconfig"
apiVersion: v1
kind: Config
users:
@ -1290,6 +1293,7 @@ contexts:
name: ${component}
current-context: ${component}
EOF
fi
}
# Arg 1: the IP address of the API server

View File

@ -95,6 +95,9 @@ function start-kube-apiserver {
if [[ -n "${TLS_CIPHER_SUITES:-}" ]]; then
params+=" --tls-cipher-suites=${TLS_CIPHER_SUITES}"
fi
if [[ -e "${KUBE_HOME}/bin/gke-internal-configure-helper.sh" ]]; then
gke-kube-apiserver-internal-sni-param params
fi
params+=" --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname"
if [[ -s "${REQUESTHEADER_CA_CERT_PATH:-}" ]]; then
params+=" --requestheader-client-ca-file=${REQUESTHEADER_CA_CERT_PATH}"