mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-04 10:47:25 +00:00
Install and start logging based on kube env
This commit is contained in:
@@ -84,6 +84,20 @@ function FetchAndImport-ModuleFromMetadata {
|
|||||||
Import-Module -Force C:\$Filename
|
Import-Module -Force C:\$Filename
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Returns true if the ENABLE_NODE_LOGGING field in kube_env is true.
|
||||||
|
# $KubeEnv is a hash table containing the kube-env metadata keys+values.
|
||||||
|
function IsLoggingEnabled {
|
||||||
|
param (
|
||||||
|
[parameter(Mandatory=$true)] [hashtable]$KubeEnv
|
||||||
|
)
|
||||||
|
|
||||||
|
if ($KubeEnv.Contains('ENABLE_NODE_LOGGING') -and `
|
||||||
|
($KubeEnv['ENABLE_NODE_LOGGING'] -eq 'true')) {
|
||||||
|
return $true
|
||||||
|
}
|
||||||
|
return $false
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
# Don't use FetchAndImport-ModuleFromMetadata for common.psm1 - the common
|
# Don't use FetchAndImport-ModuleFromMetadata for common.psm1 - the common
|
||||||
# module includes variables and functions that any other function may depend
|
# module includes variables and functions that any other function may depend
|
||||||
@@ -108,6 +122,10 @@ try {
|
|||||||
StartProcess-WriteSshKeys
|
StartProcess-WriteSshKeys
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (IsLoggingEnabled $kube_env) {
|
||||||
|
InstallAndStart-LoggingAgent
|
||||||
|
}
|
||||||
|
|
||||||
Set-EnvironmentVars
|
Set-EnvironmentVars
|
||||||
Create-Directories
|
Create-Directories
|
||||||
Download-HelperScripts
|
Download-HelperScripts
|
||||||
|
Reference in New Issue
Block a user