2023-05-13 08:38:33 +00:00
|
|
|
{{- define "_kube-prometheus-stack" }}
|
|
|
|
|
|
|
|
{{- if .global.aws }}
|
|
|
|
alertmanager:
|
2023-05-17 08:34:12 +00:00
|
|
|
alertmanagerSpec:
|
|
|
|
podMetadata:
|
|
|
|
annotations:
|
|
|
|
kubezero.com/sns_forwarder_ARN_PREFIX: "arn:aws:sns:{{ .global.aws.region }}:{{ .global.aws.accountId }}:"
|
|
|
|
kubezero.com/sns_forwarder_AWS_ROLE_ARN: "arn:aws:iam::{{ .global.aws.accountId }}:role/{{ .global.aws.region }}.{{ .global.clusterName }}.alertmanager"
|
2023-05-13 08:38:33 +00:00
|
|
|
config:
|
|
|
|
receivers:
|
|
|
|
- name: 'null'
|
|
|
|
- name: alerthub-notifications
|
|
|
|
webhook_configs:
|
|
|
|
- send_resolved: true
|
|
|
|
url: http://localhost:9087/alert/AlertHub
|
|
|
|
route:
|
|
|
|
receiver: alerthub-notifications
|
|
|
|
prometheus:
|
|
|
|
prometheusSpec:
|
|
|
|
externalLabels:
|
|
|
|
awsAccount: '{{ .global.aws.accountId }}'
|
|
|
|
awsRegion: {{ .global.aws.region }}
|
|
|
|
clusterName: {{ .global.clusterName }}
|
2023-05-17 08:34:12 +00:00
|
|
|
containers:
|
|
|
|
- name: prometheus
|
|
|
|
env:
|
|
|
|
- name: AWS_ROLE_ARN
|
|
|
|
value: "arn:aws:iam::{{ .global.aws.accountId }}:role/{{ .global.aws.region }}.{{ .global.clusterName }}.prometheus"
|
|
|
|
- name: AWS_WEB_IDENTITY_TOKEN_FILE
|
|
|
|
value: "/var/run/secrets/sts.amazonaws.com/serviceaccount/token"
|
|
|
|
- name: AWS_STS_REGIONAL_ENDPOINTS
|
|
|
|
value: regional
|
2023-05-13 08:38:33 +00:00
|
|
|
volumes:
|
|
|
|
- name: aws-token
|
|
|
|
projected:
|
|
|
|
sources:
|
|
|
|
- serviceAccountToken:
|
|
|
|
path: token
|
|
|
|
expirationSeconds: 86400
|
|
|
|
audience: "sts.amazonaws.com"
|
|
|
|
volumeMounts:
|
|
|
|
- name: aws-token
|
|
|
|
mountPath: "/var/run/secrets/sts.amazonaws.com/serviceaccount/"
|
|
|
|
readOnly: true
|
|
|
|
additionalScrapeConfigs:
|
2023-05-25 20:44:02 +00:00
|
|
|
- job_name: 'crio'
|
|
|
|
ec2_sd_configs:
|
|
|
|
- port: 9090
|
|
|
|
region: {{ .global.aws.region }}
|
|
|
|
filters:
|
|
|
|
- name: 'tag-key'
|
|
|
|
values: ['zdt:prometheus.crio']
|
|
|
|
relabel_configs:
|
|
|
|
- source_labels:
|
|
|
|
- '__meta_ec2_instance_id'
|
|
|
|
target_label: 'instance_id'
|
|
|
|
- source_labels:
|
|
|
|
- '__meta_ec2_availability_zone'
|
|
|
|
target_label: 'availability_zone'
|
|
|
|
- source_labels:
|
|
|
|
- '__meta_ec2_private_dns_name'
|
|
|
|
target_label: 'instance'
|
|
|
|
- source_labels:
|
|
|
|
- '__meta_ec2_tag_Name'
|
|
|
|
target_label: 'instance'
|
2023-05-13 08:38:33 +00:00
|
|
|
- job_name: 'nodes'
|
|
|
|
ec2_sd_configs:
|
|
|
|
- port: 9100
|
|
|
|
region: {{ .global.aws.region }}
|
|
|
|
filters:
|
|
|
|
- name: 'tag-key'
|
|
|
|
values: ['zdt:prometheus.node-exporter']
|
|
|
|
relabel_configs:
|
|
|
|
- source_labels:
|
|
|
|
- '__meta_ec2_instance_id'
|
|
|
|
target_label: 'instance_id'
|
|
|
|
- source_labels:
|
|
|
|
- '__meta_ec2_availability_zone'
|
|
|
|
target_label: 'availability_zone'
|
|
|
|
- source_labels:
|
|
|
|
- '__meta_ec2_private_dns_name'
|
|
|
|
target_label: 'instance'
|
|
|
|
- source_labels:
|
|
|
|
- '__meta_ec2_tag_Name'
|
|
|
|
target_label: 'instance'
|
2023-05-25 20:44:02 +00:00
|
|
|
- job_name: 'docker-registry'
|
|
|
|
ec2_sd_configs:
|
|
|
|
- port: 9101
|
|
|
|
region: {{ .global.aws.region }}
|
|
|
|
filters:
|
|
|
|
- name: 'tag-key'
|
|
|
|
values: ['zdt:prometheus.docker-registry']
|
|
|
|
relabel_configs:
|
|
|
|
- source_labels:
|
|
|
|
- '__meta_ec2_instance_id'
|
|
|
|
target_label: 'instance_id'
|
|
|
|
- source_labels:
|
|
|
|
- '__meta_ec2_availability_zone'
|
|
|
|
target_label: 'availability_zone'
|
|
|
|
- source_labels:
|
|
|
|
- '__meta_ec2_private_dns_name'
|
|
|
|
target_label: 'instance'
|
|
|
|
- source_labels:
|
|
|
|
- '__meta_ec2_tag_Name'
|
|
|
|
target_label: 'instance'
|
|
|
|
{{- with .metrics.kubezero.prometheus.prometheusSpec.additionalScrapeConfigs }}
|
|
|
|
{{- toYaml . | nindent 6 }}
|
|
|
|
{{- end }}
|
2023-05-13 08:38:33 +00:00
|
|
|
{{- end }}
|
|
|
|
|
|
|
|
{{- end }}
|
|
|
|
|
|
|
|
|
2020-11-26 13:21:10 +00:00
|
|
|
{{- define "metrics-values" }}
|
|
|
|
|
2020-12-02 11:53:19 +00:00
|
|
|
{{- with .Values.metrics.istio }}
|
|
|
|
istio:
|
2021-05-05 11:11:16 +00:00
|
|
|
{{- toYaml . | nindent 2 }}
|
2020-11-26 13:21:10 +00:00
|
|
|
{{- end }}
|
2021-07-21 13:15:47 +00:00
|
|
|
{{- with index .Values "metrics" "kube-prometheus-stack" }}
|
2020-11-26 13:21:10 +00:00
|
|
|
kube-prometheus-stack:
|
2023-05-13 08:38:33 +00:00
|
|
|
{{- toYaml ( merge ( include "_kube-prometheus-stack" $.Values | fromYaml ) . ) | nindent 2 }}
|
2020-11-26 13:21:10 +00:00
|
|
|
{{- end }}
|
2021-07-21 13:15:47 +00:00
|
|
|
{{- with index .Values "metrics" "prometheus-adapter" }}
|
2021-01-21 12:31:06 +00:00
|
|
|
prometheus-adapter:
|
|
|
|
{{- toYaml . | nindent 2 }}
|
2021-07-21 13:15:47 +00:00
|
|
|
{{- end }}
|
|
|
|
{{- with index .Values "metrics" "prometheus-pushgateway" }}
|
|
|
|
prometheus-pushgateway:
|
|
|
|
{{- toYaml . | nindent 2 }}
|
2021-01-21 12:31:06 +00:00
|
|
|
{{- end }}
|
2020-11-26 13:21:10 +00:00
|
|
|
|
|
|
|
{{- end }}
|
|
|
|
|
|
|
|
|
|
|
|
{{- define "metrics-argo" }}
|
2020-11-24 15:29:38 +00:00
|
|
|
|
|
|
|
ignoreDifferences:
|
|
|
|
- group: admissionregistration.k8s.io
|
|
|
|
kind: ValidatingWebhookConfiguration
|
|
|
|
jsonPointers:
|
|
|
|
- /webhooks/0/failurePolicy
|
|
|
|
- group: admissionregistration.k8s.io
|
|
|
|
kind: MutatingWebhookConfiguration
|
|
|
|
jsonPointers:
|
|
|
|
- /webhooks/0/failurePolicy
|
|
|
|
|
2020-07-30 17:18:32 +00:00
|
|
|
{{- end }}
|
2020-11-26 13:21:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
{{ include "kubezero-app.app" . }}
|