Skip to content

Commit

Permalink
feat: Enhance metrics exporter with monitoring labels and environment…
Browse files Browse the repository at this point in the history
… variable configurations
  • Loading branch information
jordancarrier committed Jan 8, 2025
1 parent f819797 commit 93c26ee
Show file tree
Hide file tree
Showing 9 changed files with 500 additions and 16 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@ terraform-plugins
kubeconfig_*
generated
.external_modules
**.tgz
6 changes: 3 additions & 3 deletions charts/armonik/Chart.lock
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ dependencies:
version: 9.0.3
- name: prometheus
repository: https://charts.bitnami.com/bitnami
version: 1.3.29
version: 1.4.0
- name: rabbitmq
repository: https://charts.bitnami.com/bitnami
version: 15.1.0
Expand Down Expand Up @@ -62,5 +62,5 @@ dependencies:
- name: seq
repository: https://cloudnativeapp.github.io/charts/curated/
version: 1.0.0
digest: sha256:992f948c8d2bf22c113499908321546d67af938638b906f1f031024a3d673963
generated: "2025-01-06T13:55:05.663182+01:00"
digest: sha256:24507204549c1f2d37fe42d996b4c0cfd79e59757d755f30e1dd944a81c4b173
generated: "2025-01-08T11:43:03.099967+01:00"
2 changes: 1 addition & 1 deletion charts/armonik/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ dependencies:
repository: https://charts.bitnami.com/bitnami
condition: mongodb-sharded.enabled
- name: prometheus
version: 1.3.29
version: 1.4.0
repository: https://charts.bitnami.com/bitnami
condition: prometheus.enabled
- name: rabbitmq
Expand Down
95 changes: 95 additions & 0 deletions charts/armonik/charts/ingress/templates/metrics-exporter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: armonik
service: metrics-exporter
type: monitoring
name: metrics-exporter
namespace: {{ .Values.global.namespace }}
spec:
selector:
matchLabels:
app: armonik
service: metrics-exporter
type: monitoring
template:
metadata:
labels:
app: armonik
service: metrics-exporter
type: monitoring
name: metrics-exporter
namespace: {{ .Values.global.namespace }}
spec:
automountServiceAccountToken: true
containers:
- image: {{ .Values.global.registry }}/armonik_control_metrics:0.14.3
imagePullPolicy: IfNotPresent
name: metrics-exporter
ports:
- containerPort: 1080
name: metrics
protocol: TCP
envFrom:
- configMapRef:
name: core-configmap
optional: false
- configMapRef:
name: log-configmap
optional: false
- secretRef:
name: activemq
optional: false
#terminationMessagePath: /dev/termination-log
#terminationMessagePolicy: File
dnsPolicy: ClusterFirst
enableServiceLinks: true
{{- if .Values.nodeSelector -}}
nodeSelector:
service: {{ .Values.nodeSelector }}
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
shareProcessNamespace: false
terminationGracePeriodSeconds: 30
tolerations:
- effect: NoSchedule
key: service
operator: Equal
value: metrics
{{- end }}
---
apiVersion: v1
kind: Service
metadata:
labels:
app: armonik
service: metrics-exporter
type: monitoring
name: metrics-exporter
namespace: {{ .Values.global.namespace }}
spec:
selector:
app: armonik
service: metrics-exporter
type: monitoring
ports:
- name: metrics-exporter
port: 9419
protocol: TCP
targetPort: 1080
---
apiVersion: v1
kind: ConfigMap
metadata:
labels:
app: armonik
service: metrics-exporter
type: monitoring
name: metrics-exporter-configmap
namespace: {{ .Values.global.namespace }}
data:
Host: "localhost"
Port: "1080"
Path: "/metrics"
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: armonik
service: partition-metrics-exporter
type: monitoring
name: partition-metrics-exporter
namespace: {{ .Values.global.namespace }}
spec:
selector:
matchLabels:
app: armonik
service: partition-metrics-exporter
type: monitoring
template:
metadata:
labels:
app: armonik
service: partition-metrics-exporter
type: monitoring
name: partition-metrics-exporter
namespace: {{ .Values.global.namespace }}
spec:
automountServiceAccountToken: true
containers:
- image: {{ .Values.global.registry }}/armonik_control_partition_metrics:0.14.3
imagePullPolicy: IfNotPresent
name: partition-metrics-exporter
ports:
- containerPort: 1080
name: metrics
protocol: TCP
envFrom:
- configMapRef:
name: core-configmap
optional: false
- configMapRef:
name: log-configmap
optional: false
- secretRef:
name: activemq
optional: false
#terminationMessagePath: /dev/termination-log
#terminationMessagePolicy: File
dnsPolicy: ClusterFirst
enableServiceLinks: true
{{- if .Values.nodeSelector -}}
nodeSelector:
service: {{ .Values.nodeSelector }}
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
shareProcessNamespace: false
terminationGracePeriodSeconds: 30
tolerations:
- effect: NoSchedule
key: service
operator: Equal
value: metrics
{{- end }}
---
apiVersion: v1
kind: Service
metadata:
labels:
app: armonik
service: partition-metrics-exporter
type: monitoring
name: partition-metrics-exporter
namespace: {{ .Values.global.namespace }}
spec:
selector:
app: armonik
service: partition-metrics-exporter
type: monitoring
ports:
- name: partition-metrics-exporter
port: 9420
protocol: TCP
targetPort: 1080
---
apiVersion: v1
kind: ConfigMap
metadata:
labels:
app: armonik
service: partition-metrics-exporter
type: monitoring
name: partition-metrics-exporter-configmap
namespace: {{ .Values.global.namespace }}
data:
Host: "localhost"
Port: "1080"
Path: "/metrics"
2 changes: 1 addition & 1 deletion charts/armonik/charts/ingress/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ namespace: "armonik"
replicaCount: 1

global:
registry: dockerhubaneo
registry: dockerhubaneo
namespace: "armonik"
app:
name: my-app
Expand Down
141 changes: 141 additions & 0 deletions charts/armonik/prometheus-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
- job_name: "metrics-exporter"
static_configs:
- targets: ["http://metrics-exporter.{{ .Release.Namespace }}.svc.cluster.local"]
labels:
namespace: "armonik"

- job_name: "mongodb-metrics-exporter"
static_configs:
- targets: ["http://mongodb.{{ .Release.Namespace }}.svc.cluster.local"]
labels:
namespace: "armonik"
metrics_path: /metrics
scheme: http

- job_name: "kubernetes-apiservers"
kubernetes_sd_configs:
- role: endpoints
scheme: https
tls_config:
ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
relabel_configs:
- source_labels: [__meta_kubernetes_namespace, __meta_kubernetes_service_name, __meta_kubernetes_endpoint_port_name]
action: keep
regex: default;kubernetes;https
- source_labels: [__meta_kubernetes_pod_name]
action: replace
target_label: kubernetes_pod_name
- source_labels: [__meta_kubernetes_pod_node_name]
action: replace
target_label: kubernetes_pod_node_name

- job_name: "kubernetes-pods"
kubernetes_sd_configs:
- role: pod
relabel_configs:
- source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape]
action: keep
regex: true
- source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_path]
action: replace
target_label: __metrics_path__
regex: (.+)
- source_labels: [__address__, __meta_kubernetes_pod_annotation_prometheus_io_port]
action: replace
regex: ([^:]+)(?::\d+)?;(\d+)
replacement: $1:$2
target_label: __address__
- action: labelmap
regex: __meta_kubernetes_pod_label_(.+)
- source_labels: [__meta_kubernetes_namespace]
action: replace
target_label: kubernetes_namespace
- source_labels: [__meta_kubernetes_pod_name]
action: replace
target_label: kubernetes_pod_name
- source_labels: [__meta_kubernetes_pod_node_name]
action: replace
target_label: kubernetes_pod_node_name

- job_name: "kubernetes-cadvisor"
kubernetes_sd_configs:
- role: node
scheme: https
tls_config:
ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
metrics_path: /metrics/cadvisor
relabel_configs:
- action: labelmap
regex: __meta_kubernetes_node_label_(.+)

- job_name: "kubernetes-resource"
kubernetes_sd_configs:
- role: node
scheme: https
tls_config:
ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
metrics_path: /metrics/resource
relabel_configs:
- action: labelmap
regex: __meta_kubernetes_node_label_(.+)

- job_name: "kubernetes-probes"
kubernetes_sd_configs:
- role: node
scheme: https
tls_config:
ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
metrics_path: /metrics/probes
relabel_configs:
- action: labelmap
regex: __meta_kubernetes_node_label_(.+)

- job_name: 'metrics-control-plane'
kubernetes_sd_configs:
- role: pod
relabel_configs:
- source_labels: [__meta_kubernetes_pod_container_port_number]
action: keep
regex: "1081"
- source_labels: [__meta_kubernetes_pod_label_app]
action: keep
regex: "armonik"
- source_labels: [__meta_kubernetes_pod_label_service]
action: keep
regex: "control-plane"
- source_labels: [__meta_kubernetes_namespace]
action: replace
target_label: kubernetes_namespace
- source_labels: [__meta_kubernetes_pod_node_name]
action: replace
target_label: kubernetes_pod_node_name
- source_labels: [__meta_kubernetes_pod_name]
action: replace
target_label: kubernetes_pod_name

- job_name: 'metrics-polling-agent'
kubernetes_sd_configs:
- role: pod
relabel_configs:
- source_labels: [__meta_kubernetes_pod_container_port_number]
action: keep
regex: "1080"
- source_labels: [__meta_kubernetes_pod_label_app]
action: keep
regex: "armonik"
- source_labels: [__meta_kubernetes_pod_label_service]
action: keep
regex: "compute-plane"
- source_labels: [__meta_kubernetes_namespace]
action: replace
target_label: kubernetes_namespace
- source_labels: [__meta_kubernetes_pod_node_name]
action: replace
target_label: kubernetes_pod_node_name
- source_labels: [__meta_kubernetes_pod_name]
action: replace
target_label: kubernetes_pod_name
8 changes: 4 additions & 4 deletions charts/armonik/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ArmoniK endpoint URLs
control_plane_url = module.armonik.endpoint_urls.control_plane_url
grafana_url = module.armonik.endpoint_urls.grafana_url
seq_web_url = module.armonik.endpoint_urls.seq_web_url
admin_app_url = module.armonik.endpoint_urls.admin_app_url
control_plane_url = http://control-plane.{{ .Release.Namespace }}.svc.cluster.local
grafana_url = http://grafana.{{ .Release.Namespace }}.svc.cluster.local
seq_web_url = http://seq.{{ .Release.Namespace }}.svc.cluster.local
admin_app_url = http://admin-gui.{{ .Release.Namespace }}.svc.cluster.local
Loading

0 comments on commit 93c26ee

Please sign in to comment.