Skip to content

Commit 53a2559

Browse files
committed
Install and start logging based on kube env
1 parent 84fe3db commit 53a2559

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

cluster/gce/windows/configure.ps1

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,20 @@ function FetchAndImport-ModuleFromMetadata {
8484
Import-Module -Force C:\$Filename
8585
}
8686

87+
# Returns true if the ENABLE_NODE_LOGGING field in kube_env is true.
88+
# $KubeEnv is a hash table containing the kube-env metadata keys+values.
89+
function IsLoggingEnabled {
90+
param (
91+
[parameter(Mandatory=$true)] [hashtable]$KubeEnv
92+
)
93+
94+
if ($KubeEnv.Contains('ENABLE_NODE_LOGGING') -and `
95+
($KubeEnv['ENABLE_NODE_LOGGING'] -eq 'true')) {
96+
return $true
97+
}
98+
return $false
99+
}
100+
87101
try {
88102
# Don't use FetchAndImport-ModuleFromMetadata for common.psm1 - the common
89103
# module includes variables and functions that any other function may depend
@@ -108,6 +122,10 @@ try {
108122
StartProcess-WriteSshKeys
109123
}
110124

125+
if (IsLoggingEnabled $kube_env) {
126+
InstallAndStart-LoggingAgent
127+
}
128+
111129
Set-EnvironmentVars
112130
Create-Directories
113131
Download-HelperScripts

0 commit comments

Comments
 (0)