forked from prometheus-community/helm-charts
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from wrongerror/main
[prometheus-node-exporter] Integrate process-exporter and calico-exporter
- Loading branch information
Showing
33 changed files
with
1,703 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# Chart dependencies | ||
/charts/*/charts | ||
#/charts/*/charts | ||
.idea | ||
.vscode | ||
ks-prometheus/jsonnetfile.lock.json | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
charts/prometheus-node-exporter/charts/calico-exporter/.helmignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Patterns to ignore when building packages. | ||
# This supports shell glob matching, relative path matching, and | ||
# negation (prefixed with !). Only one pattern per line. | ||
.DS_Store | ||
# Common VCS dirs | ||
.git/ | ||
.gitignore | ||
.bzr/ | ||
.bzrignore | ||
.hg/ | ||
.hgignore | ||
.svn/ | ||
# Common backup files | ||
*.swp | ||
*.bak | ||
*.tmp | ||
*.orig | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ |
32 changes: 32 additions & 0 deletions
32
charts/prometheus-node-exporter/charts/calico-exporter/Chart.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
apiVersion: v2 | ||
name: CalicoExporter | ||
description: A Helm chart for Calico Exporter on Kubernetes | ||
# Specify the Kubernetes version range that we support. | ||
# We allow pre-release versions for cloud-specific Kubernetes versions such as v1.21.5-gke.1302 or v1.18.9-eks-d1db3c | ||
kubeVersion: ">=v1.19.0-0" | ||
# 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: 0.2.0 | ||
# This is the version number of the application being deployed. 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: "0.2.0" | ||
keywords: | ||
- calico | ||
- prometheus | ||
- exporter | ||
maintainers: | ||
- email: [email protected] | ||
name: wangyifei | ||
|
1 change: 1 addition & 0 deletions
1
charts/prometheus-node-exporter/charts/calico-exporter/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# calico-exporter |
56 changes: 56 additions & 0 deletions
56
charts/prometheus-node-exporter/charts/calico-exporter/rules/calico.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
apiVersion: alerting.kubesphere.io/v2beta1 | ||
kind: GlobalRuleGroup | ||
metadata: | ||
annotations: | ||
alerting.kubesphere.io/initial-configuration: | | ||
{"apiVersion":"alerting.kubesphere.io/v2beta1","kind":"GlobalRuleGroup","metadata":{"annotations":{},"labels":{"alerting.kubesphere.io/builtin":"true","alerting.kubesphere.io/enable":"true"},"name":"calico-bgp"},"spec":{"rules":[{"alert":"CalicoBGPRouterDown","annotations":{"description":"Calico BGP router {{ $labels.instance }} ({{ $labels.router_id }}) is down.","runbook_url":"https://alert-runbooks.kubesphere.io/runbooks/calico/calicobgprouterdown","summary":"Calico BGP router is down."},"expr":"calico_bgp_router_info{up=\"false\"} == 1\n","for":"5m","labels":{"rule_id":"6a9f0b8a4c7e4c9d8f3b5a6c0d8f9e7b"},"severity":"critical"},{"alert":"CalicoBGPPeerStateAbnormal","annotations":{"description":"Calico BGP peer {{ $labels.name }} ({{ $labels.ip }}) is not in established state.","runbook_url":"https://alert-runbooks.kubesphere.io/runbooks/calico/calicobgppeerstateabnormal","summary":"Calico BGP peer state is abnormal."},"expr":"calico_bgp_peer_info{bgp_state!=\"Established\"} == 1\n","for":"5m","labels":{"rule_id":"8f7c4f0a9d6a4b0c9f3a7b8c6d7f8e9c"},"severity":"warning"},{"alert":"CalicoBGPPeerBirdStateDown","annotations":{"description":"Calico BGP peer {{ $labels.name }} ({{ $labels.ip }}) has bird state down.","runbook_url":"https://alert-runbooks.kubesphere.io/runbooks/calico/calicobgppeerbirdstatedown","summary":"Calico BGP peer bird state is down."},"expr":"calico_bgp_peer_info{bird_state!=\"up\"} == 1\n","for":"5m","labels":{"rule_id":"9d6b4e1a8c7b4c0d8f3b7a6c0d8f9e7d"},"severity":"critical"},{"alert":"CalicoIPPoolUsageHigh","annotations":{"description":"Calico IP pool {{ $labels.name }} ({{ $labels.cidr }}) has {{ $value | humanizePercentage }} of IPs allocated.","runbook_url":"https://alert-runbooks.kubesphere.io/runbooks/calico/calicopoolusagehigh","summary":"Calico IP pool usage is high."},"expr":"calico_ippool_allocated_ips / calico_ippool_capacity \u003e= 0.9\n","for":"5m","labels":{"rule_id":"a7b8c9d0e1f2g3h4i5j6k7l8m9n0o1p2"},"severity":"warning"}]}} | ||
labels: | ||
alerting.kubesphere.io/builtin: "true" | ||
alerting.kubesphere.io/enable: "true" | ||
name: calico-exporter-rules | ||
spec: | ||
rules: | ||
- alert: CalicoBGPRouterDown | ||
annotations: | ||
description: 'Calico BGP router {{ $labels.instance }} ({{ $labels.router_id }}) is down.' | ||
runbook_url: https://alert-runbooks.kubesphere.io/runbooks/calico/calicobgprouterdown | ||
summary: Calico BGP router is down. | ||
expr: | | ||
calico_bgp_router_info{up="false"} == 1 | ||
for: 5m | ||
labels: | ||
rule_id: 6a9f0b8a4c7e4c9d8f3b5a6c0d8f9e7b | ||
severity: critical | ||
- alert: CalicoBGPPeerStateAbnormal | ||
annotations: | ||
description: 'Calico BGP peer {{ $labels.name }} ({{ $labels.ip }}) is not in established state.' | ||
runbook_url: https://alert-runbooks.kubesphere.io/runbooks/calico/calicobgppeerstateabnormal | ||
summary: Calico BGP peer state is abnormal. | ||
expr: | | ||
calico_bgp_peer_info{bgp_state!="Established"} == 1 | ||
for: 5m | ||
labels: | ||
rule_id: 8f7c4f0a9d6a4b0c9f3a7b8c6d7f8e9c | ||
severity: warning | ||
- alert: CalicoBGPPeerBirdStateDown | ||
annotations: | ||
description: 'Calico BGP peer {{ $labels.name }} ({{ $labels.ip }}) has bird state down.' | ||
runbook_url: https://alert-runbooks.kubesphere.io/runbooks/calico/calicobgppeerbirdstatedown | ||
summary: Calico BGP peer bird state is down. | ||
expr: | | ||
calico_bgp_peer_info{bird_state!="up"} == 1 | ||
for: 5m | ||
labels: | ||
rule_id: 9d6b4e1a8c7b4c0d8f3b7a6c0d8f9e7d | ||
severity: critical | ||
- alert: CalicoIPPoolUsageHigh | ||
annotations: | ||
description: 'Calico IP pool {{ $labels.name }} ({{ $labels.cidr }}) has {{ $value | humanizePercentage }} of IPs allocated.' | ||
runbook_url: https://alert-runbooks.kubesphere.io/runbooks/calico/calicopoolusagehigh | ||
summary: Calico IP pool usage is high. | ||
expr: | | ||
calico_ippool_allocated_ips / calico_ippool_capacity >= 0.9 | ||
for: 5m | ||
labels: | ||
rule_id: a7b8c9d0e1f2g3h4i5j6k7l8m9n0o1p2 | ||
severity: warning |
150 changes: 150 additions & 0 deletions
150
charts/prometheus-node-exporter/charts/calico-exporter/templates/_capabilities.tpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
{{/* vim: set filetype=mustache: */}} | ||
|
||
{{/* | ||
Return the target Kubernetes version | ||
*/}} | ||
{{- define "common.capabilities.kubeVersion" -}} | ||
{{- if .Values.global }} | ||
{{- if .Values.global.kubeVersion }} | ||
{{- .Values.global.kubeVersion -}} | ||
{{- else }} | ||
{{- default .Capabilities.KubeVersion.Version .Values.kubeVersion -}} | ||
{{- end -}} | ||
{{- else }} | ||
{{- default .Capabilities.KubeVersion.Version .Values.kubeVersion -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return the appropriate apiVersion for poddisruptionbudget. | ||
*/}} | ||
{{- define "common.capabilities.policy.apiVersion" -}} | ||
{{- if semverCompare "<1.21-0" (include "common.capabilities.kubeVersion" .) -}} | ||
{{- print "policy/v1beta1" -}} | ||
{{- else -}} | ||
{{- print "policy/v1" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return the appropriate apiVersion for networkpolicy. | ||
*/}} | ||
{{- define "common.capabilities.networkPolicy.apiVersion" -}} | ||
{{- if semverCompare "<1.7-0" (include "common.capabilities.kubeVersion" .) -}} | ||
{{- print "extensions/v1beta1" -}} | ||
{{- else -}} | ||
{{- print "networking.k8s.io/v1" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return the appropriate apiVersion for cronjob. | ||
*/}} | ||
{{- define "common.capabilities.cronjob.apiVersion" -}} | ||
{{- if semverCompare "<1.21-0" (include "common.capabilities.kubeVersion" .) -}} | ||
{{- print "batch/v1beta1" -}} | ||
{{- else -}} | ||
{{- print "batch/v1" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return the appropriate apiVersion for deployment. | ||
*/}} | ||
{{- define "common.capabilities.deployment.apiVersion" -}} | ||
{{- if semverCompare "<1.14-0" (include "common.capabilities.kubeVersion" .) -}} | ||
{{- print "extensions/v1beta1" -}} | ||
{{- else -}} | ||
{{- print "apps/v1" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return the appropriate apiVersion for statefulset. | ||
*/}} | ||
{{- define "common.capabilities.statefulset.apiVersion" -}} | ||
{{- if semverCompare "<1.14-0" (include "common.capabilities.kubeVersion" .) -}} | ||
{{- print "apps/v1beta1" -}} | ||
{{- else -}} | ||
{{- print "apps/v1" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return the appropriate apiVersion for ingress. | ||
*/}} | ||
{{- define "common.capabilities.ingress.apiVersion" -}} | ||
{{- if .Values.ingress -}} | ||
{{- if .Values.ingress.apiVersion -}} | ||
{{- .Values.ingress.apiVersion -}} | ||
{{- else if semverCompare "<1.14-0" (include "common.capabilities.kubeVersion" .) -}} | ||
{{- print "extensions/v1beta1" -}} | ||
{{- else if semverCompare "<1.19-0" (include "common.capabilities.kubeVersion" .) -}} | ||
{{- print "networking.k8s.io/v1beta1" -}} | ||
{{- else -}} | ||
{{- print "networking.k8s.io/v1" -}} | ||
{{- end }} | ||
{{- else if semverCompare "<1.14-0" (include "common.capabilities.kubeVersion" .) -}} | ||
{{- print "extensions/v1beta1" -}} | ||
{{- else if semverCompare "<1.19-0" (include "common.capabilities.kubeVersion" .) -}} | ||
{{- print "networking.k8s.io/v1beta1" -}} | ||
{{- else -}} | ||
{{- print "networking.k8s.io/v1" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return the appropriate apiVersion for RBAC resources. | ||
*/}} | ||
{{- define "common.capabilities.rbac.apiVersion" -}} | ||
{{- if semverCompare "<1.17-0" (include "common.capabilities.kubeVersion" .) -}} | ||
{{- print "rbac.authorization.k8s.io/v1beta1" -}} | ||
{{- else -}} | ||
{{- print "rbac.authorization.k8s.io/v1" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return the appropriate apiVersion for CRDs. | ||
*/}} | ||
{{- define "common.capabilities.crd.apiVersion" -}} | ||
{{- if semverCompare "<1.19-0" (include "common.capabilities.kubeVersion" .) -}} | ||
{{- print "apiextensions.k8s.io/v1beta1" -}} | ||
{{- else -}} | ||
{{- print "apiextensions.k8s.io/v1" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return the appropriate apiVersion for APIService. | ||
*/}} | ||
{{- define "common.capabilities.apiService.apiVersion" -}} | ||
{{- if semverCompare "<1.10-0" (include "common.capabilities.kubeVersion" .) -}} | ||
{{- print "apiregistration.k8s.io/v1beta1" -}} | ||
{{- else -}} | ||
{{- print "apiregistration.k8s.io/v1" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return the appropriate apiVersion for Horizontal Pod Autoscaler. | ||
*/}} | ||
{{- define "common.capabilities.hpa.apiVersion" -}} | ||
{{- if semverCompare "<1.23-0" (include "common.capabilities.kubeVersion" .) -}} | ||
{{- print "autoscaling/v2beta2" -}} | ||
{{- else -}} | ||
{{- print "autoscaling/v2" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Returns true if the used Helm version is 3.3+. | ||
A way to check the used Helm version was not introduced until version 3.3.0 with .Capabilities.HelmVersion, which contains an additional "{}}" structure. | ||
This check is introduced as a regexMatch instead of {{ if .Capabilities.HelmVersion }} because checking for the key HelmVersion in <3.3 results in a "interface not found" error. | ||
**To be removed when the catalog's minimun Helm version is 3.3** | ||
*/}} | ||
{{- define "common.capabilities.supportsHelmVersion" -}} | ||
{{- if regexMatch "{(v[0-9])*[^}]*}}$" (.Capabilities | toString ) }} | ||
{{- true -}} | ||
{{- end -}} | ||
{{- end -}} |
30 changes: 30 additions & 0 deletions
30
charts/prometheus-node-exporter/charts/calico-exporter/templates/_daemonset.tpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{{/* | ||
# Containers for the calico-exporter daemonset. | ||
*/}} | ||
{{- define "calico-exporter.daemonset.containers" -}} | ||
- name: calico-exporter | ||
env: | ||
- name: NODENAME | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: spec.nodeName | ||
image: "{{ .Values.CalicoExporter.image.repository }}:{{ .Values.CalicoExporter.image.tag }}" | ||
imagePullPolicy: {{ .Values.CalicoExporter.image.pullPolicy }} | ||
args: | ||
- --web.listen-address=127.0.0.1:{{ .Values.CalicoExporter.service.innerPort }} | ||
- --collector.enable-collectors=bgp | ||
resources: | ||
{{ toYaml .Values.CalicoExporter.resources | indent 12 }} | ||
volumeMounts: | ||
- name: var-run-calico | ||
mountPath: /var/run/calico | ||
{{- end }} | ||
|
||
{{/* | ||
# Volumes for the calico-exporter daemonset. | ||
*/}} | ||
{{- define "calico-exporter.daemonset.volumes" -}} | ||
- name: var-run-calico | ||
hostPath: | ||
path: /var/run/calico | ||
{{- end }} |
Oops, something went wrong.