diff --git a/.github/workflows/run_unit_tests.yml b/.github/workflows/run_unit_tests.yml index 94ac4371a..435de91e8 100644 --- a/.github/workflows/run_unit_tests.yml +++ b/.github/workflows/run_unit_tests.yml @@ -26,7 +26,7 @@ jobs: uses: actions/checkout@v2 - name: install fluent run: | - sudo gem install fluentd -v "1.12.2" --no-document + sudo gem install fluentd -v "1.14.2" --no-document sudo fluentd --setup ./fluent - name: Run unit tests run: | diff --git a/build/common/installer/scripts/tomlparser.rb b/build/common/installer/scripts/tomlparser.rb index 32ea09aa3..03b470205 100644 --- a/build/common/installer/scripts/tomlparser.rb +++ b/build/common/installer/scripts/tomlparser.rb @@ -191,8 +191,6 @@ def populateSettingValuesFromConfigMap(parsedConfig) rescue => errorStr ConfigParseErrorLogger.logError("Exception while reading config map settings for adx database name - #{errorStr}, using default #{@adxDatabaseName}, please check config map for errors") end - - end end end diff --git a/kubernetes/linux/setup.sh b/kubernetes/linux/setup.sh index 243677dd0..5bddfc604 100644 --- a/kubernetes/linux/setup.sh +++ b/kubernetes/linux/setup.sh @@ -52,7 +52,7 @@ sudo echo "deb http://ppa.launchpad.net/brightbox/ruby-ng/ubuntu bionic main" >> sudo apt-get update sudo apt-get install ruby2.6 ruby2.6-dev gcc make -y # fluentd v1 gem -gem install fluentd -v "1.12.2" --no-document +gem install fluentd -v "1.14.2" --no-document fluentd --setup ./fluent gem install gyoku iso8601 --no-doc diff --git a/kubernetes/omsagent.yaml b/kubernetes/omsagent.yaml index 66f8c4010..a1a843196 100644 --- a/kubernetes/omsagent.yaml +++ b/kubernetes/omsagent.yaml @@ -927,3 +927,4 @@ spec: names: plural: healthstates kind: HealthState + \ No newline at end of file diff --git a/kubernetes/windows/Dockerfile b/kubernetes/windows/Dockerfile index 0ddf67ab2..41ad7e7ba 100644 --- a/kubernetes/windows/Dockerfile +++ b/kubernetes/windows/Dockerfile @@ -20,7 +20,7 @@ RUN refreshenv \ && gem install cool.io -v 1.5.4 --platform ruby \ && gem install oj -v 3.3.10 \ && gem install json -v 2.2.0 \ -&& gem install fluentd -v 1.12.2 \ +&& gem install fluentd -v 1.14.2 \ && gem install win32-service -v 1.0.1 \ && gem install win32-ipc -v 0.7.0 \ && gem install win32-event -v 0.6.3 \ diff --git a/kubernetes/windows/Dockerfile-dev-base-image b/kubernetes/windows/Dockerfile-dev-base-image index 0081f9c53..501fead89 100644 --- a/kubernetes/windows/Dockerfile-dev-base-image +++ b/kubernetes/windows/Dockerfile-dev-base-image @@ -18,7 +18,7 @@ RUN refreshenv \ && gem install cool.io -v 1.5.4 --platform ruby \ && gem install oj -v 3.3.10 \ && gem install json -v 2.2.0 \ -&& gem install fluentd -v 1.12.2 \ +&& gem install fluentd -v 1.14.2 \ && gem install win32-service -v 1.0.1 \ && gem install win32-ipc -v 0.7.0 \ && gem install win32-event -v 0.6.3 \ diff --git a/source/plugins/ruby/kubelet_utils.rb b/source/plugins/ruby/kubelet_utils.rb index e31407b54..368ca8639 100644 --- a/source/plugins/ruby/kubelet_utils.rb +++ b/source/plugins/ruby/kubelet_utils.rb @@ -47,6 +47,9 @@ def get_node_allocatable(cpu_capacity, memory_capacity) @log.error "kubelet_utils.rb::get_node_allocatble - cpu_capacity or memory_capacity values not set. Hence we cannot calculate allocatable values" end + cpu_capacity = BigDecimal(cpu_capacity, 2).to_f + memory_capacity = BigDecimal(memory_capacity, 2).to_f + cpu_allocatable = 1.0 memory_allocatable = 1.0 @@ -56,74 +59,74 @@ def get_node_allocatable(cpu_capacity, memory_capacity) begin kubereserved_cpu = parsed_response["kubeletconfig"]["kubeReserved"]["cpu"] if kubereserved_cpu.nil? || kubereserved_cpu == "" - kubereserved_cpu = "0" + kubereserved_cpu = "0.0" end @log.info "get_node_allocatable::kubereserved_cpu #{kubereserved_cpu}" rescue => errorStr @log.error "Error in get_node_allocatable::kubereserved_cpu: #{errorStr}" - kubereserved_cpu = "0" + kubereserved_cpu = "0.0" ApplicationInsightsUtility.sendExceptionTelemetry("Error in get_node_allocatable::kubereserved_cpu: #{errorStr}") end begin kubereserved_memory = parsed_response["kubeletconfig"]["kubeReserved"]["memory"] if kubereserved_memory.nil? || kubereserved_memory == "" - kubereserved_memory = "0" + kubereserved_memory = "0.0" end @log.info "get_node_allocatable::kubereserved_memory #{kubereserved_memory}" rescue => errorStr @log.error "Error in get_node_allocatable::kubereserved_memory: #{errorStr}" - kubereserved_memory = "0" - ApplicationInsightsUtility.sendExceptionTelemetry("Error in get_node_allocatable::kubereserved_cpu: #{errorStr}") + kubereserved_memory = "0.0" + ApplicationInsightsUtility.sendExceptionTelemetry("Error in get_node_allocatable::kubereserved_memory: #{errorStr}") end begin systemReserved_cpu = parsed_response["kubeletconfig"]["systemReserved"]["cpu"] if systemReserved_cpu.nil? || systemReserved_cpu == "" - systemReserved_cpu = "0" + systemReserved_cpu = "0.0" end @log.info "get_node_allocatable::systemReserved_cpu #{systemReserved_cpu}" rescue => errorStr # this will likely always reach this condition for AKS ~ only applicable for hyrid + MDM combination @log.error "Error in get_node_allocatable::systemReserved_cpu: #{errorStr}" - systemReserved_cpu = "0" - ApplicationInsightsUtility.sendExceptionTelemetry("Error in get_node_allocatable::kubereserved_cpu: #{errorStr}") + systemReserved_cpu = "0.0" + ApplicationInsightsUtility.sendExceptionTelemetry("Error in get_node_allocatable::systemReserved_cpu: #{errorStr}") end begin explicitlyReserved_cpu = parsed_response["kubeletconfig"]["reservedCPUs"] if explicitlyReserved_cpu.nil? || explicitlyReserved_cpu == "" - explicitlyReserved_cpu = "0" + explicitlyReserved_cpu = "0.0" end @log.info "get_node_allocatable::explicitlyReserved_cpu #{explicitlyReserved_cpu}" rescue => errorStr # this will likely always reach this condition for AKS ~ only applicable for hyrid + MDM combination @log.error "Error in get_node_allocatable::explicitlyReserved_cpu: #{errorStr}" - explicitlyReserved_cpu = "0" + explicitlyReserved_cpu = "0.0" ApplicationInsightsUtility.sendExceptionTelemetry("Error in get_node_allocatable::explicitlyReserved_cpu: #{errorStr}") end begin systemReserved_memory = parsed_response["kubeletconfig"]["systemReserved"]["memory"] if systemReserved_memory.nil? || systemReserved_memory == "" - systemReserved_memory = "0" + systemReserved_memory = "0.0" end @log.info "get_node_allocatable::systemReserved_memory #{systemReserved_memory}" rescue => errorStr @log.error "Error in get_node_allocatable::systemReserved_memory: #{errorStr}" - systemReserved_memory = "0" - ApplicationInsightsUtility.sendExceptionTelemetry("Error in get_node_allocatable::kubereserved_cpu: #{errorStr}") + systemReserved_memory = "0.0" + ApplicationInsightsUtility.sendExceptionTelemetry("Error in get_node_allocatable::systemReserved_memory: #{errorStr}") end begin evictionHard_memory = parsed_response["kubeletconfig"]["evictionHard"]["memory.available"] if evictionHard_memory.nil? || evictionHard_memory == "" - evictionHard_memory = "0" + evictionHard_memory = "0.0" end @log.info "get_node_allocatable::evictionHard_memory #{evictionHard_memory}" rescue => errorStr @log.error "Error in get_node_allocatable::evictionHard_memory: #{errorStr}" - evictionHard_memory = "0" - ApplicationInsightsUtility.sendExceptionTelemetry("Error in get_node_allocatable::kubereserved_cpu: #{errorStr}") + evictionHard_memory = "0.0" + ApplicationInsightsUtility.sendExceptionTelemetry("Error in get_node_allocatable::evictionHard_memory: #{errorStr}") end # do calculation in nanocore since that's what KubernetesApiClient.getMetricNumericValue expects @@ -137,9 +140,13 @@ def get_node_allocatable(cpu_capacity, memory_capacity) end # convert back to units similar to what we get for capacity cpu_allocatable = cpu_allocatable / (1000.0 ** 2) - @log.info "CPU Allocatable #{cpu_allocatable}" memory_allocatable = memory_capacity - (KubernetesApiClient.getMetricNumericValue("memory", kubereserved_memory) + KubernetesApiClient.getMetricNumericValue("memory", systemReserved_memory) + KubernetesApiClient.getMetricNumericValue("memory", evictionHard_memory)) + + cpu_allocatable = BigDecimal(cpu_allocatable, 2).to_f + memory_allocatable = BigDecimal(memory_allocatable, 2).to_f + + @log.info "CPU Allocatable #{cpu_allocatable}" @log.info "Memory Allocatable #{memory_allocatable}" return [cpu_allocatable, memory_allocatable]