mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Add WINDOWS_CONTAINER_RUNTIME env vairable
Now the default value of container runtime for linux is changed to containerd. However, containerd is not ready to be used in Windows node. THis PR adds a new env varabile to handle container runtime setup for windows nodes. This way, linux and windows can set up their owe container runtime. By default, linux uses containerd while windows uses dockerd
This commit is contained in:
parent
930b3a4df0
commit
953597134b
@ -95,6 +95,8 @@ export KUBELET_TEST_ARGS=${KUBE_KUBELET_EXTRA_ARGS:-}
|
|||||||
|
|
||||||
# Default container runtime
|
# Default container runtime
|
||||||
export CONTAINER_RUNTIME=${KUBE_CONTAINER_RUNTIME:-containerd}
|
export CONTAINER_RUNTIME=${KUBE_CONTAINER_RUNTIME:-containerd}
|
||||||
|
# Default container runtime for windows
|
||||||
|
export WINDOWS_CONTAINER_RUNTIME=${KUBE_WINDOWS_CONTAINER_RUNTIME:-docker}
|
||||||
|
|
||||||
# Set default values with override
|
# Set default values with override
|
||||||
if [[ "${CONTAINER_RUNTIME}" == "docker" ]]; then
|
if [[ "${CONTAINER_RUNTIME}" == "docker" ]]; then
|
||||||
|
@ -96,8 +96,10 @@ export NODE_IMAGE=${KUBE_GCE_NODE_IMAGE:-${GCI_VERSION}}
|
|||||||
export NODE_IMAGE_PROJECT=${KUBE_GCE_NODE_PROJECT:-cos-cloud}
|
export NODE_IMAGE_PROJECT=${KUBE_GCE_NODE_PROJECT:-cos-cloud}
|
||||||
export NODE_SERVICE_ACCOUNT=${KUBE_GCE_NODE_SERVICE_ACCOUNT:-default}
|
export NODE_SERVICE_ACCOUNT=${KUBE_GCE_NODE_SERVICE_ACCOUNT:-default}
|
||||||
|
|
||||||
# Default container runtime
|
# Default container runtime for linux
|
||||||
export CONTAINER_RUNTIME=${KUBE_CONTAINER_RUNTIME:-containerd}
|
export CONTAINER_RUNTIME=${KUBE_CONTAINER_RUNTIME:-containerd}
|
||||||
|
# Default container runtime for windows
|
||||||
|
export WINDOWS_CONTAINER_RUNTIME=${KUBE_WINDOWS_CONTAINER_RUNTIME:-docker}
|
||||||
|
|
||||||
# Set default values with override
|
# Set default values with override
|
||||||
if [[ "${CONTAINER_RUNTIME}" == "docker" ]]; then
|
if [[ "${CONTAINER_RUNTIME}" == "docker" ]]; then
|
||||||
|
@ -897,11 +897,11 @@ function construct-windows-kubelet-flags {
|
|||||||
# Force disable KubeletPodResources feature on Windows until #78628 is fixed.
|
# Force disable KubeletPodResources feature on Windows until #78628 is fixed.
|
||||||
flags+=" --feature-gates=KubeletPodResources=false"
|
flags+=" --feature-gates=KubeletPodResources=false"
|
||||||
|
|
||||||
if [[ "${CONTAINER_RUNTIME:-}" != "docker" ]]; then
|
if [[ "${WINDOWS_CONTAINER_RUNTIME:-}" != "docker" ]]; then
|
||||||
flags+=" --container-runtime=remote"
|
flags+=" --container-runtime=remote"
|
||||||
if [[ "${CONTAINER_RUNTIME}" == "containerd" ]]; then
|
if [[ "${WINDOWS_CONTAINER_RUNTIME}" == "containerd" ]]; then
|
||||||
CONTAINER_RUNTIME_ENDPOINT=${KUBE_CONTAINER_RUNTIME_ENDPOINT:-npipe:////./pipe/containerd-containerd}
|
WINDOWS_CONTAINER_RUNTIME_ENDPOINT=${KUBE_WINDOWS_CONTAINER_RUNTIME_ENDPOINT:-npipe:////./pipe/containerd-containerd}
|
||||||
flags+=" --container-runtime-endpoint=${CONTAINER_RUNTIME_ENDPOINT}"
|
flags+=" --container-runtime-endpoint=${WINDOWS_CONTAINER_RUNTIME_ENDPOINT}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -1550,6 +1550,8 @@ CNI_DIR: $(yaml-quote ${WINDOWS_CNI_DIR})
|
|||||||
CNI_CONFIG_DIR: $(yaml-quote ${WINDOWS_CNI_CONFIG_DIR})
|
CNI_CONFIG_DIR: $(yaml-quote ${WINDOWS_CNI_CONFIG_DIR})
|
||||||
WINDOWS_CNI_STORAGE_PATH: $(yaml-quote ${WINDOWS_CNI_STORAGE_PATH})
|
WINDOWS_CNI_STORAGE_PATH: $(yaml-quote ${WINDOWS_CNI_STORAGE_PATH})
|
||||||
WINDOWS_CNI_VERSION: $(yaml-quote ${WINDOWS_CNI_VERSION})
|
WINDOWS_CNI_VERSION: $(yaml-quote ${WINDOWS_CNI_VERSION})
|
||||||
|
WINDOWS_CONTAINER_RUNTIME: $(yaml-quote ${WINDOWS_CONTAINER_RUNTIME})
|
||||||
|
WINDOWS_CONTAINER_RUNTIME_ENDPOINT: $(yaml-quote ${WINDOWS_CONTAINER_RUNTIME_ENDPOINT})
|
||||||
MANIFESTS_DIR: $(yaml-quote ${WINDOWS_MANIFESTS_DIR})
|
MANIFESTS_DIR: $(yaml-quote ${WINDOWS_MANIFESTS_DIR})
|
||||||
PKI_DIR: $(yaml-quote ${WINDOWS_PKI_DIR})
|
PKI_DIR: $(yaml-quote ${WINDOWS_PKI_DIR})
|
||||||
CA_FILE_PATH: $(yaml-quote ${WINDOWS_CA_FILE})
|
CA_FILE_PATH: $(yaml-quote ${WINDOWS_CA_FILE})
|
||||||
|
@ -241,6 +241,14 @@ function Set_CurrentShellEnvironmentVar {
|
|||||||
# Sets environment variables used by Kubernetes binaries and by other functions
|
# Sets environment variables used by Kubernetes binaries and by other functions
|
||||||
# in this module. Depends on numerous ${kube_env} keys.
|
# in this module. Depends on numerous ${kube_env} keys.
|
||||||
function Set-EnvironmentVars {
|
function Set-EnvironmentVars {
|
||||||
|
if ($kube_env.ContainsKey('WINDOWS_CONTAINER_RUNTIME')) {
|
||||||
|
$container_runtime = ${kube_env}['WINDOWS_CONTAINER_RUNTIME']
|
||||||
|
$container_runtime_endpoint = ${kube_env}['WINDOWS_CONTAINER_RUNTIME_ENDPOINT']
|
||||||
|
} else {
|
||||||
|
Log-Output "ERROR: WINDOWS_CONTAINER_RUNTIME not set in kube-env, falling back in CONTAINER_RUNTIME"
|
||||||
|
$container_runtime = ${kube_env}['CONTAINER_RUNTIME']
|
||||||
|
$container_runtime_endpoint = ${kube_env}['CONTAINER_RUNTIME_ENDPOINT']
|
||||||
|
}
|
||||||
# Turning the kube-env values into environment variables is not required but
|
# Turning the kube-env values into environment variables is not required but
|
||||||
# it makes debugging this script easier, and it also makes the syntax a lot
|
# it makes debugging this script easier, and it also makes the syntax a lot
|
||||||
# easier (${env:K8S_DIR} can be expanded within a string but
|
# easier (${env:K8S_DIR} can be expanded within a string but
|
||||||
@ -268,8 +276,8 @@ function Set-EnvironmentVars {
|
|||||||
"KUBELET_CERT_PATH" = ${kube_env}['PKI_DIR'] + '\kubelet.crt'
|
"KUBELET_CERT_PATH" = ${kube_env}['PKI_DIR'] + '\kubelet.crt'
|
||||||
"KUBELET_KEY_PATH" = ${kube_env}['PKI_DIR'] + '\kubelet.key'
|
"KUBELET_KEY_PATH" = ${kube_env}['PKI_DIR'] + '\kubelet.key'
|
||||||
|
|
||||||
"CONTAINER_RUNTIME" = ${kube_env}['CONTAINER_RUNTIME']
|
"CONTAINER_RUNTIME" = $container_runtime
|
||||||
"CONTAINER_RUNTIME_ENDPOINT" = ${kube_env}['CONTAINER_RUNTIME_ENDPOINT']
|
"CONTAINER_RUNTIME_ENDPOINT" = $container_runtime_endpoint
|
||||||
|
|
||||||
'LICENSE_DIR' = 'C:\Program Files\Google\Compute Engine\THIRD_PARTY_NOTICES'
|
'LICENSE_DIR' = 'C:\Program Files\Google\Compute Engine\THIRD_PARTY_NOTICES'
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user