mirror of https://github.com/k3s-io/k3s
gce: move more stuff into main and refactor detect whether configure-helpers.sh was sourced
parent
070a35f9c3
commit
8c1e928501
|
@ -25,21 +25,6 @@ set -o errexit
|
||||||
set -o nounset
|
set -o nounset
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
readonly UUID_MNT_PREFIX="/mnt/disks/by-uuid/google-local-ssds"
|
|
||||||
readonly UUID_BLOCK_PREFIX="/dev/disk/by-uuid/google-local-ssds"
|
|
||||||
readonly COREDNS_AUTOSCALER="Deployment/coredns"
|
|
||||||
readonly KUBEDNS_AUTOSCALER="Deployment/kube-dns"
|
|
||||||
|
|
||||||
# Resource requests of master components.
|
|
||||||
KUBE_CONTROLLER_MANAGER_CPU_REQUEST="${KUBE_CONTROLLER_MANAGER_CPU_REQUEST:-200m}"
|
|
||||||
KUBE_SCHEDULER_CPU_REQUEST="${KUBE_SCHEDULER_CPU_REQUEST:-75m}"
|
|
||||||
|
|
||||||
# Use --retry-connrefused opt only if it's supported by curl.
|
|
||||||
CURL_RETRY_CONNREFUSED=""
|
|
||||||
if curl --help | grep -q -- '--retry-connrefused'; then
|
|
||||||
CURL_RETRY_CONNREFUSED='--retry-connrefused'
|
|
||||||
fi
|
|
||||||
|
|
||||||
function setup-os-params {
|
function setup-os-params {
|
||||||
# Reset core_pattern. On GCI, the default core_pattern pipes the core dumps to
|
# Reset core_pattern. On GCI, the default core_pattern pipes the core dumps to
|
||||||
# /sbin/crash_reporter which is more restrictive in saving crash dumps. So for
|
# /sbin/crash_reporter which is more restrictive in saving crash dumps. So for
|
||||||
|
@ -2750,6 +2735,21 @@ EOF
|
||||||
function main() {
|
function main() {
|
||||||
echo "Start to configure instance for kubernetes"
|
echo "Start to configure instance for kubernetes"
|
||||||
|
|
||||||
|
readonly UUID_MNT_PREFIX="/mnt/disks/by-uuid/google-local-ssds"
|
||||||
|
readonly UUID_BLOCK_PREFIX="/dev/disk/by-uuid/google-local-ssds"
|
||||||
|
readonly COREDNS_AUTOSCALER="Deployment/coredns"
|
||||||
|
readonly KUBEDNS_AUTOSCALER="Deployment/kube-dns"
|
||||||
|
|
||||||
|
# Resource requests of master components.
|
||||||
|
KUBE_CONTROLLER_MANAGER_CPU_REQUEST="${KUBE_CONTROLLER_MANAGER_CPU_REQUEST:-200m}"
|
||||||
|
KUBE_SCHEDULER_CPU_REQUEST="${KUBE_SCHEDULER_CPU_REQUEST:-75m}"
|
||||||
|
|
||||||
|
# Use --retry-connrefused opt only if it's supported by curl.
|
||||||
|
CURL_RETRY_CONNREFUSED=""
|
||||||
|
if curl --help | grep -q -- '--retry-connrefused'; then
|
||||||
|
CURL_RETRY_CONNREFUSED='--retry-connrefused'
|
||||||
|
fi
|
||||||
|
|
||||||
KUBE_HOME="/home/kubernetes"
|
KUBE_HOME="/home/kubernetes"
|
||||||
CONTAINERIZED_MOUNTER_HOME="${KUBE_HOME}/containerized_mounter"
|
CONTAINERIZED_MOUNTER_HOME="${KUBE_HOME}/containerized_mounter"
|
||||||
PV_RECYCLER_OVERRIDE_TEMPLATE="${KUBE_HOME}/kube-manifests/kubernetes/pv-recycler-template.yaml"
|
PV_RECYCLER_OVERRIDE_TEMPLATE="${KUBE_HOME}/kube-manifests/kubernetes/pv-recycler-template.yaml"
|
||||||
|
@ -2841,9 +2841,6 @@ function main() {
|
||||||
echo "Done for the configuration for kubernetes"
|
echo "Done for the configuration for kubernetes"
|
||||||
}
|
}
|
||||||
|
|
||||||
# use --source-only to test functions defined in this script.
|
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||||
if [[ "$#" -eq 1 && "${1}" == "--source-only" ]]; then
|
main "${@}"
|
||||||
:
|
|
||||||
else
|
|
||||||
main "${@}"
|
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -125,7 +125,7 @@ func (c *ManifestTestCase) mustCreateEnv(envTemplate string, env interface{}) {
|
||||||
|
|
||||||
func (c *ManifestTestCase) mustInvokeFunc(envTemplate string, env interface{}) {
|
func (c *ManifestTestCase) mustInvokeFunc(envTemplate string, env interface{}) {
|
||||||
c.mustCreateEnv(envTemplate, env)
|
c.mustCreateEnv(envTemplate, env)
|
||||||
args := fmt.Sprintf("source %s ; source %s --source-only ; %s", c.envScriptPath, configureHelperScriptName, c.manifestFuncName)
|
args := fmt.Sprintf("source %s ; source %s; %s", c.envScriptPath, configureHelperScriptName, c.manifestFuncName)
|
||||||
cmd := exec.Command("bash", "-c", args)
|
cmd := exec.Command("bash", "-c", args)
|
||||||
|
|
||||||
bs, err := cmd.CombinedOutput()
|
bs, err := cmd.CombinedOutput()
|
||||||
|
|
Loading…
Reference in New Issue