From a70a5347360f8a736cf30f350754ada39adab4af Mon Sep 17 00:00:00 2001 From: Barni S Date: Mon, 2 Dec 2019 16:04:52 -0800 Subject: [PATCH 1/2] Replace the hostname in the fluentd config file even if the file exists --- cluster/gce/windows/k8s-node-setup.psm1 | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/cluster/gce/windows/k8s-node-setup.psm1 b/cluster/gce/windows/k8s-node-setup.psm1 index 45ad6376d9a..3c352c5cf47 100644 --- a/cluster/gce/windows/k8s-node-setup.psm1 +++ b/cluster/gce/windows/k8s-node-setup.psm1 @@ -1528,13 +1528,12 @@ function Configure-LoggingAgent { if (-not (ShouldWrite-File $fluentd_config_file)) { Log-Output ("Skip: fluentd logging config $fluentd_config_file already " + "exists") - return + } else { + # Create a configuration file for kubernetes containers. + # The config.d directory should have already been created automatically, but + # try creating again just in case. + New-Item $fluentd_config_dir -ItemType 'directory' -Force | Out-Null } - - # Create a configuration file for kubernetes containers. - # The config.d directory should have already been created automatically, but - # try creating again just in case. - New-Item $fluentd_config_dir -ItemType 'directory' -Force | Out-Null $config = $FLUENTD_CONFIG.replace('NODE_NAME', (hostname)) $config | Out-File -FilePath $fluentd_config_file -Encoding ASCII Log-Output "Wrote fluentd logging config to $fluentd_config_file" From dd7430134a87f0e29a3bb11787cbca79a65a2575 Mon Sep 17 00:00:00 2001 From: barney-s <6457279+barney-s@users.noreply.github.com> Date: Thu, 5 Dec 2019 10:35:47 -0800 Subject: [PATCH 2/2] Removing conditional check Addressing review comment. Removing conditional check for fluentd config file path. --- cluster/gce/windows/k8s-node-setup.psm1 | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/cluster/gce/windows/k8s-node-setup.psm1 b/cluster/gce/windows/k8s-node-setup.psm1 index 3c352c5cf47..088ea4e0f9a 100644 --- a/cluster/gce/windows/k8s-node-setup.psm1 +++ b/cluster/gce/windows/k8s-node-setup.psm1 @@ -1525,15 +1525,12 @@ function Install-LoggingAgent { function Configure-LoggingAgent { $fluentd_config_dir = "$STACKDRIVER_ROOT\LoggingAgent\config.d" $fluentd_config_file = "$fluentd_config_dir\k8s_containers.conf" - if (-not (ShouldWrite-File $fluentd_config_file)) { - Log-Output ("Skip: fluentd logging config $fluentd_config_file already " + - "exists") - } else { - # Create a configuration file for kubernetes containers. - # The config.d directory should have already been created automatically, but - # try creating again just in case. - New-Item $fluentd_config_dir -ItemType 'directory' -Force | Out-Null - } + + # Create a configuration file for kubernetes containers. + # The config.d directory should have already been created automatically, but + # try creating again just in case. + New-Item $fluentd_config_dir -ItemType 'directory' -Force | Out-Null + $config = $FLUENTD_CONFIG.replace('NODE_NAME', (hostname)) $config | Out-File -FilePath $fluentd_config_file -Encoding ASCII Log-Output "Wrote fluentd logging config to $fluentd_config_file"