Skip to content

Commit

Permalink
global replace
Browse files Browse the repository at this point in the history
  • Loading branch information
matmerr committed Oct 18, 2023
1 parent c9d49d5 commit c93fbdc
Show file tree
Hide file tree
Showing 10 changed files with 82 additions and 81 deletions.
2 changes: 1 addition & 1 deletion RELEASENOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
* feat: HTTP Proxy for distroless and ARC
* fix: Wait for token adapter to be healthy before starting dependencies
* feat: Add azure policy templates for metrics addon
* feat: enable network monitoring metrics (kappie)
* feat: enable network monitoring metrics (retina)
* feat: AKS addon HTTP Proxy Support
* fix: certificate import for windows ME startup

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
scrape_configs:
- job_name: "retina-basic"
scrape_interval: $$SCRAPE_INTERVAL$$
label_limit: 63
label_name_length_limit: 511
label_value_length_limit: 1023
kubernetes_sd_configs:
- role: service
scheme: http
relabel_configs:
- source_labels:
[__meta_kubernetes_namespace, __meta_kubernetes_service_name]
action: keep
regex: kube-system;retina-svc
- source_labels: [__address__]
target_label: __address__
replacement: "$$NODE_IP$$:10093"
action: replace
- source_labels: [__address__]
replacement: "$$NODE_NAME$$"
target_label: instance
24 changes: 12 additions & 12 deletions otelcollector/configmapparser/prometheus-config-merger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
@windowskubeproxyDefaultDsFile = @defaultPromConfigPathPrefix + "windowskubeproxyDefaultDs.yml"
@podannotationsDefaultFile = @defaultPromConfigPathPrefix + "podannotationsDefault.yml"
@windowskubeproxyDefaultRsAdvancedFile = @defaultPromConfigPathPrefix + "windowskubeproxyDefaultRsAdvanced.yml"
@kappiebasicDefaultFileDs = @defaultPromConfigPathPrefix + "kappieBasicDefaultDs.yml"
@retinabasicDefaultFileDs = @defaultPromConfigPathPrefix + "retinaBasicDefaultDs.yml"

def parseConfigMap
begin
Expand Down Expand Up @@ -315,22 +315,22 @@ def populateDefaultPrometheusConfig
end
end

if !ENV["AZMON_PROMETHEUS_KAPPIEBASIC_SCRAPING_ENABLED"].nil? && ENV["AZMON_PROMETHEUS_KAPPIEBASIC_SCRAPING_ENABLED"].downcase == "true"
kappiebasicMetricsKeepListRegex = @regexHash["KAPPIEBASIC_METRICS_KEEP_LIST_REGEX"]
kappiebasicScrapeInterval = @intervalHash["KAPPIEBASIC_SCRAPE_INTERVAL"]
if !ENV["AZMON_PROMETHEUS_retinaBASIC_SCRAPING_ENABLED"].nil? && ENV["AZMON_PROMETHEUS_retinaBASIC_SCRAPING_ENABLED"].downcase == "true"
retinabasicMetricsKeepListRegex = @regexHash["retinaBASIC_METRICS_KEEP_LIST_REGEX"]
retinabasicScrapeInterval = @intervalHash["retinaBASIC_SCRAPE_INTERVAL"]
if currentControllerType == @replicasetControllerType
#do nothing -- kappie is not supported to be scrapped automatically outside ds. if needed, customer can disable this ds target, and enable rs scraping thru custom config map
else #kappie scraping will be turned ON by default only when in MAC/addon mode (for both windows & linux)
#do nothing -- retina is not supported to be scrapped automatically outside ds. if needed, customer can disable this ds target, and enable rs scraping thru custom config map
else #retina scraping will be turned ON by default only when in MAC/addon mode (for both windows & linux)
if advancedMode == true && !ENV['MAC'].nil? && !ENV['MAC'].empty? && ENV['MAC'].strip.downcase == "true" #&& ENV["OS_TYPE"].downcase == "linux"
UpdateScrapeIntervalConfig(@kappiebasicDefaultFileDs, kappiebasicScrapeInterval)
if !kappiebasicMetricsKeepListRegex.nil? && !kappiebasicMetricsKeepListRegex.empty?
AppendMetricRelabelConfig(@kappiebasicDefaultFileDs, kappiebasicMetricsKeepListRegex)
UpdateScrapeIntervalConfig(@retinabasicDefaultFileDs, retinabasicScrapeInterval)
if !retinabasicMetricsKeepListRegex.nil? && !retinabasicMetricsKeepListRegex.empty?
AppendMetricRelabelConfig(@retinabasicDefaultFileDs, retinabasicMetricsKeepListRegex)
end
contents = File.read(@kappiebasicDefaultFileDs)
contents = File.read(@retinabasicDefaultFileDs)
contents = contents.gsub("$$NODE_IP$$", ENV["NODE_IP"])
contents = contents.gsub("$$NODE_NAME$$", ENV["NODE_NAME"])
File.open(@kappiebasicDefaultFileDs, "w") { |file| file.puts contents }
defaultConfigs.push(@kappiebasicDefaultFileDs)
File.open(@retinabasicDefaultFileDs, "w") { |file| file.puts contents }
defaultConfigs.push(@retinabasicDefaultFileDs)
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
@podannotationEnabled = false
@windowsexporterEnabled = false
@windowskubeproxyEnabled = false
@kappiebasicEnabled = true
@retinabasicEnabled = true
@noDefaultsEnabled = false
@sendDSUpMetric = false

Expand Down Expand Up @@ -89,9 +89,9 @@ def populateSettingValuesFromConfigMap(parsedConfig)
@podannotationEnabled = "true"
puts "config::Using configmap scrape settings for podannotations: #{@podannotationEnabled}"
end
if !parsedConfig[:kappiebasic].nil?
@kappiebasicEnabled = parsedConfig[:kappiebasic]
puts "config::Using configmap scrape settings for kappiebasic: #{@kappiebasicEnabled}"
if !parsedConfig[:retinabasic].nil?
@retinabasicEnabled = parsedConfig[:retinabasic]
puts "config::Using configmap scrape settings for retinabasic: #{@retinabasicEnabled}"
end

windowsDaemonset = false
Expand All @@ -101,9 +101,9 @@ def populateSettingValuesFromConfigMap(parsedConfig)

if ENV["MODE"].nil? && ENV["MODE"].strip.downcase == "advanced"
controllerType = ENV["CONTROLLER_TYPE"]
if controllerType == "DaemonSet" && ENV["OS_TYPE"].downcase == "windows" && !@windowsexporterEnabled && !@windowskubeproxyEnabled && !@kubeletEnabled && !@prometheusCollectorHealthEnabled && !@kappiebasicEnabled
if controllerType == "DaemonSet" && ENV["OS_TYPE"].downcase == "windows" && !@windowsexporterEnabled && !@windowskubeproxyEnabled && !@kubeletEnabled && !@prometheusCollectorHealthEnabled && !@retinabasicEnabled
@noDefaultsEnabled = true
elsif controllerType == "DaemonSet" && ENV["OS_TYPE"].downcase == "linux" && !@kubeletEnabled && !@cadvisorEnabled && !@nodeexporterEnabled && !@prometheusCollectorHealthEnabled && !kappiebasicEnabled
elsif controllerType == "DaemonSet" && ENV["OS_TYPE"].downcase == "linux" && !@kubeletEnabled && !@cadvisorEnabled && !@nodeexporterEnabled && !@prometheusCollectorHealthEnabled && !retinabasicEnabled
@noDefaultsEnabled = true
elsif controllerType == "ReplicaSet" && @sendDsUpMetric && !@kubeletEnabled && !@cadvisorEnabled && !@nodeexporterEnabled && !@corednsEnabled && !@kubeproxyEnabled && !@apiserverEnabled && !@kubestateEnabled && !@windowsexporterEnabled && !@windowskubeproxyEnabled && !@prometheusCollectorHealthEnabled && !@podannotationEnabled
@noDefaultsEnabled = true
Expand All @@ -128,7 +128,7 @@ def populateSettingValuesFromConfigMap(parsedConfig)
ConfigParseErrorLogger.logSection(LOGGING_PREFIX, "Start default-scrape-settings Processing")
# set default targets for MAC mode
if !ENV['MAC'].nil? && !ENV['MAC'].empty? && ENV['MAC'].strip.downcase == "true"
ConfigParseErrorLogger.logWarning(LOGGING_PREFIX, "MAC mode is enabled. Only enabling targets kubestate,cadvisor,kubelet,kappiebasic & nodeexporter for linux before config map processing....")
ConfigParseErrorLogger.logWarning(LOGGING_PREFIX, "MAC mode is enabled. Only enabling targets kubestate,cadvisor,kubelet,retinabasic & nodeexporter for linux before config map processing....")

@corednsEnabled = false
@kubeproxyEnabled = false
Expand Down Expand Up @@ -167,11 +167,11 @@ def populateSettingValuesFromConfigMap(parsedConfig)
file.write($export + "AZMON_PROMETHEUS_COLLECTOR_HEALTH_SCRAPING_ENABLED=#{@prometheusCollectorHealthEnabled}\n")
file.write($export + "AZMON_PROMETHEUS_WINDOWSEXPORTER_SCRAPING_ENABLED=#{@windowsexporterEnabled}\n")
file.write($export + "AZMON_PROMETHEUS_WINDOWSKUBEPROXY_SCRAPING_ENABLED=#{@windowskubeproxyEnabled}\n")
file.write($export + "AZMON_PROMETHEUS_KAPPIEBASIC_SCRAPING_ENABLED=#{@kappiebasicEnabled}\n")
file.write($export + "AZMON_PROMETHEUS_retinaBASIC_SCRAPING_ENABLED=#{@retinabasicEnabled}\n")
file.write($export + "AZMON_PROMETHEUS_POD_ANNOTATION_SCRAPING_ENABLED=#{@podannotationEnabled}\n")
# Close file after writing all metric collection setting environment variables
file.close
else
ConfigParseErrorLogger.logError(LOGGING_PREFIX, "Exception while opening file for writing default-scrape-settings config environment variables")
end
ConfigParseErrorLogger.logSection(LOGGING_PREFIX, "End default-scrape-settings Processing")
ConfigParseErrorLogger.logSection(LOGGING_PREFIX, "End default-scrape-settings Processing")
Loading

0 comments on commit c93fbdc

Please sign in to comment.