-
Notifications
You must be signed in to change notification settings - Fork 38.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KubeEnv var to enable Hyper-V in GCE Windows nodes created with kube-up #105999
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -295,6 +295,7 @@ function Set-EnvironmentVars { | |
"MANIFESTS_DIR" = ${kube_env}['MANIFESTS_DIR'] | ||
"INFRA_CONTAINER" = ${kube_env}['WINDOWS_INFRA_CONTAINER'] | ||
"WINDOWS_ENABLE_PIGZ" = ${kube_env}['WINDOWS_ENABLE_PIGZ'] | ||
"WINDOWS_ENABLE_HYPERV" = ${kube_env}['WINDOWS_ENABLE_HYPERV'] | ||
"ENABLE_NODE_PROBLEM_DETECTOR" = ${kube_env}['ENABLE_NODE_PROBLEM_DETECTOR'] | ||
"NODEPROBLEMDETECTOR_KUBECONFIG_FILE" = ${kube_env}['WINDOWS_NODEPROBLEMDETECTOR_KUBECONFIG_FILE'] | ||
|
||
|
@@ -1386,6 +1387,24 @@ function Install-ContainersFeature { | |
Install-WindowsFeature Containers | ||
} | ||
|
||
# Verifies if Hyper-V should be enabled in the node | ||
function Test-ShouldEnableHyperVFeature { | ||
return "${env:WINDOWS_ENABLE_HYPERV}" -eq "true" | ||
} | ||
|
||
# Check if Hyper-V feature is enabled | ||
function Test-HyperVFeatureEnabled { | ||
return ((Get-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V).State -eq 'Enabled') | ||
} | ||
|
||
# After this function returns, the computer must be restarted to complete | ||
# the installation! | ||
function Enable-HyperVFeature { | ||
Log-Output "Enabling Windows 'HyperV' feature" | ||
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All -NoRestart | ||
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-Management-PowerShell -All -NoRestart | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why -NoRestart option here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could restart after enabling each feature but instead we could batch all of the installations that require a restart to do a restart after all of them completed, what I saw is:
|
||
} | ||
|
||
function Test-DockerIsInstalled { | ||
return ((Get-Package ` | ||
-ProviderName DockerMsftProvider ` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why moved this part up?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the first check to see if we have to install Hyper-V is to see the value of
kube_env[WINDOWS_ENABLE_HYPERV]
, these lines fetch kubeEnv from the instance metadata