From 7ef91e5bd4be8f946bcd6c4d5a59abda1584bf78 Mon Sep 17 00:00:00 2001 From: Dilip Raghunathan Date: Sat, 24 Aug 2019 15:34:04 -0700 Subject: [PATCH 1/3] Expose replica set service as an env variable --- installer/conf/container.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer/conf/container.conf b/installer/conf/container.conf index 4cb9e6913..3d0ec3429 100755 --- a/installer/conf/container.conf +++ b/installer/conf/container.conf @@ -76,7 +76,7 @@ heartbeat_type tcp - host healthmodel-replicaset-service.kube-system + host "#{ENV['REPLICASET_SERVICE_ENDPOINT']}" port 25227 From 705643d18d772327210ca35ae00b5146cb23e877 Mon Sep 17 00:00:00 2001 From: r-dilip Date: Tue, 3 Sep 2019 18:19:09 -0700 Subject: [PATCH 2/3] Fixing null check out_mdm bug, and tomlparser bug --- installer/scripts/tomlparser.rb | 11 ++++++++--- source/code/plugin/out_mdm.rb | 3 ++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/installer/scripts/tomlparser.rb b/installer/scripts/tomlparser.rb index 067586629..b66e1257e 100644 --- a/installer/scripts/tomlparser.rb +++ b/installer/scripts/tomlparser.rb @@ -16,6 +16,7 @@ @logTailPath = "/var/log/containers/*.log" @logExclusionRegexPattern = "(^((?!stdout|stderr).)*$)" @excludePath = "*.csv2" #some invalid path +@enable_health_model = false # Use parser to parse the configmap toml file to a ruby structure def parseConfigMap(path) @@ -121,10 +122,12 @@ def populateSettingValuesFromConfigMap(parsedConfig) end begin - if !parsedConfig.nil? && !parsedConfig[:agent_settings][:health_model].nil? && !parsedConfig[:agent_settings][:health_model][:enabled].nil? + if !parsedConfig.nil? && !parsedConfig[:agent_settings].nil? && !parsedConfig[:agent_settings][:health_model].nil? && !parsedConfig[:agent_settings][:health_model][:enabled].nil? @enable_health_model = parsedConfig[:agent_settings][:health_model][:enabled] - puts "enable_health_model = #{@enable_health_model}" + else + @enable_health_model = false end + puts "enable_health_model = #{@enable_health_model}" rescue => errorStr puts "config::error:Exception while reading config settings for health_model enabled setting - #{errorStr}, using defaults" @enable_health_model = false @@ -140,7 +143,9 @@ def populateSettingValuesFromConfigMap(parsedConfig) Dir["/etc/config/settings/*settings"].each{|file| puts "Parsing File #{file}" settings = parseConfigMap(file) - configMapSettings = configMapSettings.merge(settings) + if !settings.nil? + configMapSettings = configMapSettings.merge(settings) + end } if !configMapSettings.nil? diff --git a/source/code/plugin/out_mdm.rb b/source/code/plugin/out_mdm.rb index 4b9d50a29..b8d10090d 100644 --- a/source/code/plugin/out_mdm.rb +++ b/source/code/plugin/out_mdm.rb @@ -55,8 +55,9 @@ def start if aks_region.to_s.empty? @log.info "Environment Variable AKS_REGION is not set.. " @can_send_data_to_mdm = false + else + aks_region = aks_region.gsub(" ","") end - aks_region = aks_region.gsub(" ","") if @can_send_data_to_mdm @log.info "MDM Metrics supported in #{aks_region} region" From 0a204dbdd6410ff3ac97918b21a31ae3d50998b9 Mon Sep 17 00:00:00 2001 From: r-dilip Date: Wed, 4 Sep 2019 08:34:43 -0700 Subject: [PATCH 3/3] Updating the env variable name to be more specific to health model --- installer/conf/container.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer/conf/container.conf b/installer/conf/container.conf index 3d0ec3429..0b26357f0 100755 --- a/installer/conf/container.conf +++ b/installer/conf/container.conf @@ -76,7 +76,7 @@ heartbeat_type tcp - host "#{ENV['REPLICASET_SERVICE_ENDPOINT']}" + host "#{ENV['HEALTHMODEL_REPLICASET_SERVICE_ENDPOINT']}" port 25227