mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	Merge pull request #85827 from barney-s/fix-windows-fluentd-config-hostname
Replace the hostname in the fluentd config file even if the file exists
This commit is contained in:
		@@ -1604,16 +1604,12 @@ function Install-LoggingAgent {
 | 
				
			|||||||
function Configure-LoggingAgent {
 | 
					function Configure-LoggingAgent {
 | 
				
			||||||
  $fluentd_config_dir = "$STACKDRIVER_ROOT\LoggingAgent\config.d"
 | 
					  $fluentd_config_dir = "$STACKDRIVER_ROOT\LoggingAgent\config.d"
 | 
				
			||||||
  $fluentd_config_file = "$fluentd_config_dir\k8s_containers.conf"
 | 
					  $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")
 | 
					 | 
				
			||||||
    return
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  # Create a configuration file for kubernetes containers.
 | 
					  # Create a configuration file for kubernetes containers.
 | 
				
			||||||
  # The config.d directory should have already been created automatically, but
 | 
					  # The config.d directory should have already been created automatically, but
 | 
				
			||||||
  # try creating again just in case.
 | 
					  # try creating again just in case.
 | 
				
			||||||
  New-Item $fluentd_config_dir -ItemType 'directory' -Force | Out-Null
 | 
					  New-Item $fluentd_config_dir -ItemType 'directory' -Force | Out-Null
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
  $config = $FLUENTD_CONFIG.replace('NODE_NAME', (hostname))
 | 
					  $config = $FLUENTD_CONFIG.replace('NODE_NAME', (hostname))
 | 
				
			||||||
  $config | Out-File -FilePath $fluentd_config_file -Encoding ASCII
 | 
					  $config | Out-File -FilePath $fluentd_config_file -Encoding ASCII
 | 
				
			||||||
  Log-Output "Wrote fluentd logging config to $fluentd_config_file"
 | 
					  Log-Output "Wrote fluentd logging config to $fluentd_config_file"
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user