Skip to content

Commit 510da26

Browse files
authored
Fix resource optimization bug (#1317)
* fix resource optimization bug * address commments
1 parent 1b29b93 commit 510da26

File tree

3 files changed

+21
-65
lines changed

3 files changed

+21
-65
lines changed

build/common/installer/scripts/tomlparser-agent-config.rb

-43
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,6 @@
9797
@ignoreProxySettings = false
9898

9999
@multiline_enabled = "false"
100-
@resource_optimization_enabled = false
101-
@windows_fluent_bit_disabled = true
102100

103101
@waittime_port_25226 = 45
104102
@waittime_port_25228 = 120
@@ -373,32 +371,6 @@ def populateSettingValuesFromConfigMap(parsedConfig)
373371
puts "Using config map value: AZMON_MULTILINE_ENABLED = #{@multiline_enabled}"
374372
end
375373

376-
if !@controllerType.nil? && !@controllerType.empty? && @controllerType.strip.casecmp(@daemonset) == 0 && @containerType.nil?
377-
resource_optimization_config = parsedConfig[:agent_settings][:resource_optimization]
378-
if !resource_optimization_config.nil?
379-
resource_optimization_enabled = resource_optimization_config[:enabled]
380-
if !resource_optimization_enabled.nil? && (!!resource_optimization_enabled == resource_optimization_enabled) #Checking for Boolean type, since 'Boolean' is not defined as a type in ruby
381-
@resource_optimization_enabled = resource_optimization_enabled
382-
end
383-
puts "Using config map value: AZMON_RESOURCE_OPTIMIZATION_ENABLED = #{@resource_optimization_enabled}"
384-
end
385-
end
386-
387-
enable_custom_metrics = ENV["ENABLE_CUSTOM_METRICS"]
388-
if !enable_custom_metrics.nil? && enable_custom_metrics.to_s.downcase == "true"
389-
@resource_optimization_enabled = false
390-
puts "Resource Optimization disabled since custom metrics is enabled"
391-
end
392-
393-
windows_fluent_bit_config = parsedConfig[:agent_settings][:windows_fluent_bit]
394-
if !windows_fluent_bit_config.nil?
395-
windows_fluent_bit_disabled = windows_fluent_bit_config[:disabled]
396-
if !windows_fluent_bit_disabled.nil? && windows_fluent_bit_disabled.to_s.downcase == "false"
397-
@windows_fluent_bit_disabled = false
398-
end
399-
puts "Using config map value: AZMON_WINDOWS_FLUENT_BIT_DISABLED = #{@windows_fluent_bit_disabled}"
400-
end
401-
402374
network_listener_waittime_config = parsedConfig[:agent_settings][:network_listener_waittime]
403375
if !network_listener_waittime_config.nil?
404376
waittime = network_listener_waittime_config[:tcp_port_25226]
@@ -549,12 +521,6 @@ def populateSettingValuesFromConfigMap(parsedConfig)
549521
file.write("export AZMON_MULTILINE_ENABLED=#{@multiline_enabled}\n")
550522
end
551523

552-
file.write("export AZMON_RESOURCE_OPTIMIZATION_ENABLED=#{@resource_optimization_enabled}\n")
553-
554-
if !@windows_fluent_bit_disabled
555-
file.write("export AZMON_WINDOWS_FLUENT_BIT_DISABLED=#{@windows_fluent_bit_disabled}\n")
556-
end
557-
558524
file.write("export WAITTIME_PORT_25226=#{@waittime_port_25226}\n")
559525
file.write("export WAITTIME_PORT_25228=#{@waittime_port_25228}\n")
560526
file.write("export WAITTIME_PORT_25229=#{@waittime_port_25229}\n")
@@ -659,15 +625,6 @@ def get_command_windows(env_variable_name, env_variable_value)
659625
commands = get_command_windows("AZMON_MULTILINE_ENABLED", @multiline_enabled)
660626
file.write(commands)
661627
end
662-
if @resource_optimization_enabled
663-
commands = get_command_windows("AZMON_RESOURCE_OPTIMIZATION_ENABLED", @resource_optimization_enabled)
664-
file.write(commands)
665-
end
666-
667-
if !@windows_fluent_bit_disabled
668-
commands = get_command_windows("AZMON_WINDOWS_FLUENT_BIT_DISABLED", @windows_fluent_bit_disabled)
669-
file.write(commands)
670-
end
671628

672629
commands = get_command_windows("WAITTIME_PORT_25229", @waittime_port_25229)
673630
file.write(commands)

build/common/installer/scripts/tomlparser-geneva-config.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def populateGenevaIntegrationSettings(parsedConfig)
7171
@geneva_account_namespace = ""
7272
@geneva_gcs_region = ""
7373
end
74-
end
74+
end
7575

7676
# Use the ruby structure created after config parsing to set the right values to be used as environment variables
7777
def populateSettingValuesFromConfigMap(parsedConfig)

kubernetes/linux/main.sh

+20-21
Original file line numberDiff line numberDiff line change
@@ -1097,29 +1097,28 @@ else
10971097
setGlobalEnvVar AZMON_RESOURCE_OPTIMIZATION_ENABLED "${AZMON_RESOURCE_OPTIMIZATION_ENABLED}"
10981098
fi
10991099

1100-
if [ "$AZMON_RESOURCE_OPTIMIZATION_ENABLED" != "true" ]; then
1101-
# no dependency on fluentd for prometheus side car container
1102-
if [ "${CONTAINER_TYPE}" != "PrometheusSidecar" ] && [ "${GENEVA_LOGS_INTEGRATION_SERVICE_MODE}" != "true" ]; then
1103-
if [ ! -e "/etc/config/kube.conf" ]; then
1104-
if [ "$LOGS_AND_EVENTS_ONLY" != "true" ]; then
1105-
echo "*** starting fluentd v1 in daemonset"
1106-
if [ "${ENABLE_CUSTOM_METRICS}" == "true" ]; then
1107-
mv /etc/fluent/container-cm.conf /etc/fluent/container.conf
1108-
fi
1109-
fluentd -c /etc/fluent/container.conf -o /var/opt/microsoft/docker-cimprov/log/fluentd.log --log-rotate-age 5 --log-rotate-size 20971520 &
1110-
else
1111-
echo "Skipping fluentd since LOGS_AND_EVENTS_ONLY is set to true"
1112-
fi
1113-
else
1114-
echo "*** starting fluentd v1 in replicaset"
1115-
if [ "${ENABLE_CUSTOM_METRICS}" == "true" ]; then
1116-
mv /etc/fluent/kube-cm.conf /etc/fluent/kube.conf
1117-
fi
1118-
fluentd -c /etc/fluent/kube.conf -o /var/opt/microsoft/docker-cimprov/log/fluentd.log --log-rotate-age 5 --log-rotate-size 20971520 &
1100+
#start fluentd
1101+
if [ "${CONTROLLER_TYPE}" == "ReplicaSet" ] && [ "${GENEVA_LOGS_INTEGRATION_SERVICE_MODE}" != "true" ]; then
1102+
echo "*** starting fluentd v1 in replicaset"
1103+
if [ "${ENABLE_CUSTOM_METRICS}" == "true" ]; then
1104+
mv /etc/fluent/kube-cm.conf /etc/fluent/kube.conf
1105+
fi
1106+
fluentd -c /etc/fluent/kube.conf -o /var/opt/microsoft/docker-cimprov/log/fluentd.log --log-rotate-age 5 --log-rotate-size 20971520 &
1107+
elif [ "$AZMON_RESOURCE_OPTIMIZATION_ENABLED" != "true" ]; then
1108+
# no dependency on fluentd for Prometheus sidecar container
1109+
if [ "${CONTAINER_TYPE}" != "PrometheusSidecar" ] && [ "${GENEVA_LOGS_INTEGRATION_SERVICE_MODE}" != "true" ] && [ ! -e "/etc/config/kube.conf" ]; then
1110+
if [ "$LOGS_AND_EVENTS_ONLY" != "true" ]; then
1111+
echo "*** starting fluentd v1 in daemonset"
1112+
if [ "${ENABLE_CUSTOM_METRICS}" == "true" ]; then
1113+
mv /etc/fluent/container-cm.conf /etc/fluent/container.conf
11191114
fi
1120-
fi
1115+
fluentd -c /etc/fluent/container.conf -o /var/opt/microsoft/docker-cimprov/log/fluentd.log --log-rotate-age 5 --log-rotate-size 20971520 &
1116+
else
1117+
echo "Skipping fluentd since LOGS_AND_EVENTS_ONLY is set to true"
1118+
fi
1119+
fi
11211120
else
1122-
echo "Skipping fluentd since AZMON_RESOURCE_OPTIMIZATION_ENABLED is set to ${AZMON_RESOURCE_OPTIMIZATION_ENABLED}"
1121+
echo "Skipping fluentd for linux daemonset since AZMON_RESOURCE_OPTIMIZATION_ENABLED is set to ${AZMON_RESOURCE_OPTIMIZATION_ENABLED}"
11231122
fi
11241123

11251124
#If config parsing was successful, a copy of the conf file with replaced custom settings file is created

0 commit comments

Comments
 (0)