Skip to content

Commit

Permalink
Ccp metrics updates (#668)
Browse files Browse the repository at this point in the history
* Testing pending changes

* Adding drop regex to all ccp targets

* Adding deployment files

* Update sidecar image

* Fix missing _

* Remove CCP health endpoint

* Apply feedback from PR

* Align with ccp charts in rp

* Remove change from testing

* Remove change from testing

* Replace with standalone config

---------

Co-authored-by: Nina Segares <[email protected]>
  • Loading branch information
sgeannina and Nina Segares authored Nov 11, 2023
1 parent f744885 commit 89e865a
Show file tree
Hide file tree
Showing 14 changed files with 354 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,8 @@ scrape_configs:
- source_labels: [ __meta_kubernetes_pod_name ]
regex: (.*)
target_label: instance
action: replace
action: replace
metric_relabel_configs:
- source_labels: [ __name__ ]
action: drop
regex: (go_.*|process_(cpu|max|resident|virtual|open)_.*)
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,8 @@ scrape_configs:
- source_labels: [ __meta_kubernetes_pod_name ]
regex: (.*)
target_label: instance
action: replace
action: replace
metric_relabel_configs:
- source_labels: [ __name__ ]
action: drop
regex: (go_.*|process_(cpu|max|resident|virtual|open)_.*)
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,8 @@ scrape_configs:
- source_labels: [__meta_kubernetes_pod_name]
regex: (.*)
target_label: instance
action: replace
action: replace
metric_relabel_configs:
- source_labels: [ __name__ ]
action: drop
regex: (go_.*|process_(cpu|max|resident|virtual|open)_.*)
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,8 @@ scrape_configs:
- source_labels: [__meta_kubernetes_pod_name]
regex: (.*)
target_label: instance
action: replace
action: replace
metric_relabel_configs:
- source_labels: [ __name__ ]
action: drop
regex: (go_.*|process_(cpu|max|resident|virtual|open)_.*)

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
@controlplane_kube_controller_manager_default_file = @defaultPromConfigPathPrefix + "controlplane_kube_controller_manager.yml"
@controlplane_cluster_autoscaler_default_file = @defaultPromConfigPathPrefix + "controlplane_cluster_autoscaler.yml"
@controlplane_etcd_default_file = @defaultPromConfigPathPrefix + "controlplane_etcd.yml"
@controlplane_prometheuscollectorhealth_default_file = @defaultPromConfigPathPrefix + "controlplane_prometheuscollectorhealth.yml"

def loadRegexHash
begin
Expand Down Expand Up @@ -128,10 +127,6 @@ def populateDefaultPrometheusConfig
defaultConfigs.push(@controlplane_etcd_default_file)
end

if !ENV["AZMON_PROMETHEUS_CONTROLPLANE_COLLECTOR_HEALTH_SCRAPING_ENABLED"].nil? && ENV["AZMON_PROMETHEUS_CONTROLPLANE_COLLECTOR_HEALTH_SCRAPING_ENABLED"].downcase == "true"
defaultConfigs.push(@controlplane_prometheuscollectorhealth_default_file)
end

@mergedDefaultConfigs = mergeDefaultScrapeConfigs(defaultConfigs)
rescue => errorStr
ConfigParseErrorLogger.logError(LOGGING_PREFIX, "Exception while merging default scrape targets - #{errorStr}. No default scrape targets will be included")
Expand Down Expand Up @@ -180,7 +175,7 @@ def writeDefaultScrapeTargetsFile()
def setDefaultFileScrapeInterval(scrapeInterval)
defaultFilesArray = [
@controlplane_apiserver_default_file, @controlplane_kube_scheduler_default_file, @controlplane_kube_controller_manager_default_file,
@controlplane_cluster_autoscaler_default_file, @controlplane_etcd_default_file, @controlplane_prometheuscollectorhealth_default_file
@controlplane_cluster_autoscaler_default_file, @controlplane_etcd_default_file
]

defaultFilesArray.each { |currentFile|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
@controlplane_apiserver_enabled = true
@controlplane_cluster_autoscaler_enabled = false
@controlplane_etcd_enabled = true
@controleplane_prometheuscollectorhealth_enabled = false
@noDefaultsEnabled = false

# Use parser to parse the configmap toml file to a ruby structure
Expand Down Expand Up @@ -58,10 +57,6 @@ def populateSettingValuesFromConfigMap(parsedConfig)
@controlplane_etcd_enabled = parsedConfig[:"controlplane-etcd"]
puts "config::Using configmap scrape settings for controlplane-etcd: #{@controlplane_etcd_enabled}"
end
if !parsedConfig[:"controlplane-prometheuscollectorhealth"].nil?
@controleplane_prometheuscollectorhealth_enabled = parsedConfig[:"controlplane-prometheuscollectorhealth"]
puts "config::Using configmap scrape settings for controlplane_prometheuscollectorhealth: #{@controleplane_prometheuscollectorhealth_enabled}"
end

if ENV["MODE"].nil? && ENV["MODE"].strip.downcase == "advanced"
controllerType = ENV["CONTROLLER_TYPE"]
Expand Down Expand Up @@ -109,7 +104,6 @@ def populateSettingValuesFromConfigMap(parsedConfig)
file.write("AZMON_PROMETHEUS_CONTROLPLANE_APISERVER_ENABLED=#{@controlplane_apiserver_enabled}\n")
file.write("AZMON_PROMETHEUS_CONTROLPLANE_CLUSTER_AUTOSCALER_ENABLED=#{@controlplane_cluster_autoscaler_enabled}\n")
file.write("AZMON_PROMETHEUS_CONTROLPLANE_ETCD_ENABLED=#{@controlplane_etcd_enabled}\n")
file.write("AZMON_PROMETHEUS_CONTROLPLANE_COLLECTOR_HEALTH_SCRAPING_ENABLED=#{@controleplane_prometheuscollectorhealth_enabled}\n")
file.write("AZMON_PROMETHEUS_NO_DEFAULT_SCRAPING_ENABLED=#{@noDefaultsEnabled}\n")
# Close file after writing all metric collection setting environment variables
file.close
Expand Down
2 changes: 0 additions & 2 deletions otelcollector/configmaps/ama-metrics-settings-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ data:
controlplane-kube-scheduler = false
controlplane-kube-controller-manager = false
controlplane-etcd = true
controlplane-prometheuscollectorhealth = true
# Regex for which namespaces to scrape through pod annotation based scraping.
# This is none by default. Use '.*' to scrape all namespaces of annotated pods.
pod-annotation-based-scraping: |-
Expand All @@ -48,7 +47,6 @@ data:
controlplane-kube-scheduler = ""
controlplane-kube-controller-manager = ""
controlplane-etcd = ""
controlplane-prometheuscollectorhealth = ""
minimalingestionprofile = true
default-targets-scrape-interval-settings: |-
kubelet = "30s"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: ${HELM_CHART_NAME}
description: A Helm chart for collecting Prometheus metrics in Kubernetes clusters and ingesting to Azure Metrics Account(s)

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: ${IMAGE_TAG}

# This is the version number of the application being deployed (basically, imagetag for the image built/compatible with this chart semver above). This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "${IMAGE_TAG}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: ama-metrics-ccp-reader
rules:
- apiGroups: [""]
resources:
[
"pods",
"nodes",
"nodes/stats",
"nodes/metrics",
"nodes/proxy",
"namespaces",
"services",
"endpoints",
"ingress"
]
verbs: ["list", "get", "watch"]
- apiGroups:
- networking.k8s.io
resources:
- ingresses
verbs: ["list", "get", "watch"]
- apiGroups: [""]
resources: ["secrets"]
resourceNames: ["aad-msi-auth-token"]
verbs: ["get", "watch"]
- nonResourceURLs: ["/metrics"]
verbs: ["get"]
- apiGroups: ["clusterconfig.azure.com"]
resources: ["azureclusteridentityrequests", "azureclusteridentityrequests/status"]
verbs: ["get", "update", "list", "create"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: ama-metrics-clusterrolebinding
subjects:
- kind: ServiceAccount
name: ama-metrics-serviceaccount
namespace: {{ .Values.global.commonGlobals.Customer.Namespace }}
roleRef:
kind: ClusterRole
name: ama-metrics-ccp-reader
apiGroup: rbac.authorization.k8s.io
Loading

0 comments on commit 89e865a

Please sign in to comment.