Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix resource optimization bug #1317

Merged
merged 2 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 0 additions & 43 deletions build/common/installer/scripts/tomlparser-agent-config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,6 @@
@ignoreProxySettings = false

@multiline_enabled = "false"
@resource_optimization_enabled = false
@windows_fluent_bit_disabled = true

@waittime_port_25226 = 45
@waittime_port_25228 = 120
Expand Down Expand Up @@ -373,32 +371,6 @@ def populateSettingValuesFromConfigMap(parsedConfig)
puts "Using config map value: AZMON_MULTILINE_ENABLED = #{@multiline_enabled}"
end

if !@controllerType.nil? && !@controllerType.empty? && @controllerType.strip.casecmp(@daemonset) == 0 && @containerType.nil?
resource_optimization_config = parsedConfig[:agent_settings][:resource_optimization]
if !resource_optimization_config.nil?
resource_optimization_enabled = resource_optimization_config[:enabled]
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
@resource_optimization_enabled = resource_optimization_enabled
end
puts "Using config map value: AZMON_RESOURCE_OPTIMIZATION_ENABLED = #{@resource_optimization_enabled}"
end
end

enable_custom_metrics = ENV["ENABLE_CUSTOM_METRICS"]
if !enable_custom_metrics.nil? && enable_custom_metrics.to_s.downcase == "true"
@resource_optimization_enabled = false
puts "Resource Optimization disabled since custom metrics is enabled"
end

windows_fluent_bit_config = parsedConfig[:agent_settings][:windows_fluent_bit]
if !windows_fluent_bit_config.nil?
windows_fluent_bit_disabled = windows_fluent_bit_config[:disabled]
if !windows_fluent_bit_disabled.nil? && windows_fluent_bit_disabled.to_s.downcase == "false"
@windows_fluent_bit_disabled = false
end
puts "Using config map value: AZMON_WINDOWS_FLUENT_BIT_DISABLED = #{@windows_fluent_bit_disabled}"
end

network_listener_waittime_config = parsedConfig[:agent_settings][:network_listener_waittime]
if !network_listener_waittime_config.nil?
waittime = network_listener_waittime_config[:tcp_port_25226]
Expand Down Expand Up @@ -549,12 +521,6 @@ def populateSettingValuesFromConfigMap(parsedConfig)
file.write("export AZMON_MULTILINE_ENABLED=#{@multiline_enabled}\n")
end

file.write("export AZMON_RESOURCE_OPTIMIZATION_ENABLED=#{@resource_optimization_enabled}\n")

if !@windows_fluent_bit_disabled
file.write("export AZMON_WINDOWS_FLUENT_BIT_DISABLED=#{@windows_fluent_bit_disabled}\n")
end

file.write("export WAITTIME_PORT_25226=#{@waittime_port_25226}\n")
file.write("export WAITTIME_PORT_25228=#{@waittime_port_25228}\n")
file.write("export WAITTIME_PORT_25229=#{@waittime_port_25229}\n")
Expand Down Expand Up @@ -659,15 +625,6 @@ def get_command_windows(env_variable_name, env_variable_value)
commands = get_command_windows("AZMON_MULTILINE_ENABLED", @multiline_enabled)
file.write(commands)
end
if @resource_optimization_enabled
commands = get_command_windows("AZMON_RESOURCE_OPTIMIZATION_ENABLED", @resource_optimization_enabled)
file.write(commands)
end

if !@windows_fluent_bit_disabled
commands = get_command_windows("AZMON_WINDOWS_FLUENT_BIT_DISABLED", @windows_fluent_bit_disabled)
file.write(commands)
end

commands = get_command_windows("WAITTIME_PORT_25229", @waittime_port_25229)
file.write(commands)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def populateGenevaIntegrationSettings(parsedConfig)
@geneva_account_namespace = ""
@geneva_gcs_region = ""
end
end
end

# Use the ruby structure created after config parsing to set the right values to be used as environment variables
def populateSettingValuesFromConfigMap(parsedConfig)
Expand Down
24 changes: 8 additions & 16 deletions kubernetes/linux/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1098,24 +1098,16 @@ else
fi

if [ "$AZMON_RESOURCE_OPTIMIZATION_ENABLED" != "true" ]; then
# no dependency on fluentd for prometheus side car container
if [ "${CONTAINER_TYPE}" != "PrometheusSidecar" ] && [ "${GENEVA_LOGS_INTEGRATION_SERVICE_MODE}" != "true" ]; then
if [ ! -e "/etc/config/kube.conf" ]; then
if [ "$LOGS_AND_EVENTS_ONLY" != "true" ]; then
echo "*** starting fluentd v1 in daemonset"
if [ "${ENABLE_CUSTOM_METRICS}" == "true" ]; then
mv /etc/fluent/container-cm.conf /etc/fluent/container.conf
fi
fluentd -c /etc/fluent/container.conf -o /var/opt/microsoft/docker-cimprov/log/fluentd.log --log-rotate-age 5 --log-rotate-size 20971520 &
else
echo "Skipping fluentd since LOGS_AND_EVENTS_ONLY is set to true"
fi
else
echo "*** starting fluentd v1 in replicaset"
# no dependency on fluentd for prometheus side car container and linux deamonset
if [ "${CONTAINER_TYPE}" != "PrometheusSidecar" ] && [ "${GENEVA_LOGS_INTEGRATION_SERVICE_MODE}" != "true" ] && [ ! -e "/etc/config/kube.conf" ]; then
if [ "$LOGS_AND_EVENTS_ONLY" != "true" ]; then
echo "*** starting fluentd v1 in daemonset"
if [ "${ENABLE_CUSTOM_METRICS}" == "true" ]; then
mv /etc/fluent/kube-cm.conf /etc/fluent/kube.conf
mv /etc/fluent/container-cm.conf /etc/fluent/container.conf
fi
fluentd -c /etc/fluent/kube.conf -o /var/opt/microsoft/docker-cimprov/log/fluentd.log --log-rotate-age 5 --log-rotate-size 20971520 &
fluentd -c /etc/fluent/container.conf -o /var/opt/microsoft/docker-cimprov/log/fluentd.log --log-rotate-age 5 --log-rotate-size 20971520 &
else
echo "Skipping fluentd since LOGS_AND_EVENTS_ONLY is set to true"
fi
fi
ganga1980 marked this conversation as resolved.
Show resolved Hide resolved
else
Expand Down
Loading