added repo

This commit is contained in:
Your Name
2026-08-26 03:39:42 +05:30
parent 45c25a95af
commit b8575bb8b9
6889 changed files with 1217125 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
apiVersion: v2
name: alertmanager
description: The Alertmanager handles alerts sent by client applications such as the Prometheus server.
home: https://prometheus.io/
icon: https://raw.githubusercontent.com/prometheus/prometheus.github.io/master/assets/prometheus_logo-cb55bb5c346.png
sources:
- https://github.com/prometheus/alertmanager
type: application
version: 0.33.1
appVersion: v0.25.0
kubeVersion: ">=1.16.0-0"
keywords:
- monitoring
maintainers:
- name: monotek
email: monotek23@gmail.com
- name: naseemkullah
email: naseem@transit.app
annotations:
"artifacthub.io/links": |
- name: Chart Source
url: https://github.com/prometheus-community/helm-charts
+56
View File
@@ -0,0 +1,56 @@
# Alertmanager
As per [prometheus.io documentation](https://prometheus.io/docs/alerting/latest/alertmanager/):
> The Alertmanager handles alerts sent by client applications such as the
> Prometheus server. It takes care of deduplicating, grouping, and routing them
> to the correct receiver integration such as email, PagerDuty, or OpsGenie. It
> also takes care of silencing and inhibition of alerts.
## Prerequisites
Kubernetes 1.14+
## Get Repository Info
```console
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
```
_See [`helm repo`](https://helm.sh/docs/helm/helm_repo/) for command documentation._
## Install Chart
```console
helm install [RELEASE_NAME] prometheus-community/alertmanager
```
_See [configuration](#configuration) below._
_See [helm install](https://helm.sh/docs/helm/helm_install/) for command documentation._
## Uninstall Chart
```console
helm uninstall [RELEASE_NAME]
```
This removes all the Kubernetes components associated with the chart and deletes the release.
_See [helm uninstall](https://helm.sh/docs/helm/helm_uninstall/) for command documentation._
## Upgrading Chart
```console
helm upgrade [RELEASE_NAME] [CHART] --install
```
_See [helm upgrade](https://helm.sh/docs/helm/helm_upgrade/) for command documentation._
## Configuration
See [Customizing the Chart Before Installing](https://helm.sh/docs/intro/using_helm/#customizing-the-chart-before-installing). To see all configurable options with detailed comments, visit the chart's [values.yaml](./values.yaml), or run these configuration commands:
```console
helm show values prometheus-community/alertmanager
```
@@ -0,0 +1,2 @@
configmapReload:
enabled: true
@@ -0,0 +1,231 @@
global:
route:
repeat_interval: 60m
receiver: alerts
group_by: ['groupId', 'name', 'envoy_cluster_name', 'namespace', 'pod', 'service', 'instance', 'subnet_id', 'cluster']
routes:
- match:
team: sre
receiver: 'eks-common-alerts'
- match:
alertgroup: farmiso_gke
receiver: 'farmiso-devops-alerts'
- match_re:
job: .*(kube-state-metrics-).*
receiver: 'eks-common-alerts'
- match:
alerts: farmiso-devops-alerts
receiver: 'farmiso-devops-alerts'
- match_re:
dbinstance_identifier: "(bac-p-farmiso|bac-p-farmiso-slave-01)"
receiver: 'farmiso-devops-alerts'
- match_re:
cache_cluster_id: .*(front-p-farmiso).*
receiver: 'farmiso-devops-alerts'
- match_re:
target_group: .*(targetgroup/bac-p-edge-proxy-farmiso-ext-tg).*
receiver: 'farmiso-devops-alerts'
receivers:
- name: 'alerts'
slack_configs:
- api_url: "https://hooks.slack.com/services/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"
channel: "#alerts"
send_resolved: true
title: '[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}] Monitoring Event Notification'
text: >-
{{ range .Alerts }}
*Alert:* {{ .Annotations.summary }} - `{{ .Labels.severity }}`
*Status:* `{{ .Status | toUpper }}`
*Details:*
{{ range .Labels.SortedPairs }} • *{{ .Name }}:* `{{ .Value }}`
{{ end }}
*Description:* {{ .Annotations.description }}
{{ end }}
pagerduty_configs:
- url: https://events.pagerduty.com/v2/enqueue
routing_key: R011TWRG2LB13YBEOPNKJ7EI11LQXYGU
send_resolved: true
client: AlertManager
description: '{{ (index .Alerts 0).Labels.severity | toUpper }} - {{ (index .Alerts 0).Labels.env | toUpper }}{{ if eq (index .Alerts 0).Labels.env "" }}{{ (index .Alerts 0).Labels.label_env | toUpper }}{{ end }} - {{ (index .Alerts 0).Labels.priority }}{{ if eq (index .Alerts 0).Labels.priority "" }}{{ (index .Alerts 0).Labels.label_priority }}{{ end }} - {{ (index .Alerts 0).Labels.alertname }} - {{ (index .Alerts 0).Labels.bu }}{{ if eq (index .Alerts 0).Labels.bu "" }}{{ (index .Alerts 0).Labels.label_bu }}{{ end }} - {{ (index .Alerts 0).Labels.team }}{{ if eq (index .Alerts 0).Labels.team "" }}{{ (index .Alerts 0).Labels.label_team }}{{ end }} - {{ (index .Alerts 0).Labels.service }}{{ if eq (index .Alerts 0).Labels.service "" }}{{ (index .Alerts 0).Labels.namespace }}{{ end }}'
severity: '{{ (index .Alerts 0).Labels.severity }}'
class: '{{ (index .Alerts 0).Labels.alertname }}'
component: '{{ (index .Alerts 0).Labels.service }}{{ if eq (index .Alerts 0).Labels.service "" }}{{ (index .Alerts 0).Labels.label_service }}{{ end }}'
group: '{{ (index .Alerts 0).Labels.team }}{{ if eq (index .Alerts 0).Labels.team "" }}{{ (index .Alerts 0).Labels.label_team }}{{ end }}'
details:
alert_name: '{{ (index .Alerts 0).Labels.alertname }}'
description: '{{ (index .Alerts 0).Annotations.description }}'
meesho_env: '{{ (index .Alerts 0).Labels.env }}{{ if eq (index .Alerts 0).Labels.env "" }}{{ (index .Alerts 0).Labels.label_env }}{{ end }}'
meesho_bu: '{{ (index .Alerts 0).Labels.bu }}{{ if eq (index .Alerts 0).Labels.bu "" }}{{ (index .Alerts 0).Labels.label_bu }}{{ end }}'
meesho_team: '{{ (index .Alerts 0).Labels.team }}{{ if eq (index .Alerts 0).Labels.team "" }}{{ (index .Alerts 0).Labels.label_team }}{{ end }}'
meesho_service: '{{ (index .Alerts 0).Labels.service }}{{ if eq (index .Alerts 0).Labels.service "" }}{{ (index .Alerts 0).Labels.label_service }}{{ end }}'
meesho_type: '{{ (index .Alerts 0).Labels.type }}{{ if eq (index .Alerts 0).Labels.type "" }}{{ (index .Alerts 0).Labels.label_type }}{{ end }}'
meesho_priority: '{{ (index .Alerts 0).Labels.priority }}{{ if eq (index .Alerts 0).Labels.priority "" }}{{ (index .Alerts 0).Labels.label_priority }}{{ end }}'
meesho_alert_route: '{{ (index .Alerts 0).Labels.alerts }}'
meesho_job: '{{ (index .Alerts 0).Labels.job }}'
meesho_private_ip: '{{ (index .Alerts 0).Labels.private_ip }}'
meesho_instance: '{{ (index .Alerts 0).Labels.instance }}'
meesho_z_all: |
{{ range (index .Alerts 0).Labels.SortedPairs }}
• {{ .Name }}: {{ .Value }}
{{ end }}
firing: ''
- name: 'farmiso-devops-alerts'
slack_configs:
- api_url: "https://hooks.slack.com/services/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"
channel: "#farmiso-devops-alerts"
send_resolved: true
title: '[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}] Monitoring Event Notification'
text: >-
{{ range .Alerts }}
*Alert:* {{ .Annotations.summary }} - `{{ .Labels.severity }}`
*Status:* `{{ .Status | toUpper }}`
*Details:*
{{ range .Labels.SortedPairs }} • *{{ .Name }}:* `{{ .Value }}`
{{ end }}
*Description:* {{ .Annotations.description }}
{{ end }}
- api_url: "https://hooks.slack.com/services/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"
channel: "#alerts"
send_resolved: true
title: '[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}] Monitoring Event Notification'
text: >-
{{ range .Alerts }}
*Alert:* {{ .Annotations.summary }} - `{{ .Labels.severity }}`
*Status:* `{{ .Status | toUpper }}`
*Details:*
{{ range .Labels.SortedPairs }} • *{{ .Name }}:* `{{ .Value }}`
{{ end }}
*Description:* {{ .Annotations.description }}
{{ end }}
- name: 'growth-infra-engagement-infra-transact-infra-farmiso-devops-common-alerts'
slack_configs:
- api_url: "https://hooks.slack.com/services/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"
channel: "#growth-infra-alerts"
send_resolved: true
title: '[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}] Monitoring Event Notification'
text: >-
{{ range .Alerts }}
*Alert:* {{ .Annotations.summary }} - `{{ .Labels.severity }}`
*Status:* `{{ .Status | toUpper }}`
*Details:*
{{ range .Labels.SortedPairs }} • *{{ .Name }}:* `{{ .Value }}`
{{ end }}
*Description:* {{ .Annotations.description }}
{{ end }}
- api_url: "https://hooks.slack.com/services/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"
channel: "#transact-infra-alerts"
send_resolved: true
title: '[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}] Monitoring Event Notification'
text: >-
{{ range .Alerts }}
*Alert:* {{ .Annotations.summary }} - `{{ .Labels.severity }}`
*Status:* `{{ .Status | toUpper }}`
*Details:*
{{ range .Labels.SortedPairs }} • *{{ .Name }}:* `{{ .Value }}`
{{ end }}
*Description:* {{ .Annotations.description }}
{{ end }}
- api_url: "https://hooks.slack.com/services/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"
channel: "#engagement-infra-alerts"
send_resolved: true
title: '[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}] Monitoring Event Notification'
text: >-
{{ range .Alerts }}
*Alert:* {{ .Annotations.summary }} - `{{ .Labels.severity }}`
*Status:* `{{ .Status | toUpper }}`
*Details:*
{{ range .Labels.SortedPairs }} • *{{ .Name }}:* `{{ .Value }}`
{{ end }}
*Description:* {{ .Annotations.description }}
{{ end }}
- api_url: "https://hooks.slack.com/services/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"
channel: "#farmiso-devops-alerts"
send_resolved: true
title: '[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}] Monitoring Event Notification'
text: >-
{{ range .Alerts }}
*Alert:* {{ .Annotations.summary }} - `{{ .Labels.severity }}`
*Status:* `{{ .Status | toUpper }}`
*Details:*
{{ range .Labels.SortedPairs }} • *{{ .Name }}:* `{{ .Value }}`
{{ end }}
*Description:* {{ .Annotations.description }}
{{ end }}
- api_url: "https://hooks.slack.com/services/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"
channel: "#alerts"
send_resolved: true
title: '[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}] Monitoring Event Notification'
text: >-
{{ range .Alerts }}
*Alert:* {{ .Annotations.summary }} - `{{ .Labels.severity }}`
*Status:* `{{ .Status | toUpper }}`
*Details:*
{{ range .Labels.SortedPairs }} • *{{ .Name }}:* `{{ .Value }}`
{{ end }}
*Description:* {{ .Annotations.description }}
{{ end }}
- name: 'eks-common-alerts'
slack_configs:
- api_url: "https://hooks.slack.com/services/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"
channel: "#eks-common-alerts"
send_resolved: true
title: '[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}] Monitoring Event Notification'
text: >-
{{ range .Alerts }}
*Alert:* {{ .Annotations.summary }} - `{{ .Labels.severity }}`
*Status:* `{{ .Status | toUpper }}`
*Details:*
{{ range .Labels.SortedPairs }} • *{{ .Name }}:* `{{ .Value }}`
{{ end }}
*Description:* {{ .Annotations.description }}
{{ end }}
pagerduty_configs:
- url: https://events.pagerduty.com/v2/enqueue
routing_key: R011TWRG2LB13YBEOPNKJ7EI11LQXYGU
send_resolved: true
client: AlertManager
description: '{{ (index .Alerts 0).Labels.severity | toUpper }} - {{ (index .Alerts 0).Labels.env | toUpper }}{{ if eq (index .Alerts 0).Labels.env "" }}{{ (index .Alerts 0).Labels.label_env | toUpper }}{{ end }} - {{ (index .Alerts 0).Labels.priority }}{{ if eq (index .Alerts 0).Labels.priority "" }}{{ (index .Alerts 0).Labels.label_priority }}{{ end }} - {{ (index .Alerts 0).Labels.alertname }} - {{ (index .Alerts 0).Labels.bu }}{{ if eq (index .Alerts 0).Labels.bu "" }}{{ (index .Alerts 0).Labels.label_bu }}{{ end }} - {{ (index .Alerts 0).Labels.team }}{{ if eq (index .Alerts 0).Labels.team "" }}{{ (index .Alerts 0).Labels.label_team }}{{ end }} - {{ (index .Alerts 0).Labels.service }}{{ if eq (index .Alerts 0).Labels.service "" }}{{ (index .Alerts 0).Labels.namespace }}{{ end }}'
severity: '{{ (index .Alerts 0).Labels.severity }}'
class: '{{ (index .Alerts 0).Labels.alertname }}'
component: '{{ (index .Alerts 0).Labels.service }}{{ if eq (index .Alerts 0).Labels.service "" }}{{ (index .Alerts 0).Labels.label_service }}{{ end }}'
group: '{{ (index .Alerts 0).Labels.team }}{{ if eq (index .Alerts 0).Labels.team "" }}{{ (index .Alerts 0).Labels.label_team }}{{ end }}'
details:
alert_name: '{{ (index .Alerts 0).Labels.alertname }}'
description: '{{ (index .Alerts 0).Annotations.description }}'
meesho_env: '{{ (index .Alerts 0).Labels.env }}{{ if eq (index .Alerts 0).Labels.env "" }}{{ (index .Alerts 0).Labels.label_env }}{{ end }}'
meesho_bu: '{{ (index .Alerts 0).Labels.bu }}{{ if eq (index .Alerts 0).Labels.bu "" }}{{ (index .Alerts 0).Labels.label_bu }}{{ end }}'
meesho_team: '{{ (index .Alerts 0).Labels.team }}{{ if eq (index .Alerts 0).Labels.team "" }}{{ (index .Alerts 0).Labels.label_team }}{{ end }}'
meesho_service: '{{ (index .Alerts 0).Labels.service }}{{ if eq (index .Alerts 0).Labels.service "" }}{{ (index .Alerts 0).Labels.label_service }}{{ end }}'
meesho_type: '{{ (index .Alerts 0).Labels.type }}{{ if eq (index .Alerts 0).Labels.type "" }}{{ (index .Alerts 0).Labels.label_type }}{{ end }}'
meesho_priority: '{{ (index .Alerts 0).Labels.priority }}{{ if eq (index .Alerts 0).Labels.priority "" }}{{ (index .Alerts 0).Labels.label_priority }}{{ end }}'
meesho_alert_route: '{{ (index .Alerts 0).Labels.alerts }}'
meesho_job: '{{ (index .Alerts 0).Labels.job }}'
meesho_private_ip: '{{ (index .Alerts 0).Labels.private_ip }}'
meesho_instance: '{{ (index .Alerts 0).Labels.instance }}'
meesho_z_all: |
{{ range (index .Alerts 0).Labels.SortedPairs }}
• {{ .Name }}: {{ .Value }}
{{ end }}
firing: ''
templates:
- '/etc/alertmanager/template/gchat.tmpl'
@@ -0,0 +1,415 @@
global:
route:
repeat_interval: 60m
receiver: alerts
group_by: ['database_id','name','groupId','exported_cluster','envoy_cluster_name', 'namespace', 'pod', 'service', 'instance', 'subnet_id', 'alertname','cluster']
routes:
- match:
orchestration_id: 67a9c6bb-1b06-4768-8f62-1c644f4e7b32
receiver: 'event-orchestration-1'
continue: false
- match:
orchestration_id: 7d616e74-1292-4cf1-8b5c-4741886f9d4b
receiver: 'event-orchestration-2'
continue: false
# Heap-dump automation: alerts opted in with the label heap_dump="true" are POSTed to
# Jenkins (heap-dump-job-go-auto) via the Generic Webhook Trigger plugin. continue:true so
# the alert ALSO flows through to its normal Slack/PagerDuty routing below.
# Grouped by pod+cluster -> one webhook (one build) per affected pod.
# repeat_interval:12h throttles re-triggers so a long-firing alert does not re-dump hourly.
- match:
heap_dump: "true"
receiver: 'jenkins-heap-dump'
continue: true
group_by: ['pod', 'cluster']
repeat_interval: 12h
- match_re:
alertname: .*(?i)uptime.*
receiver: 'gke-service-alerts-rcd'
- match_re:
alertname: System-Uptime-Stateless.*
receiver: 'uptime-alerts'
- match_re:
groupname: .*-uptime
receiver: 'gke-service-alerts-rcd'
- match_re:
alertname: .*_GKE.*
receiver: 'gke-service-alerts-rcd'
- match_re:
groupname: k8s-.*
receiver: 'gke-service-alerts'
- match:
service_type: kafka
receiver: 'gke-service-alerts-kafka'
- match_re:
groupname: k8s.*
receiver: 'gke-service-alerts'
- match_re:
groupname: redis.*
receiver: 'gke-service-alerts'
- match_re:
groupname: db.*
receiver: 'gke-service-alerts'
- match_re:
groupname: bigtable.*
receiver: 'gke-service-alerts'
- match_re:
groupname: scylla.*
receiver: 'gke-service-alerts'
- match_re:
groupname: mongo.*
receiver: 'gke-service-alerts'
- match_re:
groupname: elastic.*
receiver: 'gke-service-alerts'
- match_re:
groupname: vm.*
receiver: 'gke-service-alerts'
receivers:
- name: 'alerts'
slack_configs:
- api_url: "https://hooks.slack.com/services/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"
channel: "#alerts"
send_resolved: true
title: '[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}] Monitoring Event Notification'
text: >-
{{ range .Alerts }}
*Alert:* {{ .Annotations.summary }} - `{{ .Labels.severity }}`
*Status:* `{{ .Status | toUpper }}`
*Details:*
{{ range .Labels.SortedPairs }} • *{{ .Name }}:* `{{ .Value }}`
{{ end }}
*Description:* {{ .Annotations.description }}
{{ end }}
pagerduty_configs:
- url: https://events.pagerduty.com/v2/enqueue
routing_key: R02HMNATHTKHIN9N1SV5B72R412GFGZ6
send_resolved: true
client: AlertManager
description: '{{ (index .Alerts 0).Labels.severity | toUpper }} - {{ (index .Alerts 0).Labels.env | toUpper }}{{ if eq (index .Alerts 0).Labels.env "" }}{{ (index .Alerts 0).Labels.label_env | toUpper }}{{ end }} - {{ (index .Alerts 0).Labels.priority }}{{ if eq (index .Alerts 0).Labels.priority "" }}{{ (index .Alerts 0).Labels.label_priority }}{{ end }} - {{ (index .Alerts 0).Labels.alertname }} - {{ (index .Alerts 0).Labels.bu }}{{ if eq (index .Alerts 0).Labels.bu "" }}{{ (index .Alerts 0).Labels.label_bu }}{{ end }} - {{ (index .Alerts 0).Labels.team }}{{ if eq (index .Alerts 0).Labels.team "" }}{{ (index .Alerts 0).Labels.label_team }}{{ end }} - {{ (index .Alerts 0).Labels.service }}{{ if eq (index .Alerts 0).Labels.service "" }}{{ (index .Alerts 0).Labels.namespace }}{{ end }}'
severity: '{{ (index .Alerts 0).Labels.severity }}'
class: '{{ (index .Alerts 0).Labels.alertname }}'
component: '{{ (index .Alerts 0).Labels.service }}{{ if eq (index .Alerts 0).Labels.service "" }}{{ (index .Alerts 0).Labels.label_service }}{{ end }}'
group: '{{ (index .Alerts 0).Labels.section }}{{ if eq (index .Alerts 0).Labels.section "" }}{{ (index .Alerts 0).Labels.label_section }}{{ end }}'
details:
alert_name: '{{ (index .Alerts 0).Labels.alertname }}'
description: '{{ (index .Alerts 0).Annotations.description }}'
meesho_env: '{{ (index .Alerts 0).Labels.env }}{{ if eq (index .Alerts 0).Labels.env "" }}{{ (index .Alerts 0).Labels.label_env }}{{ end }}'
meesho_bu: '{{ (index .Alerts 0).Labels.bu }}{{ if eq (index .Alerts 0).Labels.bu "" }}{{ (index .Alerts 0).Labels.label_bu }}{{ end }}'
meesho_team: '{{ (index .Alerts 0).Labels.team }}{{ if eq (index .Alerts 0).Labels.team "" }}{{ (index .Alerts 0).Labels.label_team }}{{ end }}'
meesho_service: '{{ (index .Alerts 0).Labels.service }}{{ if eq (index .Alerts 0).Labels.service "" }}{{ (index .Alerts 0).Labels.label_service }}{{ end }}'
meesho_type: '{{ (index .Alerts 0).Labels.type }}{{ if eq (index .Alerts 0).Labels.type "" }}{{ (index .Alerts 0).Labels.label_type }}{{ end }}'
meesho_priority: '{{ (index .Alerts 0).Labels.priority }}{{ if eq (index .Alerts 0).Labels.priority "" }}{{ (index .Alerts 0).Labels.label_priority }}{{ end }}'
meesho_alert_route: '{{ (index .Alerts 0).Labels.alerts }}'
meesho_job: '{{ (index .Alerts 0).Labels.job }}'
meesho_private_ip: '{{ (index .Alerts 0).Labels.private_ip }}'
meesho_instance: '{{ (index .Alerts 0).Labels.instance }}'
meesho_z_all: |
{{ range (index .Alerts 0).Labels.SortedPairs }}
• {{ .Name }}: {{ .Value }}
{{ end }}
firing: ''
- name: 'uptime-alerts'
slack_configs:
- api_url: "https://hooks.slack.com/services/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"
channel: "#alerts"
send_resolved: true
title: '[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}] Monitoring Event Notification'
text: >-
{{ range .Alerts }}
*Alert:* {{ .Annotations.summary }} - `{{ .Labels.severity }}`
*Status:* `{{ .Status | toUpper }}`
*Details:*
{{ range .Labels.SortedPairs }} • *{{ .Name }}:* `{{ .Value }}`
{{ end }}
*Description:* {{ .Annotations.description }}
{{ end }}
pagerduty_configs:
- url: https://events.pagerduty.com/v2/enqueue
routing_key: R02C33YDLWHWMSPDZI4ESLOXM1NGRN3H
client: AlertManager
description: '{{ (index .Alerts 0).Labels.severity | toUpper }} - {{ (index .Alerts 0).Labels.env | toUpper }}{{ if eq (index .Alerts 0).Labels.env "" }}{{ (index .Alerts 0).Labels.label_env | toUpper }}{{ end }} - {{ (index .Alerts 0).Labels.priority_v2 }}{{ if eq (index .Alerts 0).Labels.priority_v2 "" }}{{ (index .Alerts 0).Labels.label_priority_v2 }}{{ end }} - {{ (index .Alerts 0).Labels.alertname }} - {{ (index .Alerts 0).Labels.bu }}{{ if eq (index .Alerts 0).Labels.bu "" }}{{ (index .Alerts 0).Labels.label_bu }}{{ end }} - {{ (index .Alerts 0).Labels.team }}{{ if eq (index .Alerts 0).Labels.team "" }}{{ (index .Alerts 0).Labels.label_team }}{{ end }} - {{ (index .Alerts 0).Labels.envoy_cluster_name | reReplaceAll "_.*" "" | reReplaceAll "prd-" "" }}{{ if eq (index .Alerts 0).Labels.envoy_cluster_name "" }}{{ (index .Alerts 0).Labels.service }}{{ end }}'
severity: '{{ (index .Alerts 0).Labels.severity }}'
class: '{{ (index .Alerts 0).Labels.alertname }}'
component: '{{ (index .Alerts 0).Labels.service }}{{ if eq (index .Alerts 0).Labels.service "" }}{{ (index .Alerts 0).Labels.label_service }}{{ end }}'
group: '{{ (index .Alerts 0).Labels.team }}{{ if eq (index .Alerts 0).Labels.team "" }}{{ (index .Alerts 0).Labels.label_team }}{{ end }}'
details:
alert_name: '{{ (index .Alerts 0).Labels.alertname }}'
description: '{{ (index .Alerts 0).Annotations.description }}'
meesho_env: '{{ (index .Alerts 0).Labels.env }}{{ if eq (index .Alerts 0).Labels.env "" }}{{ (index .Alerts 0).Labels.label_env }}{{ end }}'
meesho_bu: '{{ (index .Alerts 0).Labels.bu }}{{ if eq (index .Alerts 0).Labels.bu "" }}{{ (index .Alerts 0).Labels.label_bu }}{{ end }}'
meesho_team: '{{ (index .Alerts 0).Labels.team }}{{ if eq (index .Alerts 0).Labels.team "" }}{{ (index .Alerts 0).Labels.label_team }}{{ end }}'
meesho_service: '{{ (index .Alerts 0).Labels.service }}{{ if eq (index .Alerts 0).Labels.service "" }}{{ (index .Alerts 0).Labels.label_service }}{{ end }}'
meesho_envoy_cluster_name: '{{ (index .Alerts 0).Labels.envoy_cluster_name | reReplaceAll "_.*" "" | reReplaceAll "prd-" "" }}{{ if eq (index .Alerts 0).Labels.envoy_cluster_name "" }}{{ (index .Alerts 0).Labels.service }}{{ end }}'
meesho_type: '{{ (index .Alerts 0).Labels.type }}{{ if eq (index .Alerts 0).Labels.type "" }}{{ (index .Alerts 0).Labels.label_type }}{{ end }}'
meesho_priority: '{{ (index .Alerts 0).Labels.priority }}{{ if eq (index .Alerts 0).Labels.priority "" }}{{ (index .Alerts 0).Labels.label_priority }}{{ end }}'
meesho_primary_owner: '{{ (index .Alerts 0).Labels.primary_owner }}'
meesho_secondry_owner: '{{ (index .Alerts 0).Labels.secondry_owner }}'
meesho_alert_route: '{{ (index .Alerts 0).Labels.alerts }}'
meesho_job: '{{ (index .Alerts 0).Labels.job }}'
meesho_private_ip: '{{ (index .Alerts 0).Labels.private_ip }}'
meesho_instance: '{{ (index .Alerts 0).Labels.instance }}'
meesho_service_type: '{{ (index .Alerts 0).Labels.service_type }}'
meesho_priority_v2: '{{ (index .Alerts 0).Labels.priority_v2 }}'
meesho_z_all: |
{{ range (index .Alerts 0).Labels.SortedPairs }}
• {{ .Name }}: {{ .Value }}
{{ end }}
firing: ''
- name: 'gke-service-alerts'
slack_configs:
- api_url: "https://hooks.slack.com/services/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"
channel: "#alerts"
send_resolved: true
title: '[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}] Monitoring Event Notification'
text: >-
{{ range .Alerts }}
*Alert:* {{ .Annotations.summary }} - `{{ .Labels.severity }}`
*Status:* `{{ .Status | toUpper }}`
*Details:*
{{ range .Labels.SortedPairs }} • *{{ .Name }}:* `{{ .Value }}`
{{ end }}
*Description:* {{ .Annotations.description }}
{{ end }}
pagerduty_configs:
- url: https://events.pagerduty.com/v2/enqueue
routing_key: R02HMNATHTKHIN9N1SV5B72R412GFGZ6
send_resolved: true
client: AlertManager
description: '{{ (index .Alerts 0).Labels.severity | toUpper }} - {{ (index .Alerts 0).Labels.env | toUpper }}{{ if eq (index .Alerts 0).Labels.env "" }}{{ (index .Alerts 0).Labels.label_env | toUpper }}{{ end }} - {{ (index .Alerts 0).Labels.priority }}{{ if eq (index .Alerts 0).Labels.priority "" }}{{ (index .Alerts 0).Labels.label_priority }}{{ end }} - {{ (index .Alerts 0).Labels.alertname }}'
severity: '{{ (index .Alerts 0).Labels.severity }}'
class: '{{ (index .Alerts 0).Labels.alertname }}'
component: '{{ (index .Alerts 0).Labels.service }}{{ if eq (index .Alerts 0).Labels.service "" }}{{ (index .Alerts 0).Labels.label_service }}{{ end }}'
group: '{{ (index .Alerts 0).Labels.section }}{{ if eq (index .Alerts 0).Labels.section "" }}{{ (index .Alerts 0).Labels.label_section }}{{ end }}'
details:
alert_name: '{{ (index .Alerts 0).Labels.alertname }}'
description: '{{ (index .Alerts 0).Annotations.description }}'
meesho_env: '{{ (index .Alerts 0).Labels.env }}{{ if eq (index .Alerts 0).Labels.env "" }}{{ (index .Alerts 0).Labels.label_env }}{{ end }}'
meesho_bu: '{{ (index .Alerts 0).Labels.bu }}{{ if eq (index .Alerts 0).Labels.bu "" }}{{ (index .Alerts 0).Labels.label_bu }}{{ end }}'
meesho_team: '{{ (index .Alerts 0).Labels.team }}{{ if eq (index .Alerts 0).Labels.team "" }}{{ (index .Alerts 0).Labels.label_team }}{{ end }}'
meesho_service: '{{ (index .Alerts 0).Labels.service }}{{ if eq (index .Alerts 0).Labels.service "" }}{{ (index .Alerts 0).Labels.label_service }}{{ end }}'
meesho_envoy_cluster_name: '{{ (index .Alerts 0).Labels.envoy_cluster_name | reReplaceAll "_.*" "" | reReplaceAll "prd-" "" }}{{ if eq (index .Alerts 0).Labels.envoy_cluster_name "" }}{{ (index .Alerts 0).Labels.service }}{{ end }}'
meesho_type: '{{ (index .Alerts 0).Labels.type }}{{ if eq (index .Alerts 0).Labels.type "" }}{{ (index .Alerts 0).Labels.label_type }}{{ end }}'
meesho_priority: '{{ (index .Alerts 0).Labels.priority }}{{ if eq (index .Alerts 0).Labels.priority "" }}{{ (index .Alerts 0).Labels.label_priority }}{{ end }}'
meesho_primary_owner: '{{ (index .Alerts 0).Labels.primary_owner }}'
meesho_secondary_owner: '{{ (index .Alerts 0).Labels.secondary_owner }}'
meesho_alert_route: '{{ (index .Alerts 0).Labels.alerts }}'
meesho_job: '{{ (index .Alerts 0).Labels.job }}'
meesho_private_ip: '{{ (index .Alerts 0).Labels.private_ip }}'
meesho_instance: '{{ (index .Alerts 0).Labels.instance }}'
meesho_z_all: |
{{ range (index .Alerts 0).Labels.SortedPairs }}
• {{ .Name }}: {{ .Value }}
{{ end }}
firing: ''
- name: 'event-orchestration-1'
slack_configs:
- api_url: "https://hooks.slack.com/services/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"
channel: "#alerts"
send_resolved: true
title: '[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}] Monitoring Event Notification'
text: >-
{{ range .Alerts }}
*Alert:* {{ .Annotations.summary }} - `{{ .Labels.severity }}`
*Status:* `{{ .Status | toUpper }}`
*Details:*
{{ range .Labels.SortedPairs }} • *{{ .Name }}:* `{{ .Value }}`
{{ end }}
*Description:* {{ .Annotations.description }}
{{ end }}
pagerduty_configs:
- url: https://events.pagerduty.com/v2/enqueue
routing_key: R025U1EEEU74A2UQ74EYFX0TF0QC4CO5
send_resolved: true
client: AlertManager
description: '{{ (index .Alerts 0).Labels.env | toUpper }}{{ if eq (index .Alerts 0).Labels.env "" }}{{ (index .Alerts 0).Labels.label_env | toUpper }}{{ end }} - {{ (index .Alerts 0).Labels.alertname }} - {{ (index .Alerts 0).Labels.service }}{{ if eq (index .Alerts 0).Labels.service "" }}{{ (index .Alerts 0).Labels.namespace }}{{ end }}'
severity: '{{ (index .Alerts 0).Labels.severity }}'
class: '{{ (index .Alerts 0).Labels.alertname }}'
component: '{{ (index .Alerts 0).Labels.service }}{{ if eq (index .Alerts 0).Labels.service "" }}{{ (index .Alerts 0).Labels.label_service }}{{ end }}'
group: '{{ (index .Alerts 0).Labels.section }}{{ if eq (index .Alerts 0).Labels.section "" }}{{ (index .Alerts 0).Labels.label_section }}{{ end }}'
details:
alert_name: '{{ (index .Alerts 0).Labels.alertname }}'
description: '{{ (index .Alerts 0).Annotations.description }}'
meesho_env: '{{ (index .Alerts 0).Labels.env }}{{ if eq (index .Alerts 0).Labels.env "" }}{{ (index .Alerts 0).Labels.label_env }}{{ end }}'
meesho_bu: '{{ (index .Alerts 0).Labels.bu }}{{ if eq (index .Alerts 0).Labels.bu "" }}{{ (index .Alerts 0).Labels.label_bu }}{{ end }}'
meesho_team: '{{ (index .Alerts 0).Labels.team }}{{ if eq (index .Alerts 0).Labels.team "" }}{{ (index .Alerts 0).Labels.label_team }}{{ end }}'
meesho_service: '{{ (index .Alerts 0).Labels.service }}{{ if eq (index .Alerts 0).Labels.service "" }}{{ (index .Alerts 0).Labels.label_service }}{{ end }}'
meesho_envoy_cluster_name: '{{ (index .Alerts 0).Labels.envoy_cluster_name | reReplaceAll "_.*" "" | reReplaceAll "prd-" "" }}{{ if eq (index .Alerts 0).Labels.envoy_cluster_name "" }}{{ (index .Alerts 0).Labels.service }}{{ end }}'
meesho_type: '{{ (index .Alerts 0).Labels.type }}{{ if eq (index .Alerts 0).Labels.type "" }}{{ (index .Alerts 0).Labels.label_type }}{{ end }}'
meesho_priority: '{{ (index .Alerts 0).Labels.priority }}{{ if eq (index .Alerts 0).Labels.priority "" }}{{ (index .Alerts 0).Labels.label_priority }}{{ end }}'
meesho_primary_owner: '{{ (index .Alerts 0).Labels.primary_owner }}'
meesho_secondary_owner: '{{ (index .Alerts 0).Labels.secondary_owner }}'
meesho_alert_route: '{{ (index .Alerts 0).Labels.alerts }}'
meesho_job: '{{ (index .Alerts 0).Labels.job }}'
meesho_private_ip: '{{ (index .Alerts 0).Labels.private_ip }}'
meesho_instance: '{{ (index .Alerts 0).Labels.instance }}'
meesho_z_all: |
{{ range (index .Alerts 0).Labels.SortedPairs }}
• {{ .Name }}: {{ .Value }}
{{ end }}
firing: ''
webhook_configs:
- url: http://autonomous-incident-copilot.prd.meesho.int/api/ingest_alerts
send_resolved: false
- name: 'event-orchestration-2'
slack_configs:
- api_url: "https://hooks.slack.com/services/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"
channel: "#alerts"
send_resolved: true
title: '[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}] Monitoring Event Notification'
text: >-
{{ range .Alerts }}
*Alert:* {{ .Annotations.summary }} - `{{ .Labels.severity }}`
*Status:* `{{ .Status | toUpper }}`
*Details:*
{{ range .Labels.SortedPairs }} • *{{ .Name }}:* `{{ .Value }}`
{{ end }}
*Description:* {{ .Annotations.description }}
{{ end }}
pagerduty_configs:
- url: https://events.pagerduty.com/v2/enqueue
routing_key: R02CIUHCGMHEJU2UUQ61IILPP0B7S47C
send_resolved: true
client: AlertManager
description: '{{ (index .Alerts 0).Labels.env | toUpper }}{{ if eq (index .Alerts 0).Labels.env "" }}{{ (index .Alerts 0).Labels.label_env | toUpper }}{{ end }} - {{ (index .Alerts 0).Labels.alertname }} - {{ (index .Alerts 0).Labels.service }}{{ if eq (index .Alerts 0).Labels.service "" }}{{ (index .Alerts 0).Labels.namespace }}{{ end }}'
severity: '{{ (index .Alerts 0).Labels.severity }}'
class: '{{ (index .Alerts 0).Labels.alertname }}'
component: '{{ (index .Alerts 0).Labels.service }}{{ if eq (index .Alerts 0).Labels.service "" }}{{ (index .Alerts 0).Labels.label_service }}{{ end }}'
group: '{{ (index .Alerts 0).Labels.section }}{{ if eq (index .Alerts 0).Labels.section "" }}{{ (index .Alerts 0).Labels.label_section }}{{ end }}'
details:
alert_name: '{{ (index .Alerts 0).Labels.alertname }}'
description: '{{ (index .Alerts 0).Annotations.description }}'
meesho_env: '{{ (index .Alerts 0).Labels.env }}{{ if eq (index .Alerts 0).Labels.env "" }}{{ (index .Alerts 0).Labels.label_env }}{{ end }}'
meesho_bu: '{{ (index .Alerts 0).Labels.bu }}{{ if eq (index .Alerts 0).Labels.bu "" }}{{ (index .Alerts 0).Labels.label_bu }}{{ end }}'
meesho_team: '{{ (index .Alerts 0).Labels.team }}{{ if eq (index .Alerts 0).Labels.team "" }}{{ (index .Alerts 0).Labels.label_team }}{{ end }}'
meesho_service: '{{ (index .Alerts 0).Labels.service }}{{ if eq (index .Alerts 0).Labels.service "" }}{{ (index .Alerts 0).Labels.label_service }}{{ end }}'
meesho_envoy_cluster_name: '{{ (index .Alerts 0).Labels.envoy_cluster_name | reReplaceAll "_.*" "" | reReplaceAll "prd-" "" }}{{ if eq (index .Alerts 0).Labels.envoy_cluster_name "" }}{{ (index .Alerts 0).Labels.service }}{{ end }}'
meesho_type: '{{ (index .Alerts 0).Labels.type }}{{ if eq (index .Alerts 0).Labels.type "" }}{{ (index .Alerts 0).Labels.label_type }}{{ end }}'
meesho_priority: '{{ (index .Alerts 0).Labels.priority }}{{ if eq (index .Alerts 0).Labels.priority "" }}{{ (index .Alerts 0).Labels.label_priority }}{{ end }}'
meesho_primary_owner: '{{ (index .Alerts 0).Labels.primary_owner }}'
meesho_secondary_owner: '{{ (index .Alerts 0).Labels.secondary_owner }}'
meesho_alert_route: '{{ (index .Alerts 0).Labels.alerts }}'
meesho_job: '{{ (index .Alerts 0).Labels.job }}'
meesho_private_ip: '{{ (index .Alerts 0).Labels.private_ip }}'
meesho_instance: '{{ (index .Alerts 0).Labels.instance }}'
meesho_z_all: |
{{ range (index .Alerts 0).Labels.SortedPairs }}
• {{ .Name }}: {{ .Value }}
{{ end }}
firing: ''
webhook_configs:
- url: http://autonomous-incident-copilot.prd.meesho.int/api/ingest_alerts
send_resolved: false
# Triggers the Jenkins heap-dump-job-go-auto job (alert-driven clone of heap-dump-job-go,
# runs on jenkins-prd in the 'jenkins' namespace). The Generic Webhook Trigger plugin reads
# the alert JSON; the job's GenericTrigger maps $.commonLabels.{bu,service,pod} into build
# params. ?token= MUST equal the job's trigger token. Targets the in-cluster Service.
- name: 'jenkins-heap-dump'
webhook_configs:
- url: 'http://jenkins-prd.jenkins.svc.cluster.local:8080/generic-webhook-trigger/invoke?token=heap-dump-job-go-auto'
send_resolved: false
- name: 'gke-service-alerts-kafka'
slack_configs:
- api_url: "https://hooks.slack.com/services/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"
channel: "#alerts"
send_resolved: true
title: '[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}] Monitoring Event Notification'
text: >-
{{ range .Alerts }}
*Alert:* {{ .Annotations.summary }} - `{{ .Labels.severity }}`
*Status:* `{{ .Status | toUpper }}`
*Details:*
{{ range .Labels.SortedPairs }} • *{{ .Name }}:* `{{ .Value }}`
{{ end }}
*Description:* {{ .Annotations.description }}
{{ end }}
pagerduty_configs:
- url: https://events.pagerduty.com/v2/enqueue
routing_key: R02HMNATHTKHIN9N1SV5B72R412GFGZ6
send_resolved: true
client: AlertManager
description: '{{ (index .Alerts 0).Labels.severity | toUpper }} - {{ (index .Alerts 0).Labels.env | toUpper }}{{ if eq (index .Alerts 0).Labels.env "" }}{{ (index .Alerts 0).Labels.label_env | toUpper }}{{ end }} - {{ (index .Alerts 0).Labels.priority }}{{ if eq (index .Alerts 0).Labels.priority "" }}{{ (index .Alerts 0).Labels.label_priority }}{{ end }} - {{ (index .Alerts 0).Labels.alertname }}'
severity: '{{ (index .Alerts 0).Labels.severity }}'
class: '{{ (index .Alerts 0).Labels.alertname }}'
component: '{{ (index .Alerts 0).Labels.service }}{{ if eq (index .Alerts 0).Labels.service "" }}{{ (index .Alerts 0).Labels.label_service }}{{ end }}'
group: '{{ (index .Alerts 0).Labels.section }}{{ if eq (index .Alerts 0).Labels.section "" }}{{ (index .Alerts 0).Labels.label_section }}{{ end }}'
details:
alert_name: '{{ (index .Alerts 0).Labels.alertname }}'
description: '{{ (index .Alerts 0).Annotations.description }}'
meesho_env: '{{ (index .Alerts 0).Labels.env }}{{ if eq (index .Alerts 0).Labels.env "" }}{{ (index .Alerts 0).Labels.label_env }}{{ end }}'
meesho_bu: '{{ (index .Alerts 0).Labels.bu }}{{ if eq (index .Alerts 0).Labels.bu "" }}{{ (index .Alerts 0).Labels.label_bu }}{{ end }}'
meesho_team: '{{ (index .Alerts 0).Labels.team }}{{ if eq (index .Alerts 0).Labels.team "" }}{{ (index .Alerts 0).Labels.label_team }}{{ end }}'
meesho_service: '{{ (index .Alerts 0).Labels.service }}{{ if eq (index .Alerts 0).Labels.service "" }}{{ (index .Alerts 0).Labels.label_service }}{{ end }}'
meesho_envoy_cluster_name: '{{ (index .Alerts 0).Labels.envoy_cluster_name | reReplaceAll "_.*" "" | reReplaceAll "prd-" "" }}{{ if eq (index .Alerts 0).Labels.envoy_cluster_name "" }}{{ (index .Alerts 0).Labels.service }}{{ end }}'
meesho_type: '{{ (index .Alerts 0).Labels.type }}{{ if eq (index .Alerts 0).Labels.type "" }}{{ (index .Alerts 0).Labels.label_type }}{{ end }}'
meesho_priority: '{{ (index .Alerts 0).Labels.priority }}{{ if eq (index .Alerts 0).Labels.priority "" }}{{ (index .Alerts 0).Labels.label_priority }}{{ end }}'
meesho_primary_owner: '{{ (index .Alerts 0).Labels.primary_owner }}'
meesho_secondary_owner: '{{ (index .Alerts 0).Labels.secondary_owner }}'
meesho_alert_route: '{{ (index .Alerts 0).Labels.alerts }}'
meesho_job: '{{ (index .Alerts 0).Labels.job }}'
meesho_private_ip: '{{ (index .Alerts 0).Labels.private_ip }}'
meesho_instance: '{{ (index .Alerts 0).Labels.instance }}'
meesho_z_all: |
{{ range (index .Alerts 0).Labels.SortedPairs }}
• {{ .Name }}: {{ .Value }}
{{ end }}
firing: ''
- name: 'gke-service-alerts-rcd'
slack_configs:
- api_url: "https://hooks.slack.com/services/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"
channel: "#alerts"
send_resolved: true
title: '[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}] Monitoring Event Notification'
text: >-
{{ range .Alerts }}
*Alert:* {{ .Annotations.summary }} - `{{ .Labels.severity }}`
*Status:* `{{ .Status | toUpper }}`
*Details:*
{{ range .Labels.SortedPairs }} • *{{ .Name }}:* `{{ .Value }}`
{{ end }}
*Description:* {{ .Annotations.description }}
{{ end }}
pagerduty_configs:
- url: https://events.pagerduty.com/v2/enqueue
routing_key: R02HMNATHTKHIN9N1SV5B72R412GFGZ6
send_resolved: true
client: AlertManager
description: '{{ (index .Alerts 0).Labels.severity | toUpper }} - {{ (index .Alerts 0).Labels.env | toUpper }}{{ if eq (index .Alerts 0).Labels.env "" }}{{ (index .Alerts 0).Labels.label_env | toUpper }}{{ end }} - {{ (index .Alerts 0).Labels.priority }}{{ if eq (index .Alerts 0).Labels.priority "" }}{{ (index .Alerts 0).Labels.label_priority }}{{ end }} - {{ (index .Alerts 0).Labels.alertname }}'
severity: '{{ (index .Alerts 0).Labels.severity }}'
class: '{{ (index .Alerts 0).Labels.alertname }}'
component: '{{ (index .Alerts 0).Labels.service }}{{ if eq (index .Alerts 0).Labels.service "" }}{{ (index .Alerts 0).Labels.label_service }}{{ end }}'
group: '{{ (index .Alerts 0).Labels.section }}{{ if eq (index .Alerts 0).Labels.section "" }}{{ (index .Alerts 0).Labels.label_section }}{{ end }}'
details:
alert_name: '{{ (index .Alerts 0).Labels.alertname }}'
description: '{{ (index .Alerts 0).Annotations.description }}'
meesho_env: '{{ (index .Alerts 0).Labels.env }}{{ if eq (index .Alerts 0).Labels.env "" }}{{ (index .Alerts 0).Labels.label_env }}{{ end }}'
meesho_bu: '{{ (index .Alerts 0).Labels.bu }}{{ if eq (index .Alerts 0).Labels.bu "" }}{{ (index .Alerts 0).Labels.label_bu }}{{ end }}'
meesho_team: '{{ (index .Alerts 0).Labels.team }}{{ if eq (index .Alerts 0).Labels.team "" }}{{ (index .Alerts 0).Labels.label_team }}{{ end }}'
meesho_service: '{{ (index .Alerts 0).Labels.service }}{{ if eq (index .Alerts 0).Labels.service "" }}{{ (index .Alerts 0).Labels.label_service }}{{ end }}'
meesho_envoy_cluster_name: '{{ (index .Alerts 0).Labels.envoy_cluster_name | reReplaceAll "_.*" "" | reReplaceAll "prd-" "" }}{{ if eq (index .Alerts 0).Labels.envoy_cluster_name "" }}{{ (index .Alerts 0).Labels.service }}{{ end }}'
meesho_type: '{{ (index .Alerts 0).Labels.type }}{{ if eq (index .Alerts 0).Labels.type "" }}{{ (index .Alerts 0).Labels.label_type }}{{ end }}'
meesho_priority: '{{ (index .Alerts 0).Labels.priority }}{{ if eq (index .Alerts 0).Labels.priority "" }}{{ (index .Alerts 0).Labels.label_priority }}{{ end }}'
meesho_primary_owner: '{{ (index .Alerts 0).Labels.primary_owner }}'
meesho_secondary_owner: '{{ (index .Alerts 0).Labels.secondary_owner }}'
meesho_alert_route: '{{ (index .Alerts 0).Labels.alerts }}'
meesho_job: '{{ (index .Alerts 0).Labels.job }}'
meesho_private_ip: '{{ (index .Alerts 0).Labels.private_ip }}'
meesho_instance: '{{ (index .Alerts 0).Labels.instance }}'
meesho_z_all: |
{{ range (index .Alerts 0).Labels.SortedPairs }}
• {{ .Name }}: {{ .Value }}
{{ end }}
firing: ''
templates:
- '/etc/alertmanager/template/gchat.tmpl'
@@ -0,0 +1,21 @@
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range $host := .Values.ingress.hosts }}
{{- range .paths }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
{{- end }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ include "alertmanager.namespace" . }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "alertmanager.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ include "alertmanager.namespace" . }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ include "alertmanager.namespace" . }} svc -w {{ include "alertmanager.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ include "alertmanager.namespace" . }} {{ include "alertmanager.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ include "alertmanager.namespace" . }} -l "app.kubernetes.io/name={{ include "alertmanager.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://127.0.0.1:{{ .Values.service.port }} to use your application"
kubectl --namespace {{ include "alertmanager.namespace" . }} port-forward $POD_NAME {{ .Values.service.port }}:80
{{- end }}
@@ -0,0 +1,157 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "alertmanager.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Maintainer - Akshay Gupta
Tolerations and nodeSelector via Resources Requests.
*/}}
{{- define "meesho.getCpu" -}}
{{- $cpu := toString .Values.resources.requests.cpu -}}
{{- if contains "m" $cpu -}}
{{- $cpu := trimAll "m" $cpu | float64 -}}
{{- $cpu := $cpu | float64 -}}
{{- printf "%f" $cpu -}}
{{- else -}}
{{- $cpu := mulf $cpu 1000.000 -}}
{{- printf "%f" $cpu -}}
{{- end -}}
{{- end -}}
{{- define "meesho.getMem" -}}
{{- $mem := toString .Values.resources.requests.memory -}}
{{- if contains "Mi" $mem -}}
{{- $mem := trimAll "Mi" $mem | float64 -}}
{{- printf "%f" $mem -}}
{{- else if contains "Gi" $mem -}}
{{- $mem := trimAll "Gi" $mem | float64 -}}
{{- $mem := mulf $mem 1024.000 -}}
{{- printf "%f" $mem -}}
{{- end -}}
{{- end -}}
{{- define "meesho.getRatio" -}}
{{- $cpu := (include "meesho.getCpu" .) -}}
{{- $mem := (include "meesho.getMem" .) -}}
{{- $ratio := divf $mem $cpu -}}
{{- if gt $ratio 4.00 -}}
{{- printf "1to8" -}}
{{- else if gt $ratio 2.00 -}}
{{- printf "1to4" -}}
{{- else -}}
{{- printf "1to2" -}}
{{- end -}}
{{- end -}}
{{- define "meesho.dedicatedValue" -}}
{{- if (index .Values.labels "arch") -}}
{{- if (index .Values.labels "runpod") -}}
{{- $cpu := (include "meesho.getCpu" .) -}}
{{- $mem := (include "meesho.getMem" .) -}}
{{- $ratio := (include "meesho.getRatio" .) -}}
{{- $arch := .Values.labels.arch -}}
{{- $runPod := .Values.labels.runpod -}}
{{- printf "%s-%s-%s" $ratio $arch $runPod -}}
{{- else -}}
{{- printf "missing-runpod-label" -}}
{{- end -}}
{{- else -}}
{{- printf "missing-arch-label" -}}
{{- end -}}
{{/*- printf "%s-%s-%s-%s-%s" $ratio $arch $runPod $cpu $mem -*/}}
{{- end -}}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "alertmanager.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "alertmanager.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "alertmanager.labels" -}}
helm.sh/chart: {{ include "alertmanager.chart" . }}
{{ include "alertmanager.selectorLabels" . }}
{{- with .Chart.AppVersion }}
app.kubernetes.io/version: {{ . | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "alertmanager.selectorLabels" -}}
app.kubernetes.io/name: {{ include "alertmanager.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "alertmanager.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "alertmanager.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
{{/*
Define Ingress apiVersion
*/}}
{{- define "alertmanager.ingress.apiVersion" -}}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion }}
{{- printf "networking.k8s.io/v1" }}
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion }}
{{- printf "networking.k8s.io/v1beta1" }}
{{- else }}
{{- printf "extensions/v1beta1" }}
{{- end }}
{{- end }}
{{/*
Define Pdb apiVersion
*/}}
{{- define "alertmanager.pdb.apiVersion" -}}
{{- if $.Capabilities.APIVersions.Has "policy/v1/PodDisruptionBudget" }}
{{- printf "policy/v1" }}
{{- else }}
{{- printf "policy/v1beta1" }}
{{- end }}
{{- end }}
{{/*
Allow overriding alertmanager namespace
*/}}
{{- define "alertmanager.namespace" -}}
{{- if .Values.namespaceOverride -}}
{{- .Values.namespaceOverride -}}
{{- else -}}
{{- .Release.Namespace -}}
{{- end -}}
{{- end -}}
@@ -0,0 +1,20 @@
{{- if and (.Values.config) (eq .Values.configMap "") }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "alertmanager.fullname" . }}
labels:
{{- include "alertmanager.labels" . | nindent 4 }}
{{- with .Values.configAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
namespace: {{ include "alertmanager.namespace" . }}
data:
alertmanager.yml: |
{{- toYaml .Values.config | default "{}" | nindent 4 }}
{{- range $key, $value := .Values.templates }}
{{ $key }}: |-
{{- $value | nindent 4 }}
{{- end }}
{{- end }}
@@ -0,0 +1,56 @@
{{- if .Values.ingress.enabled }}
{{- $fullName := include "alertmanager.fullname" . }}
{{- $svcPort := .Values.service.port }}
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
{{- end }}
{{- end }}
apiVersion: {{ include "alertmanager.ingress.apiVersion" . }}
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
{{- include "alertmanager.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
namespace: {{ include "alertmanager.namespace" . }}
spec:
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.ingress.className }}
{{- end }}
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ .path }}
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
pathType: {{ .pathType }}
{{- end }}
backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
{{- else }}
serviceName: {{ $fullName }}
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
@@ -0,0 +1,13 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "alertmanager.fullname" . }}-config
labels:
{{- include "alertmanager.labels" . | nindent 4 }}
{{- with .Values.configAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
namespace: {{ include "alertmanager.namespace" . }}
data:
{{ (.Files.Glob "configmap/alertmanager.yml").AsConfig | nindent 2 }}
@@ -0,0 +1,14 @@
{{- if .Values.podDisruptionBudget }}
apiVersion: {{ include "alertmanager.pdb.apiVersion" . }}
kind: PodDisruptionBudget
metadata:
name: {{ include "alertmanager.fullname" . }}
labels:
{{- include "alertmanager.labels" . | nindent 4 }}
namespace: {{ include "alertmanager.namespace" . }}
spec:
selector:
matchLabels:
{{- include "alertmanager.selectorLabels" . | nindent 6 }}
{{- toYaml .Values.podDisruptionBudget | nindent 2 }}
{{- end }}
@@ -0,0 +1,14 @@
{{- if .Values.serviceAccount.create }}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "alertmanager.serviceAccountName" . }}
labels:
{{- include "alertmanager.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
namespace: {{ include "alertmanager.namespace" . }}
automountServiceAccountToken: {{ .Values.automountServiceAccountToken }}
{{- end }}
@@ -0,0 +1,59 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "alertmanager.fullname" . }}
labels:
{{- include "alertmanager.labels" . | nindent 4 }}
{{- with .Values.service.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
namespace: {{ include "alertmanager.namespace" . }}
spec:
type: {{ .Values.service.type }}
{{- with .Values.service.loadBalancerIP }}
loadBalancerIP: {{ . }}
{{- end }}
{{- with .Values.service.loadBalancerSourceRanges }}
loadBalancerSourceRanges:
{{- range $cidr := . }}
- {{ $cidr }}
{{- end }}
{{- end }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
{{- if (and (eq .Values.service.type "NodePort") .Values.service.nodePort) }}
nodePort: {{ .Values.service.nodePort }}
{{- end }}
selector:
{{- include "alertmanager.selectorLabels" . | nindent 4 }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ include "alertmanager.fullname" . }}-headless
labels:
{{- include "alertmanager.labels" . | nindent 4 }}
namespace: {{ include "alertmanager.namespace" . }}
spec:
clusterIP: None
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
{{- if or (gt (int .Values.replicaCount) 1) (.Values.additionalPeers) }}
- port: {{ .Values.service.clusterPort }}
targetPort: {{ .Values.service.clusterPort }}
protocol: TCP
name: cluster-tcp
- port: {{ .Values.service.clusterPort }}
targetPort: {{ .Values.service.clusterPort }}
protocol: UDP
name: cluster-udp
{{- end }}
selector:
{{- include "alertmanager.selectorLabels" . | nindent 4 }}
@@ -0,0 +1,241 @@
{{- $svcClusterPort := .Values.service.clusterPort }}
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "alertmanager.fullname" . }}
labels:
{{- include "alertmanager.labels" . | nindent 4 }}
{{- with .Values.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.statefulSet.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
namespace: {{ include "alertmanager.namespace" . }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "alertmanager.selectorLabels" . | nindent 6 }}
serviceName: {{ include "alertmanager.fullname" . }}-headless
template:
metadata:
labels:
{{- include "alertmanager.selectorLabels" . | nindent 8 }}
{{- with .Values.labels }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
annotations:
{{- if not .Values.configmapReload.enabled }}
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
{{- end }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
automountServiceAccountToken: {{ .Values.automountServiceAccountToken }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "alertmanager.serviceAccountName" . }}
{{- with .Values.dnsConfig }}
dnsConfig:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.hostAliases }}
hostAliases:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if or .Values.podAntiAffinity .Values.affinity }}
affinity:
{{- end }}
{{- with .Values.affinity }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if eq .Values.podAntiAffinity "hard" }}
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- topologyKey: {{ .Values.podAntiAffinityTopologyKey }}
labelSelector:
matchExpressions:
- {key: app.kubernetes.io/name, operator: In, values: [{{ include "alertmanager.name" . }}]}
{{- else if eq .Values.podAntiAffinity "soft" }}
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
topologyKey: {{ .Values.podAntiAffinityTopologyKey }}
labelSelector:
matchExpressions:
- {key: app.kubernetes.io/name, operator: In, values: [{{ include "alertmanager.name" . }}]}
{{- end }}
{{- with .Values.priorityClassName }}
priorityClassName: {{ . }}
{{- end }}
{{- with .Values.topologySpreadConstraints }}
topologySpreadConstraints:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.schedulerName }}
schedulerName: "{{ .Values.schedulerName }}"
{{- end }}
nodeSelector:
{{- if .Values.dedicatedValue }}
dedicated: {{ include "meesho.dedicatedValue" . }}
{{- else }}
{{- with .Values.nodeSelector }}
{{ toYaml . | nindent 8 }}
{{- end }}
{{- end }}
tolerations:
{{- if .Values.dedicatedValue }}
- key: "dedicated"
operator: "Equal"
value: {{ include "meesho.dedicatedValue" . }}
effect: "NoSchedule"
{{- else }}
{{- with .Values.tolerations }}
{{ toYaml . | nindent 8 }}
{{- end }}
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
{{- with .Values.extraInitContainers }}
initContainers:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
{{- if .Values.configmapReload.enabled }}
- name: {{ .Chart.Name }}-{{ .Values.configmapReload.name }}
image: "{{ .Values.configmapReload.image.repository }}:{{ .Values.configmapReload.image.tag }}"
imagePullPolicy: "{{ .Values.configmapReload.image.pullPolicy }}"
args:
- --volume-dir=/etc/alertmanager
- --webhook-url=http://127.0.0.1:9093/-/reload
resources:
{{- toYaml .Values.configmapReload.resources | nindent 12 }}
{{- with .Values.configmapReload.containerPort }}
ports:
- containerPort: {{ . }}
{{- end }}
volumeMounts:
- name: config
mountPath: /etc/alertmanager
{{- end }}
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
- name: TZ
value: Asia/Kolkata
- name: POD_IP
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: status.podIP
{{- if .Values.extraEnv }}
{{- toYaml .Values.extraEnv | nindent 12 }}
{{- end }}
{{- with .Values.command }}
command:
{{- toYaml . | nindent 12 }}
{{- end }}
args:
- --storage.path=/alertmanager
- --config.file=/etc/alertmanager/alertmanager.yml
{{- if or (gt (int .Values.replicaCount) 1) (.Values.additionalPeers) }}
- --cluster.advertise-address=[$(POD_IP)]:{{ $svcClusterPort }}
- --cluster.listen-address=0.0.0.0:{{ $svcClusterPort }}
{{- end }}
{{- if gt (int .Values.replicaCount) 1}}
{{- $fullName := include "alertmanager.fullname" . }}
{{- range $i := until (int .Values.replicaCount) }}
- --cluster.peer={{ $fullName }}-{{ $i }}.{{ $fullName }}-headless:{{ $svcClusterPort }}
{{- end }}
{{- end }}
{{- if .Values.additionalPeers }}
{{- range $item := .Values.additionalPeers }}
- --cluster.peer={{ $item }}
{{- end }}
{{- end }}
{{- range $key, $value := .Values.extraArgs }}
- --{{ $key }}={{ $value }}
{{- end }}
ports:
- name: http
containerPort: 9093
protocol: TCP
livenessProbe:
{{- toYaml .Values.livenessProbe | nindent 12 }}
readinessProbe:
{{- toYaml .Values.readinessProbe | nindent 12 }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
{{- if or (.Values.config) (ne .Values.configMap "") }}
- name: config
mountPath: /etc/alertmanager
{{- end }}
{{- range .Values.extraSecretMounts }}
- name: {{ .name }}
mountPath: {{ .mountPath }}
subPath: {{ .subPath }}
readOnly: {{ .readOnly }}
{{- end }}
- name: storage
mountPath: /alertmanager
{{- if .Values.extraVolumeMounts }}
{{- toYaml .Values.extraVolumeMounts | nindent 12 }}
{{- end }}
{{- with .Values.extraContainers }}
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
{{- if (eq .Values.configMap "") }}
- name: config
configMap:
name: {{ include "alertmanager.fullname" . }}
{{- else }}
- name: config
configMap:
name: {{ .Values.configMap }}
{{- end }}
{{- range .Values.extraSecretMounts }}
- name: {{ .name }}
secret:
secretName: {{ .secretName }}
{{- with .optional }}
optional: {{ . }}
{{- end }}
{{- end }}
{{- if .Values.extraVolumes }}
{{- toYaml .Values.extraVolumes | nindent 8 }}
{{- end }}
{{- if .Values.persistence.enabled }}
volumeClaimTemplates:
- metadata:
name: storage
spec:
accessModes:
{{- toYaml .Values.persistence.accessModes | nindent 10 }}
resources:
requests:
storage: {{ .Values.persistence.size }}
{{- if .Values.persistence.storageClass }}
{{- if (eq "-" .Values.persistence.storageClass) }}
storageClassName: ""
{{- else }}
storageClassName: {{ .Values.persistence.storageClass }}
{{- end }}
{{- end }}
{{- else }}
- name: storage
emptyDir: {}
{{- end }}
@@ -0,0 +1,20 @@
{{- if .Values.testFramework.enabled }}
apiVersion: v1
kind: Pod
metadata:
name: "{{ include "alertmanager.fullname" . }}-test-connection"
labels:
{{- include "alertmanager.labels" . | nindent 4 }}
{{- with .Values.testFramework.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
namespace: {{ include "alertmanager.namespace" . }}
spec:
containers:
- name: wget
image: busybox
command: ['wget']
args: ['{{ include "alertmanager.fullname" . }}:{{ .Values.service.port }}']
restartPolicy: Never
{{- end }}
@@ -0,0 +1,48 @@
should match snapshot of default values:
1: |
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
labels:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: alertmanager
app.kubernetes.io/version: 1.0.0
helm.sh/chart: alertmanager-1.0.0
name: RELEASE-NAME-alertmanager
spec:
ingressClassName: nginx-test
rules:
- host: alertmanager.domain.com
http:
paths:
- backend:
service:
name: RELEASE-NAME-alertmanager
port:
number: 9093
path: /
pathType: ImplementationSpecific
should match snapshot of default values with old kubernetes ingress:
1: |
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: nginx-test
labels:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: alertmanager
app.kubernetes.io/version: 1.0.0
helm.sh/chart: alertmanager-1.0.0
name: RELEASE-NAME-alertmanager
spec:
rules:
- host: alertmanager.domain.com
http:
paths:
- backend:
serviceName: RELEASE-NAME-alertmanager
servicePort: 9093
path: /
@@ -0,0 +1,81 @@
suite: test ingress
templates:
- ingress.yaml
tests:
- it: should be empty if ingress is not enabled
asserts:
- hasDocuments:
count: 0
- it: should have apiVersion extensions/v1beta1 for k8s < 1.14
set:
ingress.enabled: true
capabilities:
majorVersion: 1
minorVersion: 13
asserts:
- hasDocuments:
count: 1
- isKind:
of: Ingress
- isAPIVersion:
of: extensions/v1beta1
- it: should have apiVersion networking.k8s.io/v1beta1 for k8s < 1.19
set:
ingress.enabled: true
capabilities:
majorVersion: 1
minorVersion: 18
asserts:
- hasDocuments:
count: 1
- isKind:
of: Ingress
- isAPIVersion:
of: networking.k8s.io/v1beta1
- it: should have apiVersion networking.k8s.io/v1 for k8s >= 1.19
set:
ingress.enabled: true
capabilities:
majorVersion: 1
minorVersion: 19
asserts:
- hasDocuments:
count: 1
- isKind:
of: Ingress
- isAPIVersion:
of: networking.k8s.io/v1
- it: should have an ingressClassName for k8s >= 1.19
set:
ingress.enabled: true
ingress.className: nginx-test
capabilities:
majorVersion: 1
minorVersion: 19
asserts:
- hasDocuments:
count: 1
- equal:
path: spec.ingressClassName
value: nginx-test
- it: should match snapshot of default values
set:
ingress.enabled: true
ingress.className: nginx-test
chart:
version: 1.0.0
appVersion: 1.0.0
asserts:
- matchSnapshot: { }
- it: should match snapshot of default values with old kubernetes ingress
set:
ingress.enabled: true
ingress.className: nginx-test
capabilities:
majorVersion: 1
minorVersion: 17
chart:
version: 1.0.0
appVersion: 1.0.0
asserts:
- matchSnapshot: { }
@@ -0,0 +1,911 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"title": "alertmanager",
"description": "The Alertmanager handles alerts sent by client applications such as the Prometheus server.",
"type": "object",
"required": [
"replicaCount",
"image",
"serviceAccount",
"service",
"persistence",
"config"
],
"definitions": {
"image": {
"description": "Container image parameters.",
"type": "object",
"required": ["repository"],
"additionalProperties": false,
"properties": {
"repository": {
"description": "Image repository. Path to the image with registry(quay.io) or without(prometheus/alertmanager) for docker.io.",
"type": "string"
},
"pullPolicy": {
"description": "Image pull policy. Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. Cannot be updated.",
"type": "string",
"enum": [
"Never",
"IfNotPresent",
"Always"
],
"default": "IfNotPresent"
},
"tag": {
"description": "Use chart appVersion by default.",
"type": "string",
"default": ""
}
}
},
"resources": {
"description": "Resource limits and requests for the Container.",
"type": "object",
"properties": {
"limits": {
"description": "Resource limits for the Container.",
"type": "object",
"properties": {
"cpu": {
"description": "CPU request for the Container.",
"type": "string"
},
"memory": {
"description": "Memory request for the Container.",
"type": "string"
}
}
},
"requests": {
"description": "Resource requests for the Container.",
"type": "object",
"properties": {
"cpu": {
"description": "CPU request for the Container.",
"type": "string"
},
"memory": {
"description": "Memory request for the Container.",
"type": "string"
}
}
}
}
},
"securityContext": {
"description": "Security context for the container.",
"type": "object",
"properties": {
"capabilities": {
"description": "Specifies the capabilities to be dropped by the container.",
"type": "object",
"properties": {
"drop": {
"description": "List of capabilities to be dropped.",
"type": "array",
"items": {
"type": "string"
}
}
}
},
"readOnlyRootFilesystem": {
"description": "Specifies whether the root file system should be mounted as read-only.",
"type": "boolean"
},
"runAsUser": {
"description": "Specifies the UID (User ID) to run the container as.",
"type": "integer"
},
"runAsNonRoot": {
"description": "Specifies whether to run the container as a non-root user.",
"type": "boolean"
},
"runAsGroup": {
"description": "Specifies the GID (Group ID) to run the container as.",
"type": "integer"
}
}
},
"volumeMounts": {
"description": "List of volume mounts for the Container.",
"type": "array",
"items": {
"description": "Volume mounts for the Container.",
"type": "object",
"required": ["name", "mountPath"],
"properties": {
"name": {
"description": "The name of the volume to mount.",
"type": "string"
},
"mountPath": {
"description": "The mount path for the volume.",
"type": "string"
},
"readOnly": {
"description": "Specifies if the volume should be mounted in read-only mode.",
"type": "boolean"
}
}
}
},
"env": {
"description": "List of environment variables for the Container.",
"type": "array",
"items": {
"description": "Environment variables for the Container.",
"type": "object",
"required": ["name"],
"properties": {
"name": {
"description": "The name of the environment variable.",
"type": "string"
},
"value": {
"description": "The value of the environment variable.",
"type": "string"
}
}
}
},
"config": {
"description": "https://prometheus.io/docs/alerting/latest/configuration/",
"duration": {
"type": "string",
"pattern": "^((([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?|0)$"
},
"labelname": {
"type": "string",
"pattern": "^[a-zA-Z_][a-zA-Z0-9_]*$|^...$"
},
"route": {
"description": "Alert routing configuration.",
"type": "object",
"properties": {
"receiver": {
"description": "The default receiver to send alerts to.",
"type": "string"
},
"group_by": {
"description": "The labels by which incoming alerts are grouped together.",
"type": "array",
"items": {
"type": "string",
"$ref": "#/definitions/config/labelname"
}
},
"continue": {
"description": "Whether an alert should continue matching subsequent sibling nodes.",
"type": "boolean",
"default": false
},
"matchers": {
"description": "A list of matchers that an alert has to fulfill to match the node.",
"type": "array",
"items": {
"type": "string"
}
},
"group_wait": {
"description": "How long to initially wait to send a notification for a group of alerts.",
"$ref": "#/definitions/config/duration"
},
"group_interval": {
"description": "How long to wait before sending a notification about new alerts that are added to a group of alerts for which an initial notification has already been sent.",
"$ref": "#/definitions/config/duration"
},
"repeat_interval": {
"description": "How long to wait before sending a notification again if it has already been sent successfully for an alert.",
"$ref": "#/definitions/config/duration"
},
"mute_time_intervals": {
"description": "Times when the route should be muted.",
"type": "array",
"items": {
"type": "string"
}
},
"active_time_intervals": {
"description": "Times when the route should be active.",
"type": "array",
"items": {
"type": "string"
}
},
"routes": {
"description": "Zero or more child routes.",
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/config/route"
}
}
}
}
}
},
"properties": {
"replicaCount": {
"description": "Number of desired pods.",
"type": "integer",
"default": 1,
"minimum": 0
},
"image": {
"description": "Container image parameters.",
"$ref": "#/definitions/image"
},
"extraArgs": {
"description": "Additional alertmanager container arguments. Use args without '--', only 'key: value' syntax.",
"type": "object",
"default": {}
},
"extraSecretMounts": {
"description": "Additional Alertmanager Secret mounts.",
"type": "array",
"default": [],
"items": {
"type": "object",
"required": ["name", "mountPath", "secretName"],
"properties": {
"name": {
"type": "string"
},
"mountPath": {
"type": "string"
},
"subPath": {
"type": "string",
"default": ""
},
"secretName": {
"type": "string"
},
"readOnly": {
"type": "boolean",
"default": false
}
}
}
},
"imagePullSecrets": {
"description": "The property allows you to configure multiple image pull secrets.",
"type": "array",
"default": [],
"items": {
"type": "object",
"required": ["name"],
"properties": {
"name": {
"description": "Specifies the Secret name of the image pull secret.",
"type": "string"
}
}
}
},
"nameOverride": {
"description": "Override value for the name of the Helm chart.",
"type": "string",
"default": ""
},
"fullnameOverride": {
"description": "Override value for the fully qualified app name.",
"type": "string",
"default": ""
},
"namespaceOverride": {
"description": "Override deployment namespace.",
"type": "string",
"default": ""
},
"automountServiceAccountToken": {
"description": "Specifies whether to automatically mount the ServiceAccount token into the Pod's filesystem.",
"type": "boolean",
"default": true
},
"serviceAccount": {
"description": "Contains properties related to the service account configuration.",
"type": "object",
"required": ["create"],
"properties": {
"create": {
"description": "Specifies whether a service account should be created.",
"type": "boolean",
"default": true
},
"annotations": {
"description": "Annotations to add to the service account.",
"type": "object",
"default": {}
},
"name": {
"description": "The name of the service account to use. If not set and create is true, a name is generated using the fullname template.",
"type": "string",
"default": ""
}
}
},
"schedulerName": {
"description": "Sets the schedulerName in the alertmanager pod.",
"type": "string",
"default": ""
},
"priorityClassName": {
"description": "Sets the priorityClassName in the alertmanager pod.",
"type": "string",
"default": ""
},
"podSecurityContext": {
"description": "Pod security context configuration.",
"type": "object",
"properties": {
"fsGroup": {
"description": "The fsGroup value for the pod's security context.",
"type": "integer",
"default": 65534
},
"runAsUser": {
"description": "The UID to run the pod's containers as.",
"type": "integer"
},
"runAsGroup": {
"description": "The GID to run the pod's containers as.",
"type": "integer"
}
}
},
"dnsConfig": {
"description": "DNS configuration for the pod.",
"type": "object",
"properties": {
"nameservers": {
"description": "List of DNS server IP addresses.",
"type": "array",
"items": {
"type": "string"
}
},
"searches": {
"description": "List of DNS search domains.",
"type": "array",
"items": {
"type": "string"
}
},
"options": {
"description": "List of DNS options.",
"type": "array",
"items": {
"description": "DNS options.",
"type": "object",
"required": ["name"],
"properties": {
"name": {
"description": "The name of the DNS option.",
"type": "string"
},
"value": {
"description": "The value of the DNS option.",
"type": "string"
}
}
}
}
}
},
"hostAliases": {
"description": "List of host aliases.",
"type": "array",
"items": {
"description": "Host aliases configuration.",
"type": "object",
"required": ["ip", "hostnames"],
"properties": {
"ip": {
"description": "IP address associated with the host alias.",
"type": "string"
},
"hostnames": {
"description": "List of hostnames associated with the IP address.",
"type": "array",
"items": {
"type": "string"
}
}
}
}
},
"securityContext": {
"description": "Security context for the container.",
"$ref": "#/definitions/securityContext"
},
"additionalPeers": {
"description": "Additional peers for a alertmanager.",
"type": "array",
"items": {
"type": "string"
}
},
"extraInitContainers": {
"description": "Additional InitContainers to initialize the pod.",
"type": "array",
"default": [],
"items": {
"required": ["name", "image"],
"properties": {
"name": {
"description": "The name of the InitContainer.",
"type": "string"
},
"image": {
"description": "The container image to use for the InitContainer.",
"type": "string"
},
"pullPolicy": {
"description": "Image pull policy. Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. Cannot be updated.",
"type": "string",
"enum": [
"Never",
"IfNotPresent",
"Always"
],
"default": "IfNotPresent"
},
"command": {
"description": "The command to run in the InitContainer.",
"type": "array",
"items": {
"type": "string"
}
},
"args": {
"description": "Additional command arguments for the InitContainer.",
"type": "array",
"items": {
"type": "string"
}
},
"ports": {
"description": "List of ports to expose from the container.",
"type": "array",
"items": {
"type": "object"
}
},
"env": {
"description": "List of environment variables for the InitContainer.",
"$ref": "#/definitions/env"
},
"envFrom": {
"description": "List of sources to populate environment variables in the container.",
"type": "array",
"items": {
"type": "object"
}
},
"volumeMounts": {
"description": "List of volume mounts for the InitContainer.",
"$ref": "#/definitions/volumeMounts"
},
"resources": {
"description": "Resource requirements for the InitContainer.",
"$ref": "#/definitions/resources"
},
"securityContext": {
"$ref": "#/definitions/securityContext",
"description": "The security context for the InitContainer."
}
}
}
},
"extraContainers": {
"description": "Additional containers to add to the stateful set.",
"type": "array",
"default": [],
"items": {
"required": ["name", "image"],
"properties": {
"name": {
"description": "The name of the InitContainer.",
"type": "string"
},
"image": {
"description": "The container image to use for the InitContainer.",
"type": "string"
},
"pullPolicy": {
"description": "Image pull policy. Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. Cannot be updated.",
"type": "string",
"enum": [
"Never",
"IfNotPresent",
"Always"
],
"default": "IfNotPresent"
},
"command": {
"description": "The command to run in the InitContainer.",
"type": "array",
"items": {
"type": "string"
}
},
"args": {
"description": "Additional command arguments for the InitContainer.",
"type": "array",
"items": {
"type": "string"
}
},
"ports": {
"description": "List of ports to expose from the container.",
"type": "array",
"items": {
"type": "object"
}
},
"env": {
"description": "List of environment variables for the InitContainer.",
"$ref": "#/definitions/env"
},
"envFrom": {
"description": "List of sources to populate environment variables in the container.",
"type": "array",
"items": {
"type": "object"
}
},
"volumeMounts": {
"description": "List of volume mounts for the InitContainer.",
"$ref": "#/definitions/volumeMounts"
},
"resources": {
"description": "Resource requirements for the InitContainer.",
"$ref": "#/definitions/resources"
},
"securityContext": {
"$ref": "#/definitions/securityContext",
"description": "The security context for the InitContainer."
}
}
}
},
"resources": {
"description": "Resource limits and requests for the pod.",
"$ref": "#/definitions/resources"
},
"livenessProbe": {
"description": "Liveness probe configuration.",
"type": "object"
},
"readinessProbe": {
"description": "Readiness probe configuration.",
"type": "object"
},
"service": {
"description": "Service configuration.",
"type": "object",
"required": ["type", "port"],
"properties": {
"annotations": {
"description": "Annotations to add to the service.",
"type": "object"
},
"type": {
"description": "Service type.",
"type": "string"
},
"port": {
"description": "Port number for the service.",
"type": "integer"
},
"clusterPort": {
"description": "Port number for the cluster.",
"type": "integer"
},
"loadBalancerIP": {
"description": "External IP to assign when the service type is LoadBalancer.",
"type": "string"
},
"loadBalancerSourceRanges": {
"description": "IP ranges to allow access to the loadBalancerIP.",
"type": "array",
"items": {
"type": "string"
}
},
"nodePort": {
"description": "Specific nodePort to force when service type is NodePort.",
"type": "integer"
}
}
},
"ingress": {
"description": "Ingress configuration.",
"type": "object",
"properties": {
"enabled": {
"description": "Indicates if Ingress is enabled.",
"type": "boolean"
},
"className": {
"description": "Ingress class name.",
"type": "string"
},
"annotations": {
"description": "Annotations to add to the Ingress.",
"type": "object"
},
"hosts": {
"description": "Host and path configuration for the Ingress.",
"type": "array",
"items": {
"type": "object",
"properties": {
"host": {
"description": "Host name for the Ingress.",
"type": "string"
},
"paths": {
"description": "Path configuration for the Ingress.",
"type": "array",
"items": {
"type": "object",
"properties": {
"path": {
"description": "Path for the Ingress.",
"type": "string"
},
"pathType": {
"description": "Path type for the Ingress.",
"type": "string"
}
}
}
}
}
}
},
"tls": {
"description": "TLS configuration for the Ingress.",
"type": "array",
"items": {
"type": "object",
"properties": {
"secretName": {
"description": "Name of the secret for TLS.",
"type": "string"
},
"hosts": {
"description": "Host names for the TLS configuration.",
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
}
},
"nodeSelector": {
"description": "Node selector for pod assignment.",
"type": "object"
},
"tolerations": {
"description": "Tolerations for pod assignment.",
"type": "array"
},
"affinity": {
"description": "Affinity rules for pod assignment.",
"type": "object"
},
"podAntiAffinity": {
"description": "Pod anti-affinity configuration.",
"type": "string",
"enum": ["", "soft", "hard"],
"default": ""
},
"podAntiAffinityTopologyKey": {
"description": "Topology key to use for pod anti-affinity.",
"type": "string"
},
"topologySpreadConstraints": {
"description": "Topology spread constraints for pod assignment.",
"type": "array",
"items": {
"type": "object",
"required": ["maxSkew", "topologyKey", "whenUnsatisfiable", "labelSelector"],
"properties": {
"maxSkew": {
"type": "integer"
},
"topologyKey": {
"type": "string"
},
"whenUnsatisfiable": {
"type": "string",
"enum": ["DoNotSchedule", "ScheduleAnyway"]
},
"labelSelector": {
"type": "object",
"required": ["matchLabels"],
"properties": {
"matchLabels": {
"type": "object"
}
}
}
}
}
},
"statefulSet": {
"description": "StatefulSet configuration for managing pods.",
"type": "object",
"properties": {
"annotations": {
"type": "object"
}
}
},
"podAnnotations": {
"description": "Annotations to add to the pods.",
"type": "object"
},
"podLabels": {
"description": "Labels to add to the pods.",
"type": "object"
},
"podDisruptionBudget": {
"description": "Pod disruption budget configuration.",
"type": "object",
"properties": {
"maxUnavailable": {
"type": "integer"
},
"minAvailable": {
"type": "integer"
}
}
},
"command": {
"description": "The command to be executed in the container.",
"type": "array",
"items": {
"type": "string"
}
},
"persistence": {
"description": "Persistence configuration for storing data.",
"type": "object",
"required": ["enabled", "size"],
"properties": {
"enabled": {
"type": "boolean"
},
"storageClass": {
"type": "string"
},
"accessModes": {
"type": "array",
"items": {
"type": "string"
}
},
"size": {
"type": "string"
}
}
},
"configAnnotations": {
"description": "Annotations to be added to the Alertmanager configuration.",
"type": "object"
},
"config": {
"description": "Alertmanager configuration.",
"type": "object",
"properties": {
"global": {
"description": "Global configuration options.",
"type": "object"
},
"templates": {
"description": "Alertmanager template files.",
"type": "array",
"items": {
"type": "string"
}
},
"receivers": {
"description": "Alert receivers configuration.",
"type": "array",
"items": {
"type": "object",
"required": ["name"],
"properties": {
"name": {
"description": "The unique name of the receiver.",
"type": "string"
}
}
}
},
"route": {
"description": "Alert routing configuration.",
"type": "object",
"$ref": "#/definitions/config/route"
}
}
},
"configmapReload": {
"description": "Monitors ConfigMap changes and POSTs to a URL.",
"type": "object",
"properties": {
"enabled": {
"description": "Specifies whether the configmap-reload container should be deployed.",
"type": "boolean",
"default": false
},
"name": {
"description": "The name of the configmap-reload container.",
"type": "string"
},
"image": {
"description": "The container image for the configmap-reload container.",
"$ref": "#/definitions/image"
},
"containerPort": {
"description": "Port number for the configmap-reload container.",
"type": "integer"
},
"resources": {
"description": "Resource requests and limits for the configmap-reload container.",
"$ref": "#/definitions/resources"
}
}
},
"templates": {
"description": "Custom templates used by Alertmanager.",
"type": "object"
},
"extraVolumeMounts": {
"description": "List of volume mounts for the Container.",
"$ref": "#/definitions/volumeMounts"
},
"extraVolumes": {
"description": "Additional volumes to be mounted in the Alertmanager pod.",
"type": "array",
"default": [],
"items": {
"type": "object",
"required": ["name"],
"properties": {
"name": {
"type": "string"
}
}
}
},
"extraEnv": {
"description": "List of environment variables for the Container.",
"$ref": "#/definitions/env"
},
"testFramework": {
"description": "Configuration for the test Pod.",
"type": "object",
"properties": {
"enabled": {
"description": "Specifies whether the test Pod is enabled.",
"type": "boolean",
"default": false
},
"annotations": {
"description": "Annotations to be added to the test Pod.",
"type": "object"
}
}
}
}
}
+270
View File
@@ -0,0 +1,270 @@
# yaml-language-server: $schema=values.schema.json
# Default values for alertmanager.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
replicaCount: 1
image:
repository: quay.io/prometheus/alertmanager
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: ""
extraArgs: {}
## Additional Alertmanager Secret mounts
# Defines additional mounts with secrets. Secrets must be manually created in the namespace.
extraSecretMounts: []
# - name: secret-files
# mountPath: /etc/secrets
# subPath: ""
# secretName: alertmanager-secret-files
# readOnly: true
imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""
## namespaceOverride overrides the namespace which the resources will be deployed in
namespaceOverride: ""
automountServiceAccountToken: true
serviceAccount:
# Specifies whether a service account should be created
create: true
# Annotations to add to the service account
annotations: {}
# The name of the service account to use.
# If not set and create is true, a name is generated using the fullname template
name: ""
# Sets priorityClassName in alertmanager pod
priorityClassName: ""
# Sets schedulerName in alertmanager pod
schedulerName: ""
podSecurityContext:
fsGroup: 65534
dnsConfig: {}
# nameservers:
# - 1.2.3.4
# searches:
# - ns1.svc.cluster-domain.example
# - my.dns.search.suffix
# options:
# - name: ndots
# value: "2"
# - name: edns0
hostAliases: []
# - ip: "127.0.0.1"
# hostnames:
# - "foo.local"
# - "bar.local"
# - ip: "10.1.2.3"
# hostnames:
# - "foo.remote"
# - "bar.remote"
securityContext:
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
runAsUser: 65534
runAsNonRoot: true
runAsGroup: 65534
additionalPeers: []
## Additional InitContainers to initialize the pod
##
extraInitContainers: []
## Additional containers to add to the stateful set. This will allow to setup sidecarContainers like a proxy to integrate
## alertmanager with an external tool like teams that has not direct integration.
##
extraContainers: []
livenessProbe:
httpGet:
path: /
port: http
readinessProbe:
httpGet:
path: /
port: http
service:
annotations: {}
type: ClusterIP
port: 9093
clusterPort: 9094
loadBalancerIP: "" # Assign ext IP when Service type is LoadBalancer
loadBalancerSourceRanges: [] # Only allow access to loadBalancerIP from these IPs
# if you want to force a specific nodePort. Must be use with service.type=NodePort
# nodePort:
ingress:
enabled: false
className: ""
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
hosts:
- host: alertmanager.domain.com
paths:
- path: /
pathType: ImplementationSpecific
tls: []
# - secretName: chart-example-tls
# hosts:
# - alertmanager.domain.com
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 10m
# memory: 32Mi
nodeSelector: {}
tolerations: []
affinity: {}
## Pod anti-affinity can prevent the scheduler from placing Alertmanager replicas on the same node.
## The default value "soft" means that the scheduler should *prefer* to not schedule two replica pods onto the same node but no guarantee is provided.
## The value "hard" means that the scheduler is *required* to not schedule two replica pods onto the same node.
## The value "" will disable pod anti-affinity so that no anti-affinity rules will be configured.
##
podAntiAffinity: ""
## If anti-affinity is enabled sets the topologyKey to use for anti-affinity.
## This can be changed to, for example, failure-domain.beta.kubernetes.io/zone
##
podAntiAffinityTopologyKey: kubernetes.io/hostname
## Topology spread constraints rely on node labels to identify the topology domain(s) that each Node is in.
## Ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/
topologySpreadConstraints: []
# - maxSkew: 1
# topologyKey: failure-domain.beta.kubernetes.io/zone
# whenUnsatisfiable: DoNotSchedule
# labelSelector:
# matchLabels:
# app.kubernetes.io/instance: alertmanager
statefulSet:
annotations: {}
podAnnotations: {}
podLabels: {}
# Ref: https://kubernetes.io/docs/tasks/run-application/configure-pdb/
podDisruptionBudget: {}
# maxUnavailable: 1
# minAvailable: 1
command: []
persistence:
enabled: true
## Persistent Volume Storage Class
## If defined, storageClassName: <storageClass>
## If set to "-", storageClassName: "", which disables dynamic provisioning
## If undefined (the default) or set to null, no storageClassName spec is
## set, choosing the default provisioner.
##
# storageClass: "-"
accessModes:
- ReadWriteOnce
size: 50Mi
configAnnotations: {}
## For example if you want to provide private data from a secret vault
## https://github.com/banzaicloud/bank-vaults/tree/main/charts/vault-secrets-webhook
## P.s.: Add option `configMapMutation: true` for vault-secrets-webhook
# vault.security.banzaicloud.io/vault-role: "admin"
# vault.security.banzaicloud.io/vault-addr: "https://vault.vault.svc.cluster.local:8200"
# vault.security.banzaicloud.io/vault-skip-verify: "true"
# vault.security.banzaicloud.io/vault-path: "kubernetes"
## Example for inject secret
# slack_api_url: '${vault:secret/data/slack-hook-alerts#URL}'
config:
global: {}
# slack_api_url: ''
templates:
- '/etc/alertmanager/*.tmpl'
receivers:
- name: default-receiver
# slack_configs:
# - channel: '@you'
# send_resolved: true
route:
group_wait: 10s
group_interval: 5m
receiver: default-receiver
repeat_interval: 3h
## Monitors ConfigMap changes and POSTs to a URL
## Ref: https://github.com/jimmidyson/configmap-reload
##
configmapReload:
## If false, the configmap-reload container will not be deployed
##
enabled: false
## configmap-reload container name
##
name: configmap-reload
## configmap-reload container image
##
image:
repository: jimmidyson/configmap-reload
tag: v0.8.0
pullPolicy: IfNotPresent
# containerPort: 9533
## configmap-reload resource requests and limits
## Ref: http://kubernetes.io/docs/user-guide/compute-resources/
##
resources: {}
templates: {}
# alertmanager.tmpl: |-
## Optionally specify extra list of additional volumeMounts
extraVolumeMounts: []
# - name: extras
# mountPath: /usr/share/extras
# readOnly: true
## Optionally specify extra list of additional volumes
extraVolumes: []
# - name: extras
# emptyDir: {}
## Optionally specify extra environment variables to add to alertmanager container
extraEnv: []
# - name: FOO
# value: BAR
testFramework:
enabled: false
annotations:
"helm.sh/hook": test-success
# "helm.sh/hook-delete-policy": "before-hook-creation,hook-succeeded"
+29
View File
@@ -0,0 +1,29 @@
# 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/
# Don't package templates.
README.md.gotmpl
# Don't packages the tests used for CI.
/tests/
+78
View File
@@ -0,0 +1,78 @@
# Changelog
> _Contributors should read our [contributors guide][] for instructions on how
> to update the changelog._
This document contains a historical list of changes between releases. Only
changes that impact end-user behavior are listed; changes to documentation or
internal API changes are not present.
Unreleased
----------
0.5.1 (2023-07-11)
------------------
### Other changes
Update helm chart to use v1.2.1.
0.5.0 (2024-07-08)
------------------
### Enhancements
- Only utilize spec.internalTrafficPolicy in the Service if deploying to Kubernetes 1.26 or later. (@petewall)
0.4.0 (2024-06-26)
------------------
### Enhancements
- Update to Grafana Alloy v1.2.0. (@ptodev)
0.3.2 (2024-05-30)
------------------
### Bugfixes
- Update to Grafana Alloy v1.1.1. (@rfratto)
0.3.1 (2024-05-22)
------------------
### Bugfixes
- Fix clustering on instances running within Istio mesh by allowing to change the name of the clustering port
0.3.0 (2024-05-14)
------------------
### Enhancements
- Update to Grafana Alloy v1.1.0. (@rfratto)
0.2.0 (2024-05-08)
------------------
### Other changes
- Support all [Kubernetes recommended labels](https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/) (@nlamirault)
0.1.1 (2024-04-11)
------------------
### Other changes
- Add missing Alloy icon to Chart.yaml. (@rfratto)
0.1.0 (2024-04-09)
------------------
### Features
- Introduce a Grafana Alloy Helm chart. The Grafana Alloy Helm chart is
backwards compatibile with the values.yaml from the `grafana-agent` Helm
chart. Review the Helm chart README for a description on how to migrate.
(@rfratto)
+6
View File
@@ -0,0 +1,6 @@
dependencies:
- name: crds
repository: ""
version: 0.0.0
digest: sha256:1980431a3d80822fca2e67e9cf16ff7a7f8d1dc87deb9e44d50e85e3e8e33a81
generated: "2024-07-11T18:59:15.53929882Z"
+12
View File
@@ -0,0 +1,12 @@
apiVersion: v2
appVersion: v1.3.1
dependencies:
- condition: crds.create
name: crds
repository: ""
version: 0.0.0
description: Grafana Alloy
icon: https://raw.githubusercontent.com/grafana/alloy/main/docs/sources/assets/alloy_icon_orange.svg
name: alloy
type: application
version: 0.5.1
+281
View File
@@ -0,0 +1,281 @@
# Grafana Alloy Helm chart
![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![Version: 0.5.1](https://img.shields.io/badge/Version-0.5.1-informational?style=flat-square) ![AppVersion: v1.2.1](https://img.shields.io/badge/AppVersion-v1.2.1-informational?style=flat-square)
Helm chart for deploying [Grafana Alloy][] to Kubernetes.
[Grafana Alloy]: https://grafana.com/docs/alloy/latest/
## Usage
### Setup Grafana chart repository
```
helm repo add grafana https://grafana.github.io/helm-charts
helm repo update
```
### Install chart
To install the chart with the release name my-release:
`helm install my-release grafana/alloy`
This chart installs one instance of Grafana Alloy into your Kubernetes cluster
using a specific Kubernetes controller. By default, DaemonSet is used. The
`controller.type` value can be used to change the controller to either a
StatefulSet or Deployment.
Creating multiple installations of the Helm chart with different controllers is
useful if just using the default DaemonSet isn't sufficient.
## Values
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| alloy.clustering.enabled | bool | `false` | Deploy Alloy in a cluster to allow for load distribution. |
| alloy.clustering.portName | string | `"http"` | Name for the port used for clustering, useful if running inside an Istio Mesh |
| alloy.configMap.content | string | `""` | Content to assign to the new ConfigMap. This is passed into `tpl` allowing for templating from values. |
| alloy.configMap.create | bool | `true` | Create a new ConfigMap for the config file. |
| alloy.configMap.key | string | `nil` | Key in ConfigMap to get config from. |
| alloy.configMap.name | string | `nil` | Name of existing ConfigMap to use. Used when create is false. |
| alloy.enableReporting | bool | `true` | Enables sending Grafana Labs anonymous usage stats to help improve Grafana Alloy. |
| alloy.envFrom | list | `[]` | Maps all the keys on a ConfigMap or Secret as environment variables. https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.24/#envfromsource-v1-core |
| alloy.extraArgs | list | `[]` | Extra args to pass to `alloy run`: https://grafana.com/docs/alloy/latest/reference/cli/run/ |
| alloy.extraEnv | list | `[]` | Extra environment variables to pass to the Alloy container. |
| alloy.extraPorts | list | `[]` | Extra ports to expose on the Alloy container. |
| alloy.listenAddr | string | `"0.0.0.0"` | Address to listen for traffic on. 0.0.0.0 exposes the UI to other containers. |
| alloy.listenPort | int | `12345` | Port to listen for traffic on. |
| alloy.listenScheme | string | `"HTTP"` | Scheme is needed for readiness probes. If enabling tls in your configs, set to "HTTPS" |
| alloy.mounts.dockercontainers | bool | `false` | Mount /var/lib/docker/containers from the host into the container for log collection. |
| alloy.mounts.extra | list | `[]` | Extra volume mounts to add into the Grafana Alloy container. Does not affect the watch container. |
| alloy.mounts.varlog | bool | `false` | Mount /var/log from the host into the container for log collection. |
| alloy.resources | object | `{}` | Resource requests and limits to apply to the Grafana Alloy container. |
| alloy.securityContext | object | `{}` | Security context to apply to the Grafana Alloy container. |
| alloy.stabilityLevel | string | `"generally-available"` | Minimum stability level of components and behavior to enable. Must be one of "experimental", "public-preview", or "generally-available". |
| alloy.storagePath | string | `"/tmp/alloy"` | Path to where Grafana Alloy stores data (for example, the Write-Ahead Log). By default, data is lost between reboots. |
| alloy.uiPathPrefix | string | `"/"` | Base path where the UI is exposed. |
| configReloader.customArgs | list | `[]` | Override the args passed to the container. |
| configReloader.enabled | bool | `true` | Enables automatically reloading when the Alloy config changes. |
| configReloader.image.digest | string | `""` | SHA256 digest of image to use for config reloading (either in format "sha256:XYZ" or "XYZ"). When set, will override `configReloader.image.tag` |
| configReloader.image.registry | string | `"ghcr.io"` | Config reloader image registry (defaults to docker.io) |
| configReloader.image.repository | string | `"jimmidyson/configmap-reload"` | Repository to get config reloader image from. |
| configReloader.image.tag | string | `"v0.12.0"` | Tag of image to use for config reloading. |
| configReloader.resources | object | `{"requests":{"cpu":"1m","memory":"5Mi"}}` | Resource requests and limits to apply to the config reloader container. |
| configReloader.securityContext | object | `{}` | Security context to apply to the Grafana configReloader container. |
| controller.affinity | object | `{}` | Affinity configuration for pods. |
| controller.autoscaling.enabled | bool | `false` | Creates a HorizontalPodAutoscaler for controller type deployment. |
| controller.autoscaling.maxReplicas | int | `5` | The upper limit for the number of replicas to which the autoscaler can scale up. |
| controller.autoscaling.minReplicas | int | `1` | The lower limit for the number of replicas to which the autoscaler can scale down. |
| controller.autoscaling.scaleDown.policies | list | `[]` | List of policies to determine the scale-down behavior. |
| controller.autoscaling.scaleDown.selectPolicy | string | `"Max"` | Determines which of the provided scaling-down policies to apply if multiple are specified. |
| controller.autoscaling.scaleDown.stabilizationWindowSeconds | int | `300` | The duration that the autoscaling mechanism should look back on to make decisions about scaling down. |
| controller.autoscaling.scaleUp.policies | list | `[]` | List of policies to determine the scale-up behavior. |
| controller.autoscaling.scaleUp.selectPolicy | string | `"Max"` | Determines which of the provided scaling-up policies to apply if multiple are specified. |
| controller.autoscaling.scaleUp.stabilizationWindowSeconds | int | `0` | The duration that the autoscaling mechanism should look back on to make decisions about scaling up. |
| controller.autoscaling.targetCPUUtilizationPercentage | int | `0` | Average CPU utilization across all relevant pods, a percentage of the requested value of the resource for the pods. Setting `targetCPUUtilizationPercentage` to 0 will disable CPU scaling. |
| controller.autoscaling.targetMemoryUtilizationPercentage | int | `80` | Average Memory utilization across all relevant pods, a percentage of the requested value of the resource for the pods. Setting `targetMemoryUtilizationPercentage` to 0 will disable Memory scaling. |
| controller.dnsPolicy | string | `"ClusterFirst"` | Configures the DNS policy for the pod. https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pod-s-dns-policy |
| controller.enableStatefulSetAutoDeletePVC | bool | `false` | Whether to enable automatic deletion of stale PVCs due to a scale down operation, when controller.type is 'statefulset'. |
| controller.extraAnnotations | object | `{}` | Annotations to add to controller. |
| controller.extraContainers | list | `[]` | Additional containers to run alongside the Alloy container and initContainers. |
| controller.hostNetwork | bool | `false` | Configures Pods to use the host network. When set to true, the ports that will be used must be specified. |
| controller.hostPID | bool | `false` | Configures Pods to use the host PID namespace. |
| controller.initContainers | list | `[]` | |
| controller.nodeSelector | object | `{}` | nodeSelector to apply to Grafana Alloy pods. |
| controller.parallelRollout | bool | `true` | Whether to deploy pods in parallel. Only used when controller.type is 'statefulset'. |
| controller.podAnnotations | object | `{}` | Extra pod annotations to add. |
| controller.podLabels | object | `{}` | Extra pod labels to add. |
| controller.priorityClassName | string | `""` | priorityClassName to apply to Grafana Alloy pods. |
| controller.replicas | int | `1` | Number of pods to deploy. Ignored when controller.type is 'daemonset'. |
| controller.tolerations | list | `[]` | Tolerations to apply to Grafana Alloy pods. |
| controller.topologySpreadConstraints | list | `[]` | Topology Spread Constraints to apply to Grafana Alloy pods. |
| controller.type | string | `"daemonset"` | Type of controller to use for deploying Grafana Alloy in the cluster. Must be one of 'daemonset', 'deployment', or 'statefulset'. |
| controller.updateStrategy | object | `{}` | Update strategy for updating deployed Pods. |
| controller.volumeClaimTemplates | list | `[]` | volumeClaimTemplates to add when controller.type is 'statefulset'. |
| controller.volumes.extra | list | `[]` | Extra volumes to add to the Grafana Alloy pod. |
| crds.create | bool | `true` | Whether to install CRDs for monitoring. |
| fullnameOverride | string | `nil` | Overrides the chart's computed fullname. Used to change the full prefix of resource names. |
| global.image.pullSecrets | list | `[]` | Optional set of global image pull secrets. |
| global.image.registry | string | `""` | Global image registry to use if it needs to be overriden for some specific use cases (e.g local registries, custom images, ...) |
| global.podSecurityContext | object | `{}` | Security context to apply to the Grafana Alloy pod. |
| image.digest | string | `nil` | Grafana Alloy image's SHA256 digest (either in format "sha256:XYZ" or "XYZ"). When set, will override `image.tag`. |
| image.pullPolicy | string | `"IfNotPresent"` | Grafana Alloy image pull policy. |
| image.pullSecrets | list | `[]` | Optional set of image pull secrets. |
| image.registry | string | `"docker.io"` | Grafana Alloy image registry (defaults to docker.io) |
| image.repository | string | `"grafana/alloy"` | Grafana Alloy image repository. |
| image.tag | string | `nil` | Grafana Alloy image tag. When empty, the Chart's appVersion is used. |
| ingress.annotations | object | `{}` | |
| ingress.enabled | bool | `false` | Enables ingress for Alloy (Faro port) |
| ingress.extraPaths | list | `[]` | |
| ingress.faroPort | int | `12347` | |
| ingress.hosts[0] | string | `"chart-example.local"` | |
| ingress.labels | object | `{}` | |
| ingress.path | string | `"/"` | |
| ingress.pathType | string | `"Prefix"` | |
| ingress.tls | list | `[]` | |
| nameOverride | string | `nil` | Overrides the chart's name. Used to change the infix in the resource names. |
| rbac.create | bool | `true` | Whether to create RBAC resources for Alloy. |
| service.annotations | object | `{}` | |
| service.clusterIP | string | `""` | Cluster IP, can be set to None, empty "" or an IP address |
| service.enabled | bool | `true` | Creates a Service for the controller's pods. |
| service.internalTrafficPolicy | string | `"Cluster"` | Value for internal traffic policy. 'Cluster' or 'Local' |
| service.nodePort | int | `31128` | NodePort port. Only takes effect when `service.type: NodePort` |
| service.type | string | `"ClusterIP"` | Service type |
| serviceAccount.additionalLabels | object | `{}` | Additional labels to add to the created service account. |
| serviceAccount.annotations | object | `{}` | Annotations to add to the created service account. |
| serviceAccount.create | bool | `true` | Whether to create a service account for the Grafana Alloy deployment. |
| serviceAccount.name | string | `nil` | The name of the existing service account to use when serviceAccount.create is false. |
| serviceMonitor.additionalLabels | object | `{}` | Additional labels for the service monitor. |
| serviceMonitor.enabled | bool | `false` | |
| serviceMonitor.interval | string | `""` | Scrape interval. If not set, the Prometheus default scrape interval is used. |
| serviceMonitor.metricRelabelings | list | `[]` | MetricRelabelConfigs to apply to samples after scraping, but before ingestion. ref: https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#relabelconfig |
| serviceMonitor.relabelings | list | `[]` | RelabelConfigs to apply to samples before scraping ref: https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#relabelconfig |
| serviceMonitor.tlsConfig | object | `{}` | Customize tls parameters for the service monitor |
#### Migrate from `grafana/grafana-agent` chart to `grafana/alloy`
The `values.yaml` file for the `grafana/grafana-agent` chart is compatible with
the chart for `grafana/alloy`, with two exceptions:
* The `agent` field in `values.yaml` is deprecated in favor of `alloy`. Support
for the `agent` field will be removed in a future release.
* The default value for `alloy.listenPort` is `12345` to align with the default
listen port in other installations. To retain the previous default, set
`alloy.listenPort` to `80` when installing.
### alloy.stabilityLevel
`alloy.stabilityLevel` controls the minimum level of stability for what
components can be created (directly or through imported modules). Note that
setting this field to a lower stability may also enable internal behaviour of a
lower stability, such as experimental memory optimizations.
Valid settings are `experimental`, `public-preview`, and `generally-available`.
### alloy.extraArgs
`alloy.extraArgs` allows for passing extra arguments to the Grafana Alloy
container. The list of available arguments is documented on [alloy run][].
> **WARNING**: Using `alloy.extraArgs` does not have a stable API. Things may
> break between Chart upgrade if an argument gets added to the template.
[alloy run]: https://grafana.com/docs/alloy/latest/reference/cli/run/
### alloy.extraPorts
`alloy.extraPorts` allows for configuring specific open ports.
The detained specification of ports can be found at the [Kubernetes Pod documents](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#ports).
Port numbers specified must be 0 < x < 65535.
| ChartPort | KubePort | Description |
|-----------|----------|-------------|
| targetPort | containerPort | Number of port to expose on the pod's IP address. |
| hostPort | hostPort | (Optional) Number of port to expose on the host. Daemonsets taking traffic might find this useful. |
| name | name | If specified, this must be an `IANA_SVC_NAME` and unique within the pod. Each named port in a pod must have a unique name. Name for the port that can be referred to by services.
| protocol | protocol | Must be UDP, TCP, or SCTP. Defaults to "TCP". |
### alloy.listenAddr
`alloy.listenAddr` allows for restricting which address Alloy listens on
for network traffic on its HTTP server. By default, this is `0.0.0.0` to allow
its UI to be exposed when port-forwarding and to expose its metrics to other
Alloy instances in the cluster.
### alloy.configMap.config
`alloy.configMap.content` holds the Grafana Alloy configuration to use.
If `alloy.configMap.content` is not provided, a [default configuration file][default-config] is
used. When provided, `alloy.configMap.content` must hold a valid Alloy configuration file.
[default-config]: ./config/example.alloy
### alloy.securityContext
`alloy.securityContext` sets the securityContext passed to the Grafana
Alloy container.
By default, Grafana Alloy containers are not able to collect telemetry from the
host node or other specific types of privileged telemetry data. See [Collecting
logs from other containers][#collecting-logs-from-other-containers] and
[Collecting host node telemetry][#collecting-host-node-telemetry] below for
more information on how to enable these capabilities.
### rbac.create
`rbac.create` enables the creation of ClusterRole and ClusterRoleBindings for
the Grafana Alloy containers to use. The default permission set allows
components like [discovery.kubernetes][] to work properly.
[discovery.kubernetes]: https://grafana.com/docs/alloy/latest/reference/components/discovery.kubernetes/
### controller.autoscaling
`controller.autoscaling.enabled` enables the creation of a HorizontalPodAutoscaler. It is only used when `controller.type` is set to `deployment` or `statefulset`.
`controller.autoscaling` is intended to be used with [clustered][] mode.
> **WARNING**: Using `controller.autoscaling` for any other Grafana Alloy
> configuration could lead to redundant or double telemetry collection.
[clustered]: https://grafana.com/docs/alloy/latest/reference/cli/run/#clustered-mode
When using autoscaling with a StatefulSet controller and have enabled
volumeClaimTemplates to be created alongside the StatefulSet, it is possible to
leak up to `maxReplicas` PVCs when the HPA is scaling down. If you're on
Kubernetes version `>=1.23-0` and your cluster has the
`StatefulSetAutoDeletePVC` feature gate enabled, you can set
`enableStatefulSetAutoDeletePVC` to true to automatically delete stale PVCs.
Using `controller.autoscaling` requires the target metric (cpu/memory) to have
its resource requests set up for both the Alloy and config-reloader containers
so that the HPA can use them to calculate the replica count from the actual
resource utilization.
## Collecting logs from other containers
There are two ways to collect logs from other containers within the cluster
Alloy is deployed in.
### loki.source.kubernetes
The [loki.source.kubernetes][] component may be used to collect logs from
containers using the Kubernetes API. This component does not require mounting
the hosts filesystem into Alloy, nor requires additional security contexts to
work correctly.
[loki.source.kubernetes]: https://grafana.com/docs/alloy/latest/reference/components/loki.source.kubernetes/
### File-based collection
Logs may also be collected by mounting the host's filesystem into the Alloy
container, bypassing the need to communicate with the Kubrnetes API.
To mount logs from other containers to Grafana Alloy directly:
* Set `alloy.mounts.dockercontainers` to `true`.
* Set `alloy.securityContext` to:
```yaml
privileged: true
runAsUser: 0
```
## Collecting host node telemetry
Telemetry from the host, such as host-specific log files (from `/var/logs`) or
metrics from `/proc` and `/sys` are not accessible to Grafana Alloy containers.
To expose this information to Grafana Alloy for telemetry collection:
* Set `alloy.mounts.dockercontainers` to `true`.
* Mount `/proc` and `/sys` from the host into the container.
* Set `alloy.securityContext` to:
```yaml
privileged: true
runAsUser: 0
```
@@ -0,0 +1,3 @@
apiVersion: v2
name: crds
version: 0.0.0
@@ -0,0 +1,205 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.9.2
creationTimestamp: null
name: podlogs.monitoring.grafana.com
spec:
group: monitoring.grafana.com
names:
categories:
- grafana-alloy
- alloy
kind: PodLogs
listKind: PodLogsList
plural: podlogs
singular: podlogs
scope: Namespaced
versions:
- name: v1alpha2
schema:
openAPIV3Schema:
description: PodLogs defines how to collect logs for a Pod.
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: PodLogsSpec defines how to collect logs for a Pod.
properties:
namespaceSelector:
description: Selector to select which namespaces the Pod objects are
discovered from.
properties:
matchExpressions:
description: matchExpressions is a list of label selector requirements.
The requirements are ANDed.
items:
description: A label selector requirement is a selector that
contains values, a key, and an operator that relates the key
and values.
properties:
key:
description: key is the label key that the selector applies
to.
type: string
operator:
description: operator represents a key's relationship to
a set of values. Valid operators are In, NotIn, Exists
and DoesNotExist.
type: string
values:
description: values is an array of string values. If the
operator is In or NotIn, the values array must be non-empty.
If the operator is Exists or DoesNotExist, the values
array must be empty. This array is replaced during a strategic
merge patch.
items:
type: string
type: array
required:
- key
- operator
type: object
type: array
matchLabels:
additionalProperties:
type: string
description: matchLabels is a map of {key,value} pairs. A single
{key,value} in the matchLabels map is equivalent to an element
of matchExpressions, whose key field is "key", the operator
is "In", and the values array contains only "value". The requirements
are ANDed.
type: object
type: object
x-kubernetes-map-type: atomic
relabelings:
description: RelabelConfigs to apply to logs before delivering.
items:
description: 'RelabelConfig allows dynamic rewriting of the label
set, being applied to samples before ingestion. It defines `<metric_relabel_configs>`-section
of Prometheus configuration. More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#metric_relabel_configs'
properties:
action:
default: replace
description: Action to perform based on regex matching. Default
is 'replace'. uppercase and lowercase actions require Prometheus
>= 2.36.
enum:
- replace
- Replace
- keep
- Keep
- drop
- Drop
- hashmod
- HashMod
- labelmap
- LabelMap
- labeldrop
- LabelDrop
- labelkeep
- LabelKeep
- lowercase
- Lowercase
- uppercase
- Uppercase
type: string
modulus:
description: Modulus to take of the hash of the source label
values.
format: int64
type: integer
regex:
description: Regular expression against which the extracted
value is matched. Default is '(.*)'
type: string
replacement:
description: Replacement value against which a regex replace
is performed if the regular expression matches. Regex capture
groups are available. Default is '$1'
type: string
separator:
description: Separator placed between concatenated source label
values. default is ';'.
type: string
sourceLabels:
description: The source labels select values from existing labels.
Their content is concatenated using the configured separator
and matched against the configured regular expression for
the replace, keep, and drop actions.
items:
description: LabelName is a valid Prometheus label name which
may only contain ASCII letters, numbers, as well as underscores.
pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$
type: string
type: array
targetLabel:
description: Label to which the resulting value is written in
a replace action. It is mandatory for replace actions. Regex
capture groups are available.
type: string
type: object
type: array
selector:
description: Selector to select Pod objects. Required.
properties:
matchExpressions:
description: matchExpressions is a list of label selector requirements.
The requirements are ANDed.
items:
description: A label selector requirement is a selector that
contains values, a key, and an operator that relates the key
and values.
properties:
key:
description: key is the label key that the selector applies
to.
type: string
operator:
description: operator represents a key's relationship to
a set of values. Valid operators are In, NotIn, Exists
and DoesNotExist.
type: string
values:
description: values is an array of string values. If the
operator is In or NotIn, the values array must be non-empty.
If the operator is Exists or DoesNotExist, the values
array must be empty. This array is replaced during a strategic
merge patch.
items:
type: string
type: array
required:
- key
- operator
type: object
type: array
matchLabels:
additionalProperties:
type: string
description: matchLabels is a map of {key,value} pairs. A single
{key,value} in the matchLabels map is equivalent to an element
of matchExpressions, whose key field is "key", the operator
is "In", and the values array contains only "value". The requirements
are ANDed.
type: object
type: object
x-kubernetes-map-type: atomic
required:
- selector
type: object
type: object
served: true
storage: true
@@ -0,0 +1,3 @@
serviceAccount:
additionalLabels:
test: "true"
@@ -0,0 +1,7 @@
alloy:
clustering:
enabled: true
controller:
type: 'statefulset'
replicas: 3
@@ -0,0 +1,12 @@
controller:
volumes:
extra:
- name: cache-volume
emptyDir:
sizeLimit: 500Mi
alloy:
mounts:
extra:
- mountPath: /cache
name: cache-volume
@@ -0,0 +1,5 @@
# Test rendering of the chart with the controller explicitly set to DaemonSet.
controller:
type: daemonset
hostNetwork: true
dnsPolicy: ClusterFirstWithHostNet
@@ -0,0 +1,3 @@
# Test rendering of the chart with the controller explicitly set to DaemonSet.
controller:
type: daemonset
@@ -0,0 +1,25 @@
# Test rendering of the chart with the controller explicitly set to Deployment and autoscaling enabled.
controller:
type: deployment
autoscaling:
enabled: true
scaleDown:
policies:
- type: Pods
value: 4
periodSeconds: 60
selectPolicy: Min
stabilizationWindowSeconds: 100
scaleUp:
policies:
- type: Pods
value: 4
periodSeconds: 60
- type: Percent
value: 100
periodSeconds: 15
stabilizationWindowSeconds: 80
alloy:
resources:
requests:
memory: 100Mi
@@ -0,0 +1,3 @@
# Test rendering of the chart with the controller explicitly set to Deployment.
controller:
type: deployment
@@ -0,0 +1,10 @@
# Test rendering of the chart with the controller explicitly set to StatefulSet and autoscaling enabled.
controller:
type: statefulset
autoscaling:
enabled: true
enableStatefulSetAutoDeletePVC: true
alloy:
resources:
requests:
memory: 100Mi
@@ -0,0 +1,3 @@
# Test rendering of the chart with the controller explicitly set to StatefulSet.
controller:
type: statefulset
@@ -0,0 +1,10 @@
alloy:
configMap:
content: |-
logging {
level = "warn"
format = "logfmt"
}
discovery.kubernetes "custom_pods" {
role = "pod"
}
@@ -0,0 +1 @@
# Test rendering of the chart with everything set to the default values.
@@ -0,0 +1,9 @@
# Test rendering of the chart with the service monitor enabled
alloy:
listenScheme: HTTPS
service:
enabled: true
serviceMonitor:
enabled: true
tlsConfig:
insecureSkipVerify: true
@@ -0,0 +1,5 @@
# Test rendering of the chart with the service monitor enabled
service:
enabled: true
serviceMonitor:
enabled: true
@@ -0,0 +1,5 @@
# Specify extra ports for verifying rendering the template works
alloy:
envFrom:
- configMapRef:
name: special-config
@@ -0,0 +1,5 @@
alloy:
configMap:
create: false
name: existing-config
key: my-config.alloy
@@ -0,0 +1,9 @@
# Specify extra ports for verifying rendering the template works
alloy:
extraEnv:
- name: GREETING
value: "Warm greetings to"
- name: HONORIFIC
value: "The Most Honorable"
- name: NAME
value: "Kubernetes"
@@ -0,0 +1,7 @@
# Specify extra ports for verifying rendering the template works
alloy:
extraPorts:
- name: jaeger-thrift
port: 14268
targetPort: 14268
protocol: TCP
@@ -0,0 +1,9 @@
alloy:
extraPorts:
- name: "faro"
port: 12347
targetPort: 12347
protocol: "TCP"
ingress:
enabled: true
@@ -0,0 +1,13 @@
# Test rendering of the chart with the global image pull secret explicitly set.
global:
image:
pullSecrets:
- name: global-cred
podSecurityContext:
runAsUser: 1000
runAsGroup: 1000
image:
pullSecrets:
- name: local-cred
@@ -0,0 +1,11 @@
# Test rendering of the chart with the global image registry explicitly set to another value.
global:
image:
registry: quay.io
image:
registry: docker.com # Invalid value by default
configReloader:
image:
registry: docker.com
@@ -0,0 +1,29 @@
controller:
initContainers:
- name: geo-ip
image: ghcr.io/maxmind/geoipupdate:v6.0
volumeMounts:
- name: geoip
mountPath: /etc/geoip
volumes:
- name: geoip
emptyDir: {}
env:
- name: GEOIPUPDATE_ACCOUNT_ID
value: "geoipupdate_account_id"
- name: GEOIPUPDATE_LICENSE_KEY
value: "geoipupdate_license_key"
- name: GEOIPUPDATE_EDITION_IDS
value: "GeoLite2-ASN GeoLite2-City GeoLite2-Country"
- name: GEOIPUPDATE_DB_DIR
value: "/etc/geoip"
volumes:
extra:
- name: geoip
mountPath: /etc/geoip
alloy:
mounts:
extra:
- name: geoip
mountPath: /etc/geoip
@@ -0,0 +1,4 @@
# Test rendering of the chart with the image pull secret explicitly set.
image:
pullSecrets:
- name: local-cred
@@ -0,0 +1,7 @@
# Test rendering of the chart with the individual image registries explicitly set to another value.
image:
registry: quay.io
configReloader:
image:
registry: quay.io
@@ -0,0 +1,11 @@
controller:
nodeSelector:
key1: "value1"
tolerations:
- key: "key1"
operator: "Equal"
value: "value1"
effect: "NoSchedule"
- key: "key2"
operator: "Exists"
effect: "NoSchedule"
@@ -0,0 +1,7 @@
global:
podSecurityContext:
fsGroup: 473
alloy:
securityContext:
runAsUser: 473
runAsGroup: 473
@@ -0,0 +1,4 @@
# Test correct rendering of the pod annotations
controller:
podAnnotations:
testAnnotationKey: testAnnotationValue
@@ -0,0 +1,29 @@
controller:
extraContainers:
- name: geo-ip
image: ghcr.io/maxmind/geoipupdate:v6.0
volumeMounts:
- name: geoip
mountPath: /etc/geoip
volumes:
- name: geoip
emptyDir: {}
env:
- name: GEOIPUPDATE_ACCOUNT_ID
value: "geoipupdate_account_id"
- name: GEOIPUPDATE_LICENSE_KEY
value: "geoipupdate_license_key"
- name: GEOIPUPDATE_EDITION_IDS
value: "GeoLite2-ASN GeoLite2-City GeoLite2-Country"
- name: GEOIPUPDATE_DB_DIR
value: "/etc/geoip"
volumes:
extra:
- name: geoip
mountPath: /etc/geoip
alloy:
mounts:
extra:
- name: geoip
mountPath: /etc/geoip
@@ -0,0 +1,10 @@
controller:
type: deployment
topologySpreadConstraints:
- maxSkew: 1
topologyKey: topology.kubernetes.io/zone
whenUnsatisfiable: ScheduleAnyway
labelSelector:
matchLabels:
app.kubernetes.io/name: alloy
app.kubernetes.io/instance: alloy
@@ -0,0 +1,10 @@
image:
registry: "docker.io"
repository: "grafana/agent"
digest: "sha256:82575a7be3e4770e53f620298e58bcc4cdb0fd0338e01c4b206cae9e3ca46ebf"
configReloader:
image:
registry: "docker.io"
repository: "jimmidyson/configmap-reload"
digest: "sha256:5af9d3041d12a3e63f115125f89b66d2ba981fe82e64302ac370c5496055059c"
@@ -0,0 +1,774 @@
// kube state metrics
discovery.relabel "kube_state_metrics_pod" {
targets = [{__address__ = "kube-state-metrics-infra-prd.kube-system.svc.cluster.local:8080",}]
rule {
regex = "__meta_kubernetes_node_label_(.+)"
action = "labelmap"
}
rule {
target_label = "cluster"
replacement = "k8s-admin-prd-ase1"
}
}
prometheus.scrape "kube_state_metrics_pod" {
targets = discovery.relabel.kube_state_metrics_pod.output
forward_to = [prometheus.remote_write.mimir.receiver]
job_name = "kube_state_metrics_pod"
scrape_interval = "15s"
clustering {
enabled = true
}
}
// node metrics
discovery.kubernetes "kubernetes_endpoints" {
role = "endpoints"
}
discovery.relabel "node_exporter_endpoints" {
targets = discovery.kubernetes.kubernetes_endpoints.targets
rule {
source_labels = ["__meta_kubernetes_endpoints_name"]
regex = "prometheus-node-exporter-admin-prd"
action = "keep"
}
rule {
regex = "__meta_kubernetes_node_label_(.+)"
action = "labelmap"
}
rule {
target_label = "cluster"
replacement = "k8s-admin-prd-ase1"
}
}
prometheus.scrape "node_exporter_endpoints" {
targets = discovery.relabel.node_exporter_endpoints.output
forward_to = [prometheus.remote_write.mimir.receiver]
job_name = "node_exporter_endpoints"
scrape_interval = "15s"
clustering {
enabled = true
}
}
// cadvisor metrics
discovery.kubernetes "kubernetes_nodes" {
role = "node"
}
discovery.relabel "cadvisor_kubernetes_nodes" {
targets = discovery.kubernetes.kubernetes_nodes.targets
rule {
regex = "__meta_kubernetes_node_label_(.+)"
action = "labelmap"
}
rule {
replacement = "kubernetes.default.svc:443"
target_label = "__address__"
}
rule {
source_labels = ["__meta_kubernetes_node_name"]
regex = "(.+)"
target_label = "__metrics_path__"
replacement = "/api/v1/nodes/$1/proxy/metrics/cadvisor"
}
rule {
target_label = "cluster"
replacement = "k8s-admin-prd-ase1"
}
}
prometheus.scrape "cadvisor_kubernetes_nodes" {
targets = discovery.relabel.cadvisor_kubernetes_nodes.output
forward_to = [prometheus.remote_write.mimir.receiver]
job_name = "cadvisor_kubernetes_nodes"
scheme = "https"
scrape_interval = "15s"
authorization {
type = "Bearer"
credentials_file = "/var/run/secrets/kubernetes.io/serviceaccount/token"
}
tls_config {
ca_file = "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt"
insecure_skip_verify = true
}
clustering {
enabled = true
}
}
// kubelet metrics
discovery.relabel "kubelet_kubernetes_nodes" {
targets = discovery.kubernetes.kubernetes_nodes.targets
rule {
regex = "__meta_kubernetes_node_label_(.+)"
action = "labelmap"
}
rule {
target_label = "__address__"
replacement = "kubernetes.default.svc:443"
}
rule {
source_labels = ["__meta_kubernetes_node_name"]
regex = "(.+)"
target_label = "__metrics_path__"
replacement = "/api/v1/nodes/$1/proxy/metrics"
}
rule {
target_label = "cluster"
replacement = "k8s-admin-prd-ase1"
}
}
prometheus.scrape "kubelet_kubernetes_nodes" {
targets = discovery.relabel.kubelet_kubernetes_nodes.output
forward_to = [prometheus.remote_write.mimir.receiver]
job_name = "kubelet_kubernetes_nodes"
scheme = "https"
scrape_interval = "15s"
authorization {
type = "Bearer"
credentials_file = "/var/run/secrets/kubernetes.io/serviceaccount/token"
}
tls_config {
ca_file = "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt"
insecure_skip_verify = true
}
clustering {
enabled = true
}
}
// alloy
prometheus.exporter.self "default" {}
prometheus.scrape "alloy_pods" {
targets = prometheus.exporter.self.default.targets
forward_to = [prometheus.remote_write.mimir.receiver]
}
// mimir
discovery.kubernetes "kubernetes_pods" {
role = "pod"
}
discovery.relabel "mimir_kubernetes_pods" {
targets = discovery.kubernetes.kubernetes_pods.targets
rule {
source_labels = ["__meta_kubernetes_pod_container_port_name"]
regex = ".*metrics"
action = "keep"
}
rule {
source_labels = ["__meta_kubernetes_pod_label_helm_sh_chart"]
regex = "mimir-distributed-.*"
action = "keep"
}
rule {
source_labels = ["cluster"]
separator = ""
regex = ""
target_label = "cluster"
replacement = "k8s-admin-prd-ase1"
}
rule {
source_labels = ["__meta_kubernetes_namespace"]
target_label = "namespace"
}
rule {
source_labels = ["__meta_kubernetes_pod_name"]
target_label = "pod"
}
rule {
source_labels = ["__meta_kubernetes_pod_container_name"]
target_label = "container"
}
rule {
source_labels = ["__meta_kubernetes_pod_label_name", "__meta_kubernetes_pod_label_app_kubernetes_io_component"]
separator = ""
target_label = "__tmp_component_name"
}
rule {
source_labels = ["__meta_kubernetes_namespace", "__tmp_component_name"]
separator = "/"
target_label = "job"
}
rule {
source_labels = ["__meta_kubernetes_pod_node_name"]
target_label = "instance"
}
}
prometheus.scrape "mimir_kubernetes_pods" {
targets = discovery.relabel.mimir_kubernetes_pods.output
forward_to = [prometheus.remote_write.mimir.receiver]
job_name = "integrations/grafanamimir/metrics"
scrape_interval = "15s"
clustering {
enabled = true
}
}
// tempo
discovery.kubernetes "tempo_kubernetes_pods" {
role = "pod"
selectors {
role = "pod"
label = "app.kubernetes.io/name=tempo"
}
}
discovery.relabel "tempo_kubernetes_pods" {
targets = discovery.kubernetes.tempo_kubernetes_pods.targets
rule {
source_labels = ["__meta_kubernetes_namespace"]
action = "replace"
regex = "(.*)"
replacement = "$1"
target_label = "namespace"
}
rule {
source_labels = ["__meta_kubernetes_pod_label_app_kubernetes_io_component"]
action = "replace"
regex = "(.*)"
replacement = "$1"
target_label = "k8s_component_name"
}
rule {
source_labels = ["cluster"]
separator = ""
regex = ""
target_label = "cluster"
replacement = "k8s-admin-prd-ase1"
}
}
prometheus.scrape "tempo_kubernetes_pods" {
targets = discovery.relabel.tempo_kubernetes_pods.output
forward_to = [prometheus.relabel.tempo_kubernetes_pods.receiver]
clustering {
enabled = true
}
}
prometheus.relabel "tempo_kubernetes_pods" {
rule {
source_labels = ["namespace", "k8s_component_name"]
action = "replace"
regex = "(.*?);(.*?)"
replacement = "$1/$2"
target_label = "job"
}
forward_to = [prometheus.remote_write.mimir.receiver]
}
// loki
discovery.kubernetes "loki_kubernetes_pods" {
role = "pod"
selectors {
role = "pod"
label = "app.kubernetes.io/name=loki"
}
}
discovery.relabel "loki_kubernetes_pods" {
targets = discovery.kubernetes.loki_kubernetes_pods.targets
rule {
source_labels = ["__meta_kubernetes_namespace"]
target_label = "namespace"
}
rule {
source_labels = ["__meta_kubernetes_pod_name"]
target_label = "pod"
}
rule {
source_labels = ["__meta_kubernetes_namespace", "__meta_kubernetes_pod_label_app_kubernetes_io_name", "__meta_kubernetes_pod_label_app_kubernetes_io_component"]
separator = "/"
regex = "(.*)/(.*)/(.*)"
replacement = "${1}/${2}-${3}"
target_label = "job"
}
rule {
target_label = "cluster"
replacement = "k8s-admin-prd-ase1"
}
rule {
source_labels = ["__meta_kubernetes_pod_container_port_number"]
action = "drop"
regex = "9095"
}
}
prometheus.scrape "loki_kubernetes_pods" {
targets = discovery.relabel.loki_kubernetes_pods.output
forward_to = [prometheus.remote_write.mimir.receiver]
clustering {
enabled = true
}
}
// grafana
prometheus.scrape "grafana_metrics" {
targets = [{
__address__ = "grafana-edge-infra-prd.observability.svc.cluster.local:80",
}]
forward_to = [prometheus.remote_write.mimir.receiver]
job_name = "grafana"
scrape_interval = "15s"
scrape_timeout = "5s"
clustering {
enabled = true
}
}
// vss_qdrant_gce
discovery.relabel "vss_qdrant_gce" {
targets = concat(
[{
__address__ = "10.138.64.90:8080",
}],
[{
__address__ = "10.138.64.88:8080",
}],
[{
__address__ = "10.138.64.89:8080",
}],
[{
__address__ = "10.138.64.81:8080",
}],
[{
__address__ = "10.138.64.135:8080",
}],
[{
__address__ = "10.138.64.136:8080",
}],
[{
__address__ = "10.138.64.137:8080",
}],
[{
__address__ = "10.138.64.131:8080",
}],
[{
__address__ = "10.138.64.132:8080",
}],
[{
__address__ = "10.138.64.134:8080",
}],
[{
__address__ = "10.138.64.138:8080",
}],
[{
__address__ = "10.138.64.67:8080",
}],
[{
__address__ = "10.138.64.171:8080",
}],
[{
__address__ = "10.138.64.210:8080",
}],
[{
__address__ = "10.138.64.228:8080",
}],
[{
__address__ = "10.138.65.9:8080",
}],
[{
__address__ = "10.138.64.65:8080",
}],
[{
__address__ = "10.138.64.220:8080",
}],
[{
__address__ = "10.138.66.58:8080",
}],
[{
__address__ = "10.138.66.59:8080",
}],
[{
__address__ = "10.138.66.60:8080",
}],
[{
__address__ = "10.138.64.246:8080",
}],
[{
__address__ = "10.138.64.104:8080",
}],
[{
__address__ = "10.138.64.105:8080",
}],
[{
__address__ = "10.138.64.110:8080",
}],
[{
__address__ = "10.138.64.114:8080",
}],
[{
__address__ = "10.138.64.15:8080",
}],
[{
__address__ = "10.138.64.160:8080",
}],
[{
__address__ = "10.138.64.165:8080",
}],
[{
__address__ = "10.138.64.166:8080",
}],
[{
__address__ = "10.138.64.235:8080",
}],
[{
__address__ = "10.138.64.240:8080",
}],
[{
__address__ = "10.138.64.241:8080",
}],
[{
__address__ = "10.138.64.59:8080",
}],
[{
__address__ = "10.138.64.68:8080",
}],
[{
__address__ = "10.138.64.9:8080",
}],
[{
__address__ = "10.138.65.149:8080",
}],
[{
__address__ = "10.138.66.125:8080",
}],
[{
__address__ = "10.138.66.46:8080",
}],
[{
__address__ = "10.138.66.53:8080",
}],
[{
__address__ = "10.138.66.69:8080",
}],
)
rule {
target_label = "project"
replacement = "meesho-datascience-prd-0622"
}
rule {
source_labels = ["__meta_gce_instance_name"]
target_label = "name"
}
rule {
source_labels = ["__meta_gce_label_service"]
target_label = "app"
}
rule {
source_labels = ["__meta_gce_label_bu"]
target_label = "bu"
}
rule {
source_labels = ["__meta_gce_label_env"]
target_label = "env"
}
}
prometheus.scrape "vss_qdrant_gce" {
targets = discovery.relabel.vss_qdrant_gce.output
forward_to = [prometheus.remote_write.mimir.receiver]
job_name = "vss_qdrant_gce"
scrape_timeout = "30s"
clustering {
enabled = true
}
}
prometheus.scrape "redis_enterprise" {
targets = concat(
[{
__address__ = "internal.c21219.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c28828.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c28827.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c28826.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c28825.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c28824.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c28822.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c28821.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c28819.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c28815.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c28798.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c28796.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c28773.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c28736.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c28735.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c28928.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c28927.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c28894.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c28893.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c28857.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c28855.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c28854.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c29000.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c29023.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c29025.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c29069.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c29092.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c29160.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c29142.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c29128.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c29181.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c29184.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c29237.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c29455.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c29441.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c29440.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c29483.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c29484.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c29485.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c29516.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c29648.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c29790.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c29884.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c29951.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c29980.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c30118.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c30300.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c30447.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c30660.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c31016.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c31055.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c31408.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c31615.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c32784.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c33122.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c33538.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c33544.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c33610.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c33622.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c33623.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c33625.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c33626.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c33627.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c33617.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c33628.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c33629.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c33639.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c33734.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c33735.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c33695.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c33755.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c33812.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c33826.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c33827.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
[{
__address__ = "internal.c33828.asia-seast1-mz.gcp.cloud.rlrcp.com:8070",
}],
)
forward_to = [prometheus.remote_write.mimir.receiver]
job_name = "redis-enterprise"
scrape_interval = "30s"
scrape_timeout = "30s"
metrics_path = "/"
scheme = "https"
tls_config {
insecure_skip_verify = true
}
clustering {
enabled = true
}
}
prometheus.scrape "confluent_cloud" {
targets = [{
__address__ = "api.telemetry.confluent.cloud",
}]
forward_to = [prometheus.remote_write.mimir.receiver]
job_name = "confluent-cloud"
params = {
"resource.kafka.id" = ["lkc-6wqxz3", "lkc-nxggkv", "lkc-vn3zkj", "lkc-6w5pwj", "lkc-2j9gnm", "lkc-nxzw6z", "lkc-dv769d", "lkc-p98xq5", "lkc-8vn0k0", "lkc-r0yp97", "lkc-3wyojm", "lkc-9z11zy", "lkc-nkkxj3", "lkc-75p292"],
}
scrape_interval = "2m0s"
scrape_timeout = "2m0s"
metrics_path = "/v2/metrics/cloud/export"
scheme = "https"
basic_auth {
username = "HQMRE267JQAKS7WK"
password = "oI30bW9fJqJV5CwaJrBu1TjErowImaIJHfvkVvVcFe/ArlDy/zD2VBLX/canWLrY"
}
clustering {
enabled = true
}
}
// writers
prometheus.remote_write "mimir" {
endpoint {
url = "http://mimir-nginx.mimir-distributed.svc.clusterset.local/api/v1/push"
headers = {"X-Scope-OrgID" = "anonymous"}
tls_config {
insecure_skip_verify = true
}
queue_config {
min_shards = 25
}
}
}
// logs
discovery.kubernetes "observability_kubernetes_pods" {
role = "pod"
namespaces {
names = ["mimir-distributed", "loki-distributed", "tempo-distributed"]
}
}
loki.source.kubernetes "observability_kubernetes_pods" {
targets = discovery.kubernetes.observability_kubernetes_pods.targets
forward_to = [loki.write.loki.receiver]
}
loki.write "loki" {
endpoint {
url = "http://loki-gateway.loki-distributed.svc.cluster.local/loki/api/v1/push"
tls_config {
insecure_skip_verify = true
}
}
}
@@ -0,0 +1,701 @@
// gce_node_exporter
discovery.gce "node_exporter_a" {
project = "meesho-central-prd-0622"
zone = "asia-southeast1-a"
port = 9100
}
discovery.gce "node_exporter_b" {
project = "meesho-central-prd-0622"
zone = "asia-southeast1-b"
port = 9100
}
discovery.gce "node_exporter_c" {
project = "meesho-central-prd-0622"
zone = "asia-southeast1-c"
port = 9100
}
discovery.relabel "node_exporter_gce" {
targets = concat(
discovery.gce.node_exporter_a.targets,
discovery.gce.node_exporter_b.targets,
discovery.gce.node_exporter_c.targets,
)
rule {
source_labels = ["__meta_gce_instance_status"]
regex = "RUNNING"
action = "keep"
}
rule {
source_labels = ["__meta_gce_label_goog-k8s-cluster-name"]
regex = "k8s"
action = "drop"
}
rule {
source_labels = ["__meta_gce_label_monitoring"]
regex = "no"
action = "drop"
}
rule {
source_labels = ["__meta_gce_instance_name"]
regex = "gke-k8s-.*"
action = "drop"
}
rule {
target_label = "project"
replacement = "meesho-central-prd-0622"
}
rule {
source_labels = ["__meta_gce_instance_name"]
target_label = "name"
}
rule {
source_labels = ["__meta_gce_instance_id"]
target_label = "instance_id"
}
rule {
source_labels = ["__meta_gce_instance_status"]
target_label = "status"
}
rule {
source_labels = ["__meta_gce_private_ip"]
target_label = "private_ip"
}
rule {
source_labels = ["__meta_gce_public_ip"]
target_label = "public_ip"
}
rule {
source_labels = ["__meta_gce_label_bu"]
target_label = "bu"
}
rule {
source_labels = ["__meta_gce_label_component"]
target_label = "component"
}
rule {
source_labels = ["__meta_gce_label_env"]
target_label = "env"
}
rule {
source_labels = ["__meta_gce_label_service"]
target_label = "service"
}
rule {
source_labels = ["__meta_gce_label_team"]
target_label = "team"
}
rule {
source_labels = ["__meta_gce_label_type"]
target_label = "type"
}
rule {
source_labels = ["__meta_gce_label_alerts"]
target_label = "alerts"
}
}
prometheus.scrape "node_exporter_gce" {
targets = discovery.relabel.node_exporter_gce.output
forward_to = [prometheus.remote_write.mimir.receiver]
job_name = "node_exporter_gce"
clustering {
enabled = true
}
}
// kube state metrics
discovery.relabel "kube_state_metrics_pod" {
targets = [{__address__ = "kube-state-metrics-central-prd.kube-system.svc.cluster.local:8080",}]
rule {
regex = "__meta_kubernetes_node_label_(.+)"
action = "labelmap"
}
rule {
target_label = "cluster"
replacement = "k8s-central-prd-ase1"
}
}
prometheus.scrape "kube_state_metrics_pod" {
targets = discovery.relabel.kube_state_metrics_pod.output
forward_to = [prometheus.remote_write.mimir.receiver]
job_name = "kube_state_metrics_pod"
scrape_interval = "15s"
clustering {
enabled = true
}
}
// cadvisor metrics
discovery.kubernetes "kubernetes_nodes" {
role = "node"
}
discovery.relabel "cadvisor_kubernetes_nodes" {
targets = discovery.kubernetes.kubernetes_nodes.targets
rule {
replacement = "k8s-central-prd-ase1"
target_label = "cluster"
}
rule {
regex = "__meta_kubernetes_node_label_(.+)"
action = "labelmap"
}
rule {
replacement = "kubernetes.default.svc:443"
target_label = "__address__"
}
rule {
source_labels = ["__meta_kubernetes_node_name"]
regex = "(.+)"
target_label = "__metrics_path__"
replacement = "/api/v1/nodes/$1/proxy/metrics/cadvisor"
}
}
prometheus.scrape "cadvisor_kubernetes_nodes" {
targets = discovery.relabel.cadvisor_kubernetes_nodes.output
forward_to = [prometheus.remote_write.mimir.receiver]
job_name = "cadvisor_kubernetes_nodes"
scheme = "https"
scrape_interval = "15s"
authorization {
type = "Bearer"
credentials_file = "/var/run/secrets/kubernetes.io/serviceaccount/token"
}
tls_config {
ca_file = "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt"
insecure_skip_verify = true
}
clustering {
enabled = true
}
}
// kubelet
discovery.relabel "kubelet_kubernetes_nodes" {
targets = discovery.kubernetes.kubernetes_nodes.targets
rule {
replacement = "k8s-central-prd-ase1"
target_label = "cluster"
}
rule {
regex = "__meta_kubernetes_node_label_(.+)"
action = "labelmap"
}
rule {
target_label = "__address__"
replacement = "kubernetes.default.svc:443"
}
rule {
source_labels = ["__meta_kubernetes_node_name"]
regex = "(.+)"
target_label = "__metrics_path__"
replacement = "/api/v1/nodes/$1/proxy/metrics"
}
}
prometheus.scrape "kubelet_kubernetes_nodes" {
targets = discovery.relabel.kubelet_kubernetes_nodes.output
forward_to = [prometheus.remote_write.mimir.receiver]
job_name = "kubelet_kubernetes_nodes"
scheme = "https"
scrape_interval = "15s"
authorization {
type = "Bearer"
credentials_file = "/var/run/secrets/kubernetes.io/serviceaccount/token"
}
tls_config {
ca_file = "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt"
insecure_skip_verify = true
}
clustering {
enabled = true
}
}
// prometheus_kubernetes_endpoints
discovery.kubernetes "kubernetes_endpoints" {
role = "endpoints"
}
discovery.relabel "prometheus_kubernetes_endpoints" {
targets = discovery.kubernetes.kubernetes_endpoints.targets
rule {
source_labels = ["__meta_kubernetes_pod_container_init"]
regex = "true"
action = "drop"
}
rule {
source_labels = ["__meta_kubernetes_service_annotation_prometheus_io_port"]
target_label = "__meta_kubernetes_pod_container_port_number"
action = "keepequal"
}
rule {
source_labels = ["__meta_kubernetes_service_annotation_prometheus_io_scrape"]
regex = "true"
action = "keep"
}
rule {
source_labels = ["__meta_kubernetes_service_annotation_prometheus_io_path"]
regex = "(.+)"
target_label = "__metrics_path__"
}
rule {
source_labels = ["__address__", "__meta_kubernetes_service_annotation_prometheus_io_port"]
regex = "([^:]+)(?::\\d+)?;(\\d+)"
target_label = "__address__"
replacement = "$1:$2"
}
rule {
regex = "__meta_kubernetes_node_label_(.+)"
action = "labelmap"
}
rule {
regex = "__meta_kubernetes_service_label_(.+)"
action = "labelmap"
}
rule {
source_labels = ["__meta_kubernetes_namespace"]
target_label = "kubernetes_namespace"
}
rule {
source_labels = ["__meta_kubernetes_endpoint_node_name"]
target_label = "kubernetes_node"
}
rule {
source_labels = ["__meta_kubernetes_service_name"]
target_label = "kubernetes_service_name"
}
rule {
source_labels = ["__meta_kubernetes_endpoints_name"]
target_label = "kubernetes_endpoints_name"
}
rule {
source_labels = ["__meta_kubernetes_pod_name"]
target_label = "kubernetes_pod_name"
}
rule {
target_label = "cluster"
replacement = "k8s-central-prd-ase1"
}
}
prometheus.scrape "prometheus_kubernetes_endpoints" {
targets = discovery.relabel.prometheus_kubernetes_endpoints.output
forward_to = [prometheus.remote_write.mimir.receiver]
job_name = "prometheus_kubernetes_endpoints"
clustering {
enabled = true
}
}
// prometheus_kubernetes_pods
discovery.kubernetes "kubernetes_pods" {
role = "pod"
}
discovery.relabel "prometheus_kubernetes_pods" {
targets = discovery.kubernetes.kubernetes_pods.targets
rule {
source_labels = ["__meta_kubernetes_pod_container_init"]
regex = "true"
action = "drop"
}
rule {
source_labels = ["__meta_kubernetes_pod_annotation_prometheus_io_port"]
target_label = "__meta_kubernetes_pod_container_port_number"
action = "keepequal"
}
rule {
source_labels = ["__meta_kubernetes_pod_annotation_prometheus_io_scrape"]
regex = "true"
action = "keep"
}
rule {
source_labels = ["__meta_kubernetes_pod_annotation_prometheus_io_path"]
regex = "(.+)"
target_label = "__metrics_path__"
}
rule {
source_labels = ["__address__", "__meta_kubernetes_pod_annotation_prometheus_io_port"]
regex = "([^:]+)(?::\\d+)?;(\\d+)"
target_label = "__address__"
replacement = "$1:$2"
}
rule {
regex = "__meta_kubernetes_node_label_(.+)"
action = "labelmap"
}
rule {
regex = "__meta_kubernetes_pod_label_(.+)"
action = "labelmap"
}
rule {
source_labels = ["__meta_kubernetes_namespace"]
target_label = "kubernetes_namespace"
}
rule {
source_labels = ["__meta_kubernetes_pod_node_name"]
target_label = "kubernetes_node"
}
rule {
source_labels = ["__meta_kubernetes_pod_name"]
target_label = "kubernetes_pod_name"
}
rule {
target_label = "cluster"
replacement = "k8s-central-prd-ase1"
}
}
prometheus.scrape "prometheus_kubernetes_pods" {
targets = discovery.relabel.prometheus_kubernetes_pods.output
forward_to = [prometheus.remote_write.mimir.receiver]
job_name = "prometheus_kubernetes_pods"
clustering {
enabled = true
}
}
// jmx_kubernetes_pods
discovery.relabel "jmx_kubernetes_pods" {
targets = discovery.kubernetes.kubernetes_pods.targets
rule {
source_labels = ["__meta_kubernetes_pod_container_init"]
regex = "true"
action = "drop"
}
rule {
source_labels = ["__meta_kubernetes_pod_annotation_jmx_io_port"]
target_label = "__meta_kubernetes_pod_container_port_number"
action = "keepequal"
}
rule {
source_labels = ["__meta_kubernetes_pod_annotation_jmx_io_scrape"]
regex = "true"
action = "keep"
}
rule {
source_labels = ["__meta_kubernetes_pod_annotation_jmx_io_path"]
regex = "(.+)"
target_label = "__metrics_path__"
}
rule {
source_labels = ["__address__", "__meta_kubernetes_pod_annotation_jmx_io_port"]
regex = "([^:]+)(?::\\d+)?;(\\d+)"
target_label = "__address__"
replacement = "$1:$2"
}
rule {
regex = "__meta_kubernetes_node_label_(.+)"
action = "labelmap"
}
rule {
regex = "__meta_kubernetes_pod_label_(.+)"
action = "labelmap"
}
rule {
source_labels = ["__meta_kubernetes_namespace"]
target_label = "kubernetes_namespace"
}
rule {
source_labels = ["__meta_kubernetes_pod_node_name"]
target_label = "kubernetes_node"
}
rule {
source_labels = ["__meta_kubernetes_pod_name"]
target_label = "kubernetes_pod_name"
}
rule {
target_label = "cluster"
replacement = "k8s-central-prd-ase1"
}
}
prometheus.scrape "jmx_kubernetes_pods" {
targets = discovery.relabel.jmx_kubernetes_pods.output
forward_to = [prometheus.remote_write.mimir.receiver]
job_name = "jmx_kubernetes_pods"
clustering {
enabled = true
}
}
// zookeeper
discovery.gce "zookeeper_a" {
project = "meesho-central-prd-0622"
zone = "asia-southeast1-a"
port = 7000
}
discovery.gce "zookeeper_b" {
project = "meesho-central-prd-0622"
zone = "asia-southeast1-b"
port = 7000
}
discovery.gce "zookeeper_c" {
project = "meesho-central-prd-0622"
zone = "asia-southeast1-b"
port = 7000
}
discovery.relabel "zookeeper_gce" {
targets = concat(
discovery.gce.zookeeper_a.targets,
discovery.gce.zookeeper_b.targets,
discovery.gce.zookeeper_c.targets,
)
rule {
source_labels = ["__meta_gce_label_service"]
regex = "(central-zookeeper)"
action = "keep"
}
rule {
target_label = "component"
replacement = "zookeeper"
}
rule {
target_label = "priority"
replacement = "p0"
}
rule {
target_label = "project"
replacement = "meesho-central-prd-0622"
}
rule {
source_labels = ["__meta_gce_label_bu"]
target_label = "bu"
}
rule {
source_labels = ["__meta_gce_label_team"]
target_label = "team"
}
rule {
source_labels = ["__meta_gce_label_service"]
target_label = "app"
}
rule {
source_labels = ["__meta_gce_label_type"]
target_label = "type"
}
rule {
source_labels = ["__meta_gce_label_env"]
target_label = "env"
}
rule {
source_labels = ["__meta_gce_instance_name"]
target_label = "name"
}
}
prometheus.scrape "zookeeper_gce" {
targets = discovery.relabel.zookeeper_gce.output
forward_to = [prometheus.remote_write.mimir.receiver]
job_name = "zookeeper_gce"
clustering {
enabled = true
}
}
prometheus.exporter.self "default" {}
prometheus.scrape "alloy_pods" {
targets = prometheus.exporter.self.default.targets
forward_to = [prometheus.remote_write.mimir.receiver]
}
// recivers
otelcol.receiver.otlp "otlp_receiver" {
grpc {
endpoint = "0.0.0.0:4317"
}
http {
endpoint = "0.0.0.0:4318"
}
output {
metrics = [otelcol.processor.k8sattributes.add_metadata.input]
logs = [otelcol.processor.filter.error_warn_logs.input, otelcol.processor.filter.info_logs.input]
traces = [otelcol.processor.k8sattributes.add_metadata.input]
}
}
// log processors
otelcol.processor.filter "error_warn_logs" {
error_mode = "ignore"
logs {
log_record = ["severity_number < SEVERITY_NUMBER_WARN",]
}
output {
logs = [otelcol.processor.k8sattributes.add_metadata.input]
}
}
otelcol.processor.filter "info_logs" {
error_mode = "ignore"
logs {
log_record = ["severity_number >= SEVERITY_NUMBER_WARN",]
}
output {
logs = [otelcol.processor.probabilistic_sampler.info_log_sampler.input]
}
}
otelcol.processor.probabilistic_sampler "info_log_sampler" {
sampling_percentage = 1
output {
logs = [otelcol.processor.k8sattributes.add_metadata.input]
}
}
// common processors
otelcol.processor.k8sattributes "add_metadata" {
extract {
label {
from = "pod"
key_regex = "(.*)"
tag_name = "$1"
}
metadata = [
"k8s.namespace.name",
"k8s.deployment.name",
"k8s.statefulset.name",
"k8s.daemonset.name",
"k8s.cronjob.name",
"k8s.job.name",
"k8s.node.name",
"k8s.pod.name",
]
}
output {
metrics = [otelcol.processor.transform.add_kube_attrs.input]
logs = [otelcol.processor.transform.add_kube_attrs.input]
traces = [otelcol.processor.transform.add_kube_attrs.input]
}
}
otelcol.processor.transform "add_kube_attrs" {
error_mode = "ignore"
metric_statements {
context = "datapoint"
statements = [
"set(attributes[\"k8s_namespace_name\"], resource.attributes[\"k8s.namespace.name\"])",
"set(attributes[\"k8s_deployment_name\"], resource.attributes[\"k8s.deployment.name\"])",
"set(attributes[\"k8s_statefulset_name\"], resource.attributes[\"k8s.statefulset.name\"])",
"set(attributes[\"k8s_daemonset_name\"], resource.attributes[\"k8s.daemonset.name\"])",
"set(attributes[\"k8s_cronjob_name\"], resource.attributes[\"k8s.cronjob.name\"])",
"set(attributes[\"k8s_job_name\"], resource.attributes[\"k8s.job.name\"])",
"set(attributes[\"k8s_node_name\"], resource.attributes[\"k8s.node.name\"])",
"set(attributes[\"k8s_pod_name\"], resource.attributes[\"k8s.pod.name\"])",
"set(attributes[\"cluster\"], \"k8s-central-prd-ase1\")",
"set(attributes[\"env\"], resource.attributes[\"env\"])",
"set(attributes[\"bu\"], resource.attributes[\"bu\"])",
"set(attributes[\"team\"], resource.attributes[\"team\"])",
"set(attributes[\"version\"], resource.attributes[\"version\"])",
"set(attributes[\"job\"], \"otel_agent_push\")",
]
}
log_statements {
context = "log"
statements = [
"set(attributes[\"k8s_namespace_name\"], resource.attributes[\"k8s.namespace.name\"])",
"set(attributes[\"k8s_deployment_name\"], resource.attributes[\"k8s.deployment.name\"])",
"set(attributes[\"k8s_statefulset_name\"], resource.attributes[\"k8s.statefulset.name\"])",
"set(attributes[\"k8s_daemonset_name\"], resource.attributes[\"k8s.daemonset.name\"])",
"set(attributes[\"k8s_cronjob_name\"], resource.attributes[\"k8s.cronjob.name\"])",
"set(attributes[\"k8s_job_name\"], resource.attributes[\"k8s.job.name\"])",
"set(attributes[\"k8s_node_name\"], resource.attributes[\"k8s.node.name\"])",
"set(attributes[\"k8s_pod_name\"], resource.attributes[\"k8s.pod.name\"])",
"set(attributes[\"cluster\"], \"k8s-central-prd-ase1\")",
"set(attributes[\"env\"], resource.attributes[\"env\"])",
"set(attributes[\"bu\"], resource.attributes[\"bu\"])",
"set(attributes[\"team\"], resource.attributes[\"team\"])",
"set(attributes[\"version\"], resource.attributes[\"version\"])",
"set(attributes[\"job\"], \"otel_agent_push\")",
]
}
trace_statements {
context = "span"
statements = [
"set(attributes[\"k8s_namespace_name\"], resource.attributes[\"k8s.namespace.name\"])",
"set(attributes[\"k8s_deployment_name\"], resource.attributes[\"k8s.deployment.name\"])",
"set(attributes[\"k8s_statefulset_name\"], resource.attributes[\"k8s.statefulset.name\"])",
"set(attributes[\"k8s_daemonset_name\"], resource.attributes[\"k8s.daemonset.name\"])",
"set(attributes[\"k8s_cronjob_name\"], resource.attributes[\"k8s.cronjob.name\"])",
"set(attributes[\"k8s_job_name\"], resource.attributes[\"k8s.job.name\"])",
"set(attributes[\"k8s_node_name\"], resource.attributes[\"k8s.node.name\"])",
"set(attributes[\"k8s_pod_name\"], resource.attributes[\"k8s.pod.name\"])",
"set(attributes[\"cluster\"], \"k8s-central-prd-ase1\")",
"set(attributes[\"env\"], resource.attributes[\"env\"])",
"set(attributes[\"bu\"], resource.attributes[\"bu\"])",
"set(attributes[\"team\"], resource.attributes[\"team\"])",
"set(attributes[\"version\"], resource.attributes[\"version\"])",
"set(attributes[\"job\"], \"otel_agent_push\")",
]
}
output {
metrics = [otelcol.processor.batch.otlp_batcher.input]
logs = [otelcol.processor.batch.otlp_batcher.input]
traces = [otelcol.exporter.loadbalancing.otel.input]
}
}
otelcol.processor.batch "otlp_batcher" {
output {
metrics = [otelcol.exporter.otlphttp.mimir.input]
logs = [otelcol.exporter.otlphttp.loki.input]
}
}
// writers
prometheus.remote_write "mimir" {
endpoint {
url = "http://mimir-nginx.mimir-distributed.svc.clusterset.local/api/v1/push"
headers = {"X-Scope-OrgID" = "anonymous"}
tls_config {
insecure_skip_verify = true
}
queue_config {
min_shards = 25
}
}
}
otelcol.exporter.otlphttp "mimir" {
client {
endpoint = "http://mimir-nginx.mimir-distributed.svc.clusterset.local/otlp"
headers = {"X-Scope-OrgID" = "anonymous"}
tls {
insecure = true
}
}
}
otelcol.exporter.otlphttp "loki" {
client {
endpoint = "http://loki-gateway.loki-distributed.svc.clusterset.local/otlp"
tls {
insecure = true
}
}
}
otelcol.exporter.otlp "tempo" {
client {
endpoint = "tempo-distributor.tempo-distributed.svc.clusterset.local:4317"
tls {
insecure = true
}
}
}
otelcol.exporter.loadbalancing "otel" {
routing_key = "traceID"
resolver {
dns {
hostname = "opentelemetry-statefulset-headless.opentelemetry.svc.clusterset.local"
timeout = "5s"
}
}
protocol {
otlp {
client {
tls {
insecure = true
}
}
queue {
num_consumers = 100
queue_size = 100000
}
}
}
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,677 @@
// gce_node_exporter
discovery.gce "node_exporter_a" {
project = "meesho-farmiso-prd-0622"
zone = "asia-southeast1-a"
port = 9100
}
discovery.gce "node_exporter_b" {
project = "meesho-farmiso-prd-0622"
zone = "asia-southeast1-b"
port = 9100
}
discovery.gce "node_exporter_c" {
project = "meesho-farmiso-prd-0622"
zone = "asia-southeast1-c"
port = 9100
}
discovery.relabel "node_exporter_gce" {
targets = concat(
discovery.gce.node_exporter_a.targets,
discovery.gce.node_exporter_b.targets,
discovery.gce.node_exporter_c.targets,
)
rule {
source_labels = ["__meta_gce_instance_status"]
regex = "RUNNING"
action = "keep"
}
rule {
source_labels = ["__meta_gce_label_goog-k8s-cluster-name"]
regex = "k8s"
action = "drop"
}
rule {
source_labels = ["__meta_gce_label_monitoring"]
regex = "no"
action = "drop"
}
rule {
source_labels = ["__meta_gce_instance_name"]
regex = "gke-k8s-.*"
action = "drop"
}
rule {
target_label = "project"
replacement = "meesho-farmiso-prd-0622"
}
rule {
source_labels = ["__meta_gce_instance_name"]
target_label = "name"
}
rule {
source_labels = ["__meta_gce_instance_id"]
target_label = "instance_id"
}
rule {
source_labels = ["__meta_gce_instance_status"]
target_label = "status"
}
rule {
source_labels = ["__meta_gce_private_ip"]
target_label = "private_ip"
}
rule {
source_labels = ["__meta_gce_public_ip"]
target_label = "public_ip"
}
rule {
source_labels = ["__meta_gce_label_bu"]
target_label = "bu"
}
rule {
source_labels = ["__meta_gce_label_component"]
target_label = "component"
}
rule {
source_labels = ["__meta_gce_label_env"]
target_label = "env"
}
rule {
source_labels = ["__meta_gce_label_service"]
target_label = "service"
}
rule {
source_labels = ["__meta_gce_label_team"]
target_label = "team"
}
rule {
source_labels = ["__meta_gce_label_type"]
target_label = "type"
}
rule {
source_labels = ["__meta_gce_label_alerts"]
target_label = "alerts"
}
}
prometheus.scrape "node_exporter_gce" {
targets = discovery.relabel.node_exporter_gce.output
forward_to = [prometheus.remote_write.mimir.receiver]
job_name = "node_exporter_gce"
clustering {
enabled = true
}
}
// kube state metrics
discovery.relabel "kube_state_metrics_pod" {
targets = [{__address__ = "kube-state-metrics-farmiso-prd.kube-system.svc.cluster.local:8080",}]
rule {
regex = "__meta_kubernetes_node_label_(.+)"
action = "labelmap"
}
rule {
target_label = "cluster"
replacement = "k8s-farmiso-prd-ase1"
}
}
prometheus.scrape "kube_state_metrics_pod" {
targets = discovery.relabel.kube_state_metrics_pod.output
forward_to = [prometheus.remote_write.mimir.receiver]
job_name = "kube_state_metrics_pod"
scrape_interval = "15s"
clustering {
enabled = true
}
}
// cadvisor metrics
discovery.kubernetes "kubernetes_nodes" {
role = "node"
}
discovery.relabel "cadvisor_kubernetes_nodes" {
targets = discovery.kubernetes.kubernetes_nodes.targets
rule {
replacement = "k8s-farmiso-prd-ase1"
target_label = "cluster"
}
rule {
regex = "__meta_kubernetes_node_label_(.+)"
action = "labelmap"
}
rule {
replacement = "kubernetes.default.svc:443"
target_label = "__address__"
}
rule {
source_labels = ["__meta_kubernetes_node_name"]
regex = "(.+)"
target_label = "__metrics_path__"
replacement = "/api/v1/nodes/$1/proxy/metrics/cadvisor"
}
}
prometheus.scrape "cadvisor_kubernetes_nodes" {
targets = discovery.relabel.cadvisor_kubernetes_nodes.output
forward_to = [prometheus.remote_write.mimir.receiver]
job_name = "cadvisor_kubernetes_nodes"
scheme = "https"
scrape_interval = "15s"
authorization {
type = "Bearer"
credentials_file = "/var/run/secrets/kubernetes.io/serviceaccount/token"
}
tls_config {
ca_file = "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt"
insecure_skip_verify = true
}
clustering {
enabled = true
}
}
// kubelet
discovery.relabel "kubelet_kubernetes_nodes" {
targets = discovery.kubernetes.kubernetes_nodes.targets
rule {
replacement = "k8s-farmiso-prd-ase1"
target_label = "cluster"
}
rule {
regex = "__meta_kubernetes_node_label_(.+)"
action = "labelmap"
}
rule {
target_label = "__address__"
replacement = "kubernetes.default.svc:443"
}
rule {
source_labels = ["__meta_kubernetes_node_name"]
regex = "(.+)"
target_label = "__metrics_path__"
replacement = "/api/v1/nodes/$1/proxy/metrics"
}
}
prometheus.scrape "kubelet_kubernetes_nodes" {
targets = discovery.relabel.kubelet_kubernetes_nodes.output
forward_to = [prometheus.remote_write.mimir.receiver]
job_name = "kubelet_kubernetes_nodes"
scheme = "https"
scrape_interval = "15s"
authorization {
type = "Bearer"
credentials_file = "/var/run/secrets/kubernetes.io/serviceaccount/token"
}
tls_config {
ca_file = "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt"
insecure_skip_verify = true
}
clustering {
enabled = true
}
}
// prometheus_kubernetes_endpoints
discovery.kubernetes "kubernetes_endpoints" {
role = "endpoints"
}
discovery.relabel "prometheus_kubernetes_endpoints" {
targets = discovery.kubernetes.kubernetes_endpoints.targets
rule {
source_labels = ["__meta_kubernetes_pod_container_init"]
regex = "true"
action = "drop"
}
rule {
source_labels = ["__meta_kubernetes_service_annotation_prometheus_io_port"]
target_label = "__meta_kubernetes_pod_container_port_number"
action = "keepequal"
}
rule {
source_labels = ["__meta_kubernetes_service_annotation_prometheus_io_scrape"]
regex = "true"
action = "keep"
}
rule {
source_labels = ["__meta_kubernetes_service_annotation_prometheus_io_path"]
regex = "(.+)"
target_label = "__metrics_path__"
}
rule {
source_labels = ["__address__", "__meta_kubernetes_service_annotation_prometheus_io_port"]
regex = "([^:]+)(?::\\d+)?;(\\d+)"
target_label = "__address__"
replacement = "$1:$2"
}
rule {
regex = "__meta_kubernetes_node_label_(.+)"
action = "labelmap"
}
rule {
regex = "__meta_kubernetes_service_label_(.+)"
action = "labelmap"
}
rule {
source_labels = ["__meta_kubernetes_namespace"]
target_label = "kubernetes_namespace"
}
rule {
source_labels = ["__meta_kubernetes_endpoint_node_name"]
target_label = "kubernetes_node"
}
rule {
source_labels = ["__meta_kubernetes_service_name"]
target_label = "kubernetes_service_name"
}
rule {
source_labels = ["__meta_kubernetes_endpoints_name"]
target_label = "kubernetes_endpoints_name"
}
rule {
source_labels = ["__meta_kubernetes_pod_name"]
target_label = "kubernetes_pod_name"
}
rule {
target_label = "cluster"
replacement = "k8s-farmiso-prd-ase1"
}
}
prometheus.scrape "prometheus_kubernetes_endpoints" {
targets = discovery.relabel.prometheus_kubernetes_endpoints.output
forward_to = [prometheus.remote_write.mimir.receiver]
job_name = "prometheus_kubernetes_endpoints"
scrape_interval = "15s"
clustering {
enabled = true
}
}
// prometheus_kubernetes_pods
discovery.kubernetes "kubernetes_pods" {
role = "pod"
}
discovery.relabel "prometheus_kubernetes_pods" {
targets = discovery.kubernetes.kubernetes_pods.targets
rule {
source_labels = ["__meta_kubernetes_pod_container_init"]
regex = "true"
action = "drop"
}
rule {
source_labels = ["__meta_kubernetes_pod_annotation_prometheus_io_port"]
target_label = "__meta_kubernetes_pod_container_port_number"
action = "keepequal"
}
rule {
source_labels = ["__meta_kubernetes_pod_annotation_prometheus_io_scrape"]
regex = "true"
action = "keep"
}
rule {
source_labels = ["__meta_kubernetes_pod_annotation_prometheus_io_path"]
regex = "(.+)"
target_label = "__metrics_path__"
}
rule {
source_labels = ["__address__", "__meta_kubernetes_pod_annotation_prometheus_io_port"]
regex = "([^:]+)(?::\\d+)?;(\\d+)"
target_label = "__address__"
replacement = "$1:$2"
}
rule {
regex = "__meta_kubernetes_node_label_(.+)"
action = "labelmap"
}
rule {
regex = "__meta_kubernetes_pod_label_(.+)"
action = "labelmap"
}
rule {
source_labels = ["__meta_kubernetes_namespace"]
target_label = "kubernetes_namespace"
}
rule {
source_labels = ["__meta_kubernetes_pod_node_name"]
target_label = "kubernetes_node"
}
rule {
source_labels = ["__meta_kubernetes_pod_name"]
target_label = "kubernetes_pod_name"
}
rule {
target_label = "cluster"
replacement = "k8s-farmiso-prd-ase1"
}
}
prometheus.scrape "prometheus_kubernetes_pods" {
targets = discovery.relabel.prometheus_kubernetes_pods.output
forward_to = [prometheus.remote_write.mimir.receiver]
job_name = "prometheus_kubernetes_pods"
clustering {
enabled = true
}
}
// jmx_kubernetes_pods
discovery.relabel "jmx_kubernetes_pods" {
targets = discovery.kubernetes.kubernetes_pods.targets
rule {
source_labels = ["__meta_kubernetes_pod_container_init"]
regex = "true"
action = "drop"
}
rule {
source_labels = ["__meta_kubernetes_pod_annotation_jmx_io_port"]
target_label = "__meta_kubernetes_pod_container_port_number"
action = "keepequal"
}
rule {
source_labels = ["__meta_kubernetes_pod_annotation_jmx_io_scrape"]
regex = "true"
action = "keep"
}
rule {
source_labels = ["__meta_kubernetes_pod_annotation_jmx_io_path"]
regex = "(.+)"
target_label = "__metrics_path__"
}
rule {
source_labels = ["__address__", "__meta_kubernetes_pod_annotation_jmx_io_port"]
regex = "([^:]+)(?::\\d+)?;(\\d+)"
target_label = "__address__"
replacement = "$1:$2"
}
rule {
regex = "__meta_kubernetes_node_label_(.+)"
action = "labelmap"
}
rule {
regex = "__meta_kubernetes_pod_label_(.+)"
action = "labelmap"
}
rule {
source_labels = ["__meta_kubernetes_namespace"]
target_label = "kubernetes_namespace"
}
rule {
source_labels = ["__meta_kubernetes_pod_node_name"]
target_label = "kubernetes_node"
}
rule {
source_labels = ["__meta_kubernetes_pod_name"]
target_label = "kubernetes_pod_name"
}
rule {
target_label = "cluster"
replacement = "k8s-farmiso-prd-ase1"
}
}
prometheus.scrape "jmx_kubernetes_pods" {
targets = discovery.relabel.jmx_kubernetes_pods.output
forward_to = [prometheus.remote_write.mimir.receiver]
job_name = "jmx_kubernetes_pods"
clustering {
enabled = true
}
}
// pm2_metrics
discovery.relabel "pm2_kubernetes_pods" {
targets = discovery.kubernetes.kubernetes_pods.targets
rule {
source_labels = ["__meta_kubernetes_pod_container_init"]
regex = "true"
action = "drop"
}
rule {
source_labels = ["__address__"]
regex = "(.*9209)"
action = "keep"
}
rule {
regex = "__meta_kubernetes_node_label_(.+)"
action = "labelmap"
}
rule {
regex = "__meta_kubernetes_pod_label_(.+)"
action = "labelmap"
}
rule {
source_labels = ["__meta_kubernetes_namespace"]
target_label = "kubernetes_namespace"
}
rule {
source_labels = ["__meta_kubernetes_pod_node_name"]
target_label = "kubernetes_node"
}
rule {
source_labels = ["__meta_kubernetes_pod_name"]
target_label = "kubernetes_pod_name"
}
rule {
target_label = "cluster"
replacement = "k8s-farmiso-prd-ase1"
}
}
prometheus.scrape "pm2_kubernetes_pods" {
targets = discovery.relabel.pm2_kubernetes_pods.output
forward_to = [prometheus.remote_write.mimir.receiver]
job_name = "pm2_kubernetes_pods"
clustering {
enabled = true
}
}
prometheus.exporter.self "default" {}
prometheus.scrape "alloy_pods" {
targets = prometheus.exporter.self.default.targets
forward_to = [prometheus.remote_write.mimir.receiver]
}
// recivers
otelcol.receiver.otlp "otlp_receiver" {
grpc {
endpoint = "0.0.0.0:4317"
}
http {
endpoint = "0.0.0.0:4318"
}
output {
metrics = [otelcol.processor.k8sattributes.add_metadata.input]
logs = [otelcol.processor.filter.error_warn_logs.input, otelcol.processor.filter.info_logs.input]
traces = [otelcol.processor.k8sattributes.add_metadata.input]
}
}
// processors
otelcol.processor.filter "error_warn_logs" {
error_mode = "ignore"
logs {
log_record = [
"severity_number < SEVERITY_NUMBER_WARN",
]
}
output {
logs = [otelcol.processor.k8sattributes.add_metadata.input]
}
}
otelcol.processor.filter "info_logs" {
error_mode = "ignore"
logs {
log_record = [
"severity_number >= SEVERITY_NUMBER_WARN",
]
}
output {
logs = [otelcol.processor.probabilistic_sampler.log_sampler.input]
}
}
otelcol.processor.probabilistic_sampler "log_sampler" {
sampling_percentage = 1
output {
logs = [otelcol.processor.k8sattributes.add_metadata.input]
}
}
otelcol.processor.k8sattributes "add_metadata" {
extract {
label {
from = "pod"
key_regex = "(.*)"
tag_name = "$1"
}
metadata = [
"k8s.namespace.name",
"k8s.deployment.name",
"k8s.statefulset.name",
"k8s.daemonset.name",
"k8s.cronjob.name",
"k8s.job.name",
"k8s.node.name",
"k8s.pod.name",
]
}
output {
metrics = [otelcol.processor.transform.add_kube_attrs.input]
logs = [otelcol.processor.transform.add_kube_attrs.input]
traces = [otelcol.processor.transform.add_kube_attrs.input]
}
}
otelcol.processor.transform "add_kube_attrs" {
error_mode = "ignore"
metric_statements {
context = "datapoint"
statements = [
"set(attributes[\"k8s_namespace_name\"], resource.attributes[\"k8s.namespace.name\"])",
"set(attributes[\"k8s_deployment_name\"], resource.attributes[\"k8s.deployment.name\"])",
"set(attributes[\"k8s_statefulset_name\"], resource.attributes[\"k8s.statefulset.name\"])",
"set(attributes[\"k8s_daemonset_name\"], resource.attributes[\"k8s.daemonset.name\"])",
"set(attributes[\"k8s_cronjob_name\"], resource.attributes[\"k8s.cronjob.name\"])",
"set(attributes[\"k8s_job_name\"], resource.attributes[\"k8s.job.name\"])",
"set(attributes[\"k8s_node_name\"], resource.attributes[\"k8s.node.name\"])",
"set(attributes[\"k8s_pod_name\"], resource.attributes[\"k8s.pod.name\"])",
"set(attributes[\"cluster\"], \"k8s-farmiso-prd-ase1\")",
"set(attributes[\"env\"], resource.attributes[\"env\"])",
"set(attributes[\"bu\"], resource.attributes[\"bu\"])",
"set(attributes[\"team\"], resource.attributes[\"team\"])",
"set(attributes[\"version\"], resource.attributes[\"version\"])",
"set(attributes[\"job\"], \"otel_agent_push\")",
]
}
log_statements {
context = "log"
statements = [
"set(attributes[\"k8s_namespace_name\"], resource.attributes[\"k8s.namespace.name\"])",
"set(attributes[\"k8s_deployment_name\"], resource.attributes[\"k8s.deployment.name\"])",
"set(attributes[\"k8s_statefulset_name\"], resource.attributes[\"k8s.statefulset.name\"])",
"set(attributes[\"k8s_daemonset_name\"], resource.attributes[\"k8s.daemonset.name\"])",
"set(attributes[\"k8s_cronjob_name\"], resource.attributes[\"k8s.cronjob.name\"])",
"set(attributes[\"k8s_job_name\"], resource.attributes[\"k8s.job.name\"])",
"set(attributes[\"k8s_node_name\"], resource.attributes[\"k8s.node.name\"])",
"set(attributes[\"k8s_pod_name\"], resource.attributes[\"k8s.pod.name\"])",
"set(attributes[\"cluster\"], \"k8s-farmiso-prd-ase1\")",
"set(attributes[\"env\"], resource.attributes[\"env\"])",
"set(attributes[\"bu\"], resource.attributes[\"bu\"])",
"set(attributes[\"team\"], resource.attributes[\"team\"])",
"set(attributes[\"version\"], resource.attributes[\"version\"])",
"set(attributes[\"job\"], \"otel_agent_push\")",
]
}
trace_statements {
context = "span"
statements = [
"set(attributes[\"k8s_namespace_name\"], resource.attributes[\"k8s.namespace.name\"])",
"set(attributes[\"k8s_deployment_name\"], resource.attributes[\"k8s.deployment.name\"])",
"set(attributes[\"k8s_statefulset_name\"], resource.attributes[\"k8s.statefulset.name\"])",
"set(attributes[\"k8s_daemonset_name\"], resource.attributes[\"k8s.daemonset.name\"])",
"set(attributes[\"k8s_cronjob_name\"], resource.attributes[\"k8s.cronjob.name\"])",
"set(attributes[\"k8s_job_name\"], resource.attributes[\"k8s.job.name\"])",
"set(attributes[\"k8s_node_name\"], resource.attributes[\"k8s.node.name\"])",
"set(attributes[\"k8s_pod_name\"], resource.attributes[\"k8s.pod.name\"])",
"set(attributes[\"cluster\"], \"k8s-farmiso-prd-ase1\")",
"set(attributes[\"env\"], resource.attributes[\"env\"])",
"set(attributes[\"bu\"], resource.attributes[\"bu\"])",
"set(attributes[\"team\"], resource.attributes[\"team\"])",
"set(attributes[\"version\"], resource.attributes[\"version\"])",
"set(attributes[\"job\"], \"otel_agent_push\")",
]
}
output {
metrics = [otelcol.processor.batch.otlp_batcher.input]
logs = [otelcol.processor.batch.otlp_batcher.input]
traces = [otelcol.exporter.loadbalancing.otel.input]
}
}
otelcol.processor.batch "otlp_batcher" {
output {
metrics = [otelcol.exporter.otlphttp.mimir.input]
logs = [otelcol.exporter.otlphttp.loki.input]
traces = [otelcol.exporter.otlp.tempo.input]
}
}
// writers
prometheus.remote_write "mimir" {
endpoint {
url = "http://mimir-nginx.mimir-distributed.svc.clusterset.local/api/v1/push"
headers = {"X-Scope-OrgID" = "anonymous"}
tls_config {
insecure_skip_verify = true
}
queue_config {
min_shards = 25
}
}
}
otelcol.exporter.otlphttp "mimir" {
client {
endpoint = "http://mimir-nginx.mimir-distributed.svc.clusterset.local/otlp"
headers = {"X-Scope-OrgID" = "anonymous"}
tls {
insecure = true
}
}
}
otelcol.exporter.otlphttp "loki" {
client {
endpoint = "http://loki-gateway.loki-distributed.svc.clusterset.local/otlp"
tls {
insecure = true
}
}
}
otelcol.exporter.otlp "tempo" {
client {
endpoint = "tempo-distributor.tempo-distributed.svc.clusterset.local:4317"
tls {
insecure = true
}
}
}
otelcol.exporter.loadbalancing "otel" {
routing_key = "traceID"
resolver {
dns {
hostname = "opentelemetry-statefulset-headless.opentelemetry.svc.clusterset.local"
timeout = "5s"
}
}
protocol {
otlp {
client {
tls {
insecure = true
}
}
queue {
num_consumers = 100
queue_size = 100000
}
}
}
}
File diff suppressed because it is too large Load Diff
+61
View File
@@ -0,0 +1,61 @@
// recivers
otelcol.receiver.otlp "otlp_receiver" {
grpc {
endpoint = "0.0.0.0:4317"
}
http {
endpoint = "0.0.0.0:4318"
}
output {
metrics = [otelcol.processor.batch.otlp_batcher.input]
logs = [otelcol.processor.batch.otlp_batcher.input]
traces = [otelcol.exporter.loadbalancing.otel.input]
}
}
otelcol.processor.batch "otlp_batcher" {
output {
metrics = [otelcol.exporter.otlphttp.mimir.input]
logs = [otelcol.exporter.otlphttp.loki.input]
}
}
otelcol.exporter.otlphttp "mimir" {
client {
endpoint = "http://mimir-nginx.mimir-distributed.svc.clusterset.local/otlp"
headers = {"X-Scope-OrgID" = "anonymous"}
tls {
insecure = true
}
}
}
otelcol.exporter.otlphttp "loki" {
client {
endpoint = "http://loki-gateway.loki-distributed.svc.clusterset.local/otlp"
tls {
insecure = true
}
}
}
otelcol.exporter.loadbalancing "otel" {
routing_key = "traceID"
resolver {
dns {
hostname = "opentelemetry-admin-prd-headless.opentelemetry.svc.clusterset.local"
timeout = "5s"
}
}
protocol {
otlp {
client {
tls {
insecure = true
}
}
queue {
num_consumers = 100
queue_size = 100000
}
}
}
}
+61
View File
@@ -0,0 +1,61 @@
// recivers
otelcol.receiver.otlp "otlp_receiver" {
grpc {
endpoint = "0.0.0.0:4317"
}
http {
endpoint = "0.0.0.0:4318"
}
output {
metrics = [otelcol.processor.batch.otlp_batcher.input]
logs = [otelcol.processor.batch.otlp_batcher.input]
traces = [otelcol.exporter.loadbalancing.otel.input]
}
}
otelcol.processor.batch "otlp_batcher" {
output {
metrics = [otelcol.exporter.otlphttp.mimir.input]
logs = [otelcol.exporter.otlphttp.loki.input]
}
}
otelcol.exporter.otlphttp "mimir" {
client {
endpoint = "http://mimir-nginx.mimir-distributed.svc.clusterset.local/otlp"
headers = {"X-Scope-OrgID" = "anonymous"}
tls {
insecure = true
}
}
}
otelcol.exporter.otlphttp "loki" {
client {
endpoint = "http://loki-gateway.loki-distributed.svc.clusterset.local/otlp"
tls {
insecure = true
}
}
}
otelcol.exporter.loadbalancing "otel" {
routing_key = "traceID"
resolver {
dns {
hostname = "opentelemetry-admin-prd-headless.opentelemetry.svc.clusterset.local"
timeout = "5s"
}
}
protocol {
otlp {
client {
tls {
insecure = true
}
}
queue {
num_consumers = 100
queue_size = 100000
}
}
}
}
+61
View File
@@ -0,0 +1,61 @@
// recivers
otelcol.receiver.otlp "otlp_receiver" {
grpc {
endpoint = "0.0.0.0:4317"
}
http {
endpoint = "0.0.0.0:4318"
}
output {
metrics = [otelcol.processor.batch.otlp_batcher.input]
logs = [otelcol.processor.batch.otlp_batcher.input]
traces = [otelcol.exporter.loadbalancing.otel.input]
}
}
otelcol.processor.batch "otlp_batcher" {
output {
metrics = [otelcol.exporter.otlphttp.mimir.input]
logs = [otelcol.exporter.otlphttp.loki.input]
}
}
otelcol.exporter.otlphttp "mimir" {
client {
endpoint = "http://mimir-nginx.mimir-distributed.svc.clusterset.local/otlp"
headers = {"X-Scope-OrgID" = "anonymous"}
tls {
insecure = true
}
}
}
otelcol.exporter.otlphttp "loki" {
client {
endpoint = "http://loki-gateway.loki-distributed.svc.clusterset.local/otlp"
tls {
insecure = true
}
}
}
otelcol.exporter.loadbalancing "otel" {
routing_key = "traceID"
resolver {
dns {
hostname = "opentelemetry-admin-prd-headless.opentelemetry.svc.clusterset.local"
timeout = "5s"
}
}
protocol {
otlp {
client {
tls {
insecure = true
}
}
queue {
num_consumers = 100
queue_size = 100000
}
}
}
}
+1
View File
@@ -0,0 +1 @@
Welcome to Grafana Alloy!
@@ -0,0 +1,25 @@
{{/*
Retrieve configMap name from the name of the chart or the ConfigMap the user
specified.
*/}}
{{- define "alloy.config-map.name" -}}
{{- $values := (mustMergeOverwrite .Values.alloy (or .Values.agent dict)) -}}
{{- if $values.configMap.name -}}
{{- $values.configMap.name }}
{{- else -}}
{{- include "alloy.fullname" . }}
{{- end }}
{{- end }}
{{/*
The name of the config file is the default or the key the user specified in the
ConfigMap.
*/}}
{{- define "alloy.config-map.key" -}}
{{- $values := (mustMergeOverwrite .Values.alloy (or .Values.agent dict)) -}}
{{- if $values.configMap.key -}}
{{- $values.configMap.key }}
{{- else -}}
config.alloy
{{- end }}
{{- end }}
+151
View File
@@ -0,0 +1,151 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "alloy.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "alloy.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "alloy.chart" -}}
{{- if index .Values "$chart_tests" }}
{{- printf "%s" .Chart.Name | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{/*
Allow the release namespace to be overridden for multi-namespace deployments in combined charts
*/}}
{{- define "alloy.namespace" -}}
{{- if .Values.namespaceOverride }}
{{- .Values.namespaceOverride }}
{{- else }}
{{- .Release.Namespace }}
{{- end }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "alloy.labels" -}}
helm.sh/chart: {{ include "alloy.chart" . }}
{{ include "alloy.selectorLabels" . }}
{{- if index .Values "$chart_tests" }}
app.kubernetes.io/version: "vX.Y.Z"
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- else }}
{{/* substr trims delimeter prefix char from alloy.imageId output
e.g. ':' for tags and '@' for digests.
For digests, we crop the string to a 7-char (short) sha. */}}
app.kubernetes.io/version: {{ (include "alloy.imageId" .) | trunc 15 | trimPrefix "@sha256" | trimPrefix ":" | quote }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/part-of: alloy
{{- end }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "alloy.selectorLabels" -}}
app.kubernetes.io/name: {{ include "alloy.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "alloy.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "alloy.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
{{/*
Calculate name of image ID to use for "alloy.
*/}}
{{- define "alloy.imageId" -}}
{{- if .Values.image.digest }}
{{- $digest := .Values.image.digest }}
{{- if not (hasPrefix "sha256:" $digest) }}
{{- $digest = printf "sha256:%s" $digest }}
{{- end }}
{{- printf "@%s" $digest }}
{{- else if .Values.image.tag }}
{{- printf ":%s" .Values.image.tag }}
{{- else }}
{{- printf ":%s" .Chart.AppVersion }}
{{- end }}
{{- end }}
{{/*
Calculate name of image ID to use for "config-reloader".
*/}}
{{- define "config-reloader.imageId" -}}
{{- if .Values.configReloader.image.digest }}
{{- $digest := .Values.configReloader.image.digest }}
{{- if not (hasPrefix "sha256:" $digest) }}
{{- $digest = printf "sha256:%s" $digest }}
{{- end }}
{{- printf "@%s" $digest }}
{{- else if .Values.configReloader.image.tag }}
{{- printf ":%s" .Values.configReloader.image.tag }}
{{- else }}
{{- printf ":%s" "v0.8.0" }}
{{- end }}
{{- end }}
{{/*
Return the appropriate apiVersion for ingress.
*/}}
{{- define "alloy.ingress.apiVersion" -}}
{{- if and ($.Capabilities.APIVersions.Has "networking.k8s.io/v1") (semverCompare ">= 1.19-0" .Capabilities.KubeVersion.Version) }}
{{- print "networking.k8s.io/v1" }}
{{- else if $.Capabilities.APIVersions.Has "networking.k8s.io/v1beta1" }}
{{- print "networking.k8s.io/v1beta1" }}
{{- else }}
{{- print "extensions/v1beta1" }}
{{- end }}
{{- end }}
{{/*
Return if ingress is stable.
*/}}
{{- define "alloy.ingress.isStable" -}}
{{- eq (include "alloy.ingress.apiVersion" .) "networking.k8s.io/v1" }}
{{- end }}
{{/*
Return if ingress supports ingressClassName.
*/}}
{{- define "alloy.ingress.supportsIngressClassName" -}}
{{- or (eq (include "alloy.ingress.isStable" .) "true") (and (eq (include "alloy.ingress.apiVersion" .) "networking.k8s.io/v1beta1") (semverCompare ">= 1.18-0" .Capabilities.KubeVersion.Version)) }}
{{- end }}
{{/*
Return if ingress supports pathType.
*/}}
{{- define "alloy.ingress.supportsPathType" -}}
{{- or (eq (include "alloy.ingress.isStable" .) "true") (and (eq (include "alloy.ingress.apiVersion" .) "networking.k8s.io/v1beta1") (semverCompare ">= 1.18-0" .Capabilities.KubeVersion.Version)) }}
{{- end }}
@@ -0,0 +1,32 @@
{{- $values := (mustMergeOverwrite .Values.alloy (or .Values.agent dict)) -}}
{{- if $values.clustering.enabled -}}
apiVersion: v1
kind: Service
metadata:
name: {{ include "alloy.fullname" . }}-cluster
labels:
{{- include "alloy.labels" . | nindent 4 }}
app.kubernetes.io/component: networking
spec:
type: ClusterIP
clusterIP: 'None'
selector:
{{- include "alloy.selectorLabels" . | nindent 4 }}
ports:
# Do not include the -metrics suffix in the port name, otherwise metrics
# can be double-collected with the non-headless Service if it's also
# enabled.
#
# This service should only be used for clustering, and not metric
# collection.
- name: {{ $values.clustering.portName }}
port: {{ $values.listenPort }}
targetPort: {{ $values.listenPort }}
protocol: "TCP"
{{- range $portMap := $values.extraPorts }}
- name: {{ $portMap.name }}
port: {{ $portMap.port }}
targetPort: {{ $portMap.targetPort }}
protocol: {{ coalesce $portMap.protocol "TCP" }}
{{- end }}
{{- end }}
@@ -0,0 +1,16 @@
{{- $values := (mustMergeOverwrite .Values.alloy (or .Values.agent dict)) -}}
{{- if $values.configMap.create }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "alloy.fullname" . }}
labels:
{{- include "alloy.labels" . | nindent 4 }}
app.kubernetes.io/component: config
data:
{{- if $values.configMap.content }}
config.alloy: |- {{- (tpl $values.configMap.content .) | nindent 4 }}
{{- else }}
config.alloy: |- {{- .Files.Get (printf "config/%s" $values.configMap.configFile) | trim | nindent 4 }}
{{- end }}
{{- end }}
@@ -0,0 +1,85 @@
{{- define "alloy.container" -}}
{{- $values := (mustMergeOverwrite .Values.alloy (or .Values.agent dict)) -}}
- name: alloy
image: {{ .Values.global.image.registry | default .Values.image.registry }}/{{ .Values.image.repository }}{{ include "alloy.imageId" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- run
- /etc/alloy/{{ include "alloy.config-map.key" . }}
- --storage.path={{ $values.storagePath }}
- --server.http.listen-addr={{ $values.listenAddr }}:{{ $values.listenPort }}
- --server.http.ui-path-prefix={{ $values.uiPathPrefix }}
{{- if not $values.enableReporting }}
- --disable-reporting
{{- end}}
{{- if $values.clustering.enabled }}
- --cluster.enabled=true
- --cluster.join-addresses={{ include "alloy.fullname" . }}-cluster
{{- end}}
{{- if $values.stabilityLevel }}
- --stability.level={{ $values.stabilityLevel }}
{{- end }}
{{- range $values.extraArgs }}
- {{ . }}
{{- end}}
env:
- name: ALLOY_DEPLOY_MODE
value: "helm"
- name: HOSTNAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: NODE_IP
valueFrom:
fieldRef:
fieldPath: status.hostIP
{{- range $values.extraEnv }}
- {{- toYaml . | nindent 6 }}
{{- end }}
{{- if $values.envFrom }}
envFrom:
{{- toYaml $values.envFrom | nindent 4 }}
{{- end }}
ports:
- containerPort: {{ $values.listenPort }}
name: http-metrics
{{- range $portMap := $values.extraPorts }}
- containerPort: {{ $portMap.targetPort }}
{{- if $portMap.hostPort }}
hostPort: {{ $portMap.hostPort }}
{{- end}}
name: {{ $portMap.name }}
protocol: {{ coalesce $portMap.protocol "TCP" }}
{{- end }}
readinessProbe:
httpGet:
path: /-/ready
port: {{ $values.listenPort }}
scheme: {{ $values.listenScheme }}
initialDelaySeconds: 10
timeoutSeconds: 1
{{- with $values.resources }}
resources:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with $values.securityContext }}
securityContext:
{{- toYaml . | nindent 4 }}
{{- end }}
volumeMounts:
- name: config
mountPath: /etc/alloy
{{- if $values.mounts.varlog }}
- name: varlog
mountPath: /var/log
readOnly: true
{{- end }}
{{- if $values.mounts.dockercontainers }}
- name: dockercontainers
mountPath: /var/lib/docker/containers
readOnly: true
{{- end }}
{{- range $values.mounts.extra }}
- {{- toYaml . | nindent 6 }}
{{- end }}
{{- end }}
@@ -0,0 +1,26 @@
{{- define "alloy.watch-container" -}}
{{- $values := (mustMergeOverwrite .Values.alloy (or .Values.agent dict)) -}}
{{- if .Values.configReloader.enabled -}}
- name: config-reloader
image: {{ .Values.global.image.registry | default .Values.configReloader.image.registry }}/{{ .Values.configReloader.image.repository }}{{ include "config-reloader.imageId" . }}
{{- if .Values.configReloader.customArgs }}
args:
{{- toYaml .Values.configReloader.customArgs | nindent 4 }}
{{- else }}
args:
- --volume-dir=/etc/alloy
- --webhook-url=http://localhost:{{ $values.listenPort }}/-/reload
{{- end }}
volumeMounts:
- name: config
mountPath: /etc/alloy
{{- with .Values.configReloader.resources }}
resources:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.configReloader.securityContext }}
securityContext:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
{{- end -}}
@@ -0,0 +1,83 @@
{{- define "alloy.pod-template" -}}
{{- $values := (mustMergeOverwrite .Values.alloy (or .Values.agent dict)) -}}
metadata:
annotations:
kubectl.kubernetes.io/default-container: alloy
{{- with .Values.controller.podAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
{{- include "alloy.selectorLabels" . | nindent 4 }}
{{- with .Values.controller.podLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- with .Values.global.podSecurityContext }}
securityContext:
{{- toYaml . | nindent 4 }}
{{- end }}
serviceAccountName: {{ include "alloy.serviceAccountName" . }}
{{- if or .Values.global.image.pullSecrets .Values.image.pullSecrets }}
imagePullSecrets:
{{- if .Values.global.image.pullSecrets }}
{{- toYaml .Values.global.image.pullSecrets | nindent 4 }}
{{- else }}
{{- toYaml .Values.image.pullSecrets | nindent 4 }}
{{- end }}
{{- end }}
{{- if .Values.controller.initContainers }}
initContainers:
{{- with .Values.controller.initContainers }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
containers:
{{- include "alloy.container" . | nindent 4 }}
{{- include "alloy.watch-container" . | nindent 4 }}
{{- with .Values.controller.extraContainers }}
{{- toYaml . | nindent 4 }}
{{- end}}
{{- if .Values.controller.priorityClassName }}
priorityClassName: {{ .Values.controller.priorityClassName }}
{{- end }}
{{- if .Values.controller.hostNetwork }}
hostNetwork: {{ .Values.controller.hostNetwork }}
{{- end }}
{{- if .Values.controller.hostPID }}
hostPID: {{ .Values.controller.hostPID }}
{{- end }}
dnsPolicy: {{ .Values.controller.dnsPolicy }}
{{- with .Values.controller.affinity }}
affinity:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.controller.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.controller.tolerations }}
tolerations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.controller.topologySpreadConstraints }}
topologySpreadConstraints:
{{- toYaml . | nindent 4 }}
{{- end }}
volumes:
- name: config
configMap:
name: {{ include "alloy.config-map.name" . }}
{{- if $values.mounts.varlog }}
- name: varlog
hostPath:
path: /var/log
{{- end }}
{{- if $values.mounts.dockercontainers }}
- name: dockercontainers
hostPath:
path: /var/lib/docker/containers
{{- end }}
{{- if .Values.controller.volumes.extra }}
{{- toYaml .Values.controller.volumes.extra | nindent 4 }}
{{- end }}
{{- end }}
@@ -0,0 +1,25 @@
{{- if eq .Values.controller.type "daemonset" }}
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: {{ include "alloy.fullname" . }}
labels:
{{- include "alloy.labels" . | nindent 4 }}
{{- with .Values.controller.extraAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if ge (int .Capabilities.KubeVersion.Minor) 22 }}
minReadySeconds: 10
{{- end }}
selector:
matchLabels:
{{- include "alloy.selectorLabels" . | nindent 6 }}
template:
{{- include "alloy.pod-template" . | nindent 4 }}
{{- with .Values.controller.updateStrategy }}
updateStrategy:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
@@ -0,0 +1,28 @@
{{- if eq .Values.controller.type "deployment" }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "alloy.fullname" . }}
labels:
{{- include "alloy.labels" . | nindent 4 }}
{{- with .Values.controller.extraAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if not .Values.controller.autoscaling.enabled }}
replicas: {{ .Values.controller.replicas }}
{{- end }}
{{- if ge (int .Capabilities.KubeVersion.Minor) 22 }}
minReadySeconds: 10
{{- end }}
selector:
matchLabels:
{{- include "alloy.selectorLabels" . | nindent 6 }}
template:
{{- include "alloy.pod-template" . | nindent 4 }}
{{- with .Values.controller.updateStrategy }}
strategy:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
@@ -0,0 +1,50 @@
{{- if eq .Values.controller.type "statefulset" }}
{{- if .Values.enableStatefulSetAutoDeletePVC }}
{{- fail "Value 'enableStatefulSetAutoDeletePVC' should be nested inside 'controller' options." }}
{{- end }}
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "alloy.fullname" . }}
labels:
{{- include "alloy.labels" . | nindent 4 }}
{{- with .Values.controller.extraAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if not .Values.controller.autoscaling.enabled }}
replicas: {{ .Values.controller.replicas }}
{{- end }}
{{- if .Values.controller.parallelRollout }}
podManagementPolicy: Parallel
{{- end }}
{{- if ge (int .Capabilities.KubeVersion.Minor) 22 }}
minReadySeconds: 10
{{- end }}
serviceName: {{ include "alloy.fullname" . }}
selector:
matchLabels:
{{- include "alloy.selectorLabels" . | nindent 6 }}
template:
{{- include "alloy.pod-template" . | nindent 4 }}
{{- with .Values.controller.updateStrategy }}
updateStrategy:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.controller.volumeClaimTemplates }}
volumeClaimTemplates:
{{- range . }}
- {{ toYaml . | nindent 6 }}
{{- end }}
{{- end }}
{{- if and (semverCompare ">= 1.23-0" .Capabilities.KubeVersion.Version) (.Values.controller.enableStatefulSetAutoDeletePVC) }}
{{- /*
Data on the read nodes is easy to replace, so we want to always delete PVCs to make
operation easier, and will rely on re-fetching data when needed.
*/}}
persistentVolumeClaimRetentionPolicy:
whenDeleted: Delete
whenScaled: Delete
{{- end }}
{{- end }}
@@ -0,0 +1,17 @@
{{- if and .Values.contour .Values.contour.enabled }}
{{- $instances := .Values.contour.instances -}}
{{- $fullname := include "alloy.fullname" . -}}
{{- range $instance := $instances }}
apiVersion: projectcontour.io/v1alpha1
kind: ExtensionService
metadata:
name: {{ $instance }}-extension-service
namespace: {{ $.Release.Namespace }}
spec:
protocol: h2c
services:
- name: {{ $fullname }}
port: 4317
---
{{- end }}
{{- end }}
+78
View File
@@ -0,0 +1,78 @@
{{- $values := (mustMergeOverwrite .Values.alloy (or .Values.agent dict)) -}}
{{- if and (or (eq .Values.controller.type "deployment") (eq .Values.controller.type "statefulset" )) .Values.controller.autoscaling.enabled }}
{{- if not (empty .Values.controller.autoscaling.targetMemoryUtilizationPercentage)}}
{{- $_ := $values.resources.requests | required ".Values.alloy.resources.requests is required when using autoscaling." -}}
{{- $_ := $values.resources.requests.memory | required ".Values.alloy.resources.requests.memory is required when using autoscaling based on memory utilization." -}}
{{- $_ := .Values.configReloader.resources.requests | required ".Values.configReloader.resources.requests is required when using autoscaling." -}}
{{- $_ := .Values.configReloader.resources.requests.memory | required ".Values.configReloader.resources.requests.memory is required when using autoscaling based on memory utilization." -}}
{{- end}}
{{- if not (empty .Values.controller.autoscaling.targetCPUUtilizationPercentage)}}
{{- $_ := $values.resources.requests | required ".Values.alloy.resources.requests is required when using autoscaling." -}}
{{- $_ := $values.resources.requests.cpu | required ".Values.alloy.resources.requests.cpu is required when using autoscaling based on cpu utilization." -}}
{{- $_ := .Values.configReloader.resources.requests | required ".Values.configReloader.resources.requests is required when using autoscaling." -}}
{{- $_ := .Values.configReloader.resources.requests.cpu | required ".Values.configReloader.resources.requests.cpu is required when using autoscaling based on cpu utilization." -}}
{{- end}}
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "alloy.fullname" . }}
labels:
{{- include "alloy.labels" . | nindent 4 }}
app.kubernetes.io/component: availability
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: {{ .Values.controller.type }}
name: {{ include "alloy.fullname" . }}
{{- with .Values.controller.autoscaling }}
minReplicas: {{ .minReplicas }}
maxReplicas: {{ .maxReplicas }}
behavior:
{{- with .scaleDown }}
scaleDown:
{{- if .policies }}
policies:
{{- range .policies }}
- type: {{ .type }}
value: {{ .value }}
periodSeconds: {{ .periodSeconds }}
{{- end }}
selectPolicy: {{ .selectPolicy }}
{{- end }}
stabilizationWindowSeconds: {{ .stabilizationWindowSeconds }}
{{- end }}
{{- with .scaleUp }}
scaleUp:
{{- if .policies }}
policies:
{{- range .policies }}
- type: {{ .type }}
value: {{ .value }}
periodSeconds: {{ .periodSeconds }}
{{- end }}
selectPolicy: {{ .selectPolicy }}
{{- end }}
stabilizationWindowSeconds: {{ .stabilizationWindowSeconds }}
{{- end }}
metrics:
# Changing the order of the metrics will cause ArgoCD to go into a sync loop
# memory needs to be first.
# More info in: https://github.com/argoproj/argo-cd/issues/1079
{{- with .targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: {{ . }}
{{- end }}
{{- with .targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ . }}
{{- end }}
{{- end }}
{{- end }}
@@ -0,0 +1,79 @@
{{- if .Values.ingress.enabled -}}
{{- $ingressApiIsStable := eq (include "alloy.ingress.isStable" .) "true" -}}
{{- $ingressSupportsIngressClassName := eq (include "alloy.ingress.supportsIngressClassName" .) "true" -}}
{{- $ingressSupportsPathType := eq (include "alloy.ingress.supportsPathType" .) "true" -}}
{{- $fullName := include "alloy.fullname" . -}}
{{- $servicePort := .Values.ingress.faroPort -}}
{{- $ingressPath := .Values.ingress.path -}}
{{- $ingressPathType := .Values.ingress.pathType -}}
{{- $extraPaths := .Values.ingress.extraPaths -}}
apiVersion: {{ include "alloy.ingress.apiVersion" . }}
kind: Ingress
metadata:
name: {{ $fullName }}
namespace: {{ include "alloy.namespace" . }}
labels:
{{- include "alloy.labels" . | nindent 4 }}
app.kubernetes.io/component: networking
{{- with .Values.ingress.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.ingress.annotations }}
annotations:
{{- range $key, $value := . }}
{{ $key }}: {{ tpl $value $ | quote }}
{{- end }}
{{- end }}
spec:
{{- if and $ingressSupportsIngressClassName .Values.ingress.ingressClassName }}
ingressClassName: {{ .Values.ingress.ingressClassName }}
{{- end -}}
{{- with .Values.ingress.tls }}
tls:
{{- tpl (toYaml .) $ | nindent 4 }}
{{- end }}
rules:
{{- if .Values.ingress.hosts }}
{{- range .Values.ingress.hosts }}
- host: {{ tpl . $ }}
http:
paths:
{{- with $extraPaths }}
{{- toYaml . | nindent 10 }}
{{- end }}
- path: {{ $ingressPath }}
{{- if $ingressSupportsPathType }}
pathType: {{ $ingressPathType }}
{{- end }}
backend:
{{- if $ingressApiIsStable }}
service:
name: {{ $fullName }}
port:
number: {{ $servicePort }}
{{- else }}
serviceName: {{ $fullName }}
servicePort: {{ $servicePort }}
{{- end }}
{{- end }}
{{- else }}
- http:
paths:
- backend:
{{- if $ingressApiIsStable }}
service:
name: {{ $fullName }}
port:
number: {{ $servicePort }}
{{- else }}
serviceName: {{ $fullName }}
servicePort: {{ $servicePort }}
{{- end }}
{{- with $ingressPath }}
path: {{ . }}
{{- end }}
{{- if $ingressSupportsPathType }}
pathType: {{ $ingressPathType }}
{{- end }}
{{- end -}}
{{- end }}
+111
View File
@@ -0,0 +1,111 @@
{{- if .Values.rbac.create }}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ include "alloy.fullname" . }}
labels:
{{- include "alloy.labels" . | nindent 4 }}
app.kubernetes.io/component: rbac
rules:
# Rules which allow discovery.kubernetes to function.
- apiGroups:
- ""
- "discovery.k8s.io"
- "networking.k8s.io"
resources:
- endpoints
- endpointslices
- ingresses
- nodes
- nodes/proxy
- nodes/metrics
- pods
- services
verbs:
- get
- list
- watch
# Rules which allow loki.source.kubernetes and loki.source.podlogs to work.
- apiGroups:
- ""
resources:
- pods
- pods/log
- namespaces
verbs:
- get
- list
- watch
- apiGroups:
- "monitoring.grafana.com"
resources:
- podlogs
verbs:
- get
- list
- watch
# Rules which allow mimir.rules.kubernetes to work.
- apiGroups: ["monitoring.coreos.com"]
resources:
- prometheusrules
verbs:
- get
- list
- watch
- nonResourceURLs:
- /metrics
verbs:
- get
# Rules for prometheus.kubernetes.*
- apiGroups: ["monitoring.coreos.com"]
resources:
- podmonitors
- servicemonitors
- probes
verbs:
- get
- list
- watch
# Rules which allow eventhandler to work.
- apiGroups:
- ""
resources:
- events
verbs:
- get
- list
- watch
# needed for remote.kubernetes.*
- apiGroups: [""]
resources:
- "configmaps"
- "secrets"
verbs:
- get
- list
- watch
# needed for otelcol.processor.k8sattributes
- apiGroups: ["apps"]
resources: ["replicasets"]
verbs: ["get", "list", "watch"]
- apiGroups: ["extensions"]
resources: ["replicasets"]
verbs: ["get", "list", "watch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ include "alloy.fullname" . }}
labels:
{{- include "alloy.labels" . | nindent 4 }}
app.kubernetes.io/component: rbac
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ include "alloy.fullname" . }}
subjects:
- kind: ServiceAccount
name: {{ include "alloy.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
{{- end }}
@@ -0,0 +1,38 @@
{{- $values := (mustMergeOverwrite .Values.alloy (or .Values.agent dict)) -}}
{{- if .Values.service.enabled -}}
apiVersion: v1
kind: Service
metadata:
name: {{ include "alloy.fullname" . }}
labels:
{{- include "alloy.labels" . | nindent 4 }}
app.kubernetes.io/component: networking
{{- with .Values.service.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
type: {{ .Values.service.type }}
{{- if .Values.service.clusterIP }}
clusterIP: {{ .Values.service.clusterIP }}
{{- end }}
selector:
{{- include "alloy.selectorLabels" . | nindent 4 }}
{{- if semverCompare ">=1.26-0" .Capabilities.KubeVersion.Version }}
internalTrafficPolicy: {{.Values.service.internalTrafficPolicy}}
{{- end }}
ports:
- name: http-metrics
{{- if eq .Values.service.type "NodePort" }}
nodePort: {{ .Values.service.nodePort }}
{{- end }}
port: {{ $values.listenPort }}
targetPort: {{ $values.listenPort }}
protocol: "TCP"
{{- range $portMap := $values.extraPorts }}
- name: {{ $portMap.name }}
port: {{ $portMap.port }}
targetPort: {{ $portMap.targetPort }}
protocol: {{ coalesce $portMap.protocol "TCP" }}
{{- end }}
{{- end }}
@@ -0,0 +1,17 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "alloy.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "alloy.labels" . | nindent 4 }}
app.kubernetes.io/component: rbac
{{- with .Values.serviceAccount.additionalLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
@@ -0,0 +1,36 @@
{{- $values := (mustMergeOverwrite .Values.alloy (or .Values.agent dict)) -}}
{{- if and .Values.service.enabled .Values.serviceMonitor.enabled -}}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "alloy.fullname" . }}
labels:
{{- include "alloy.labels" . | nindent 4 }}
app.kubernetes.io/component: metrics
{{- with .Values.serviceMonitor.additionalLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
endpoints:
- port: http-metrics
scheme: {{ $values.listenScheme | lower }}
honorLabels: true
{{- if .Values.serviceMonitor.interval }}
interval: {{ .Values.serviceMonitor.interval }}
{{- end }}
{{- if .Values.serviceMonitor.metricRelabelings }}
metricRelabelings:
{{ tpl (toYaml .Values.serviceMonitor.metricRelabelings | nindent 6) . }}
{{- end }}
{{- if .Values.serviceMonitor.relabelings }}
relabelings:
{{ tpl (toYaml .Values.serviceMonitor.relabelings | nindent 6) . }}
{{- end }}
{{- with .Values.serviceMonitor.tlsConfig }}
tlsConfig:
{{- toYaml . | nindent 6 }}
{{- end }}
selector:
matchLabels:
{{- include "alloy.selectorLabels" . | nindent 6 }}
{{- end }}
+335
View File
@@ -0,0 +1,335 @@
# -- Overrides the chart's name. Used to change the infix in the resource names.
nameOverride: null
# -- Overrides the chart's computed fullname. Used to change the full prefix of
# resource names.
fullnameOverride: null
## Global properties for image pulling override the values defined under `image.registry` and `configReloader.image.registry`.
## If you want to override only one image registry, use the specific fields but if you want to override them all, use `global.image.registry`
global:
image:
# -- Global image registry to use if it needs to be overriden for some specific use cases (e.g local registries, custom images, ...)
registry: ""
# -- Optional set of global image pull secrets.
pullSecrets: []
# -- Security context to apply to the Grafana Alloy pod.
podSecurityContext: {}
crds:
# -- Whether to install CRDs for monitoring.
create: true
## Various Alloy settings. For backwards compatibility with the grafana-agent
## chart, this field may also be called "agent". Naming this field "agent" is
## deprecated and will be removed in a future release.
alloy:
configMap:
# -- Create a new ConfigMap for the config file.
create: true
# -- Content to assign to the new ConfigMap. This is passed into `tpl` allowing for templating from values.
content: ''
# -- Name of existing ConfigMap to use. Used when create is false.
name: null
# -- Key in ConfigMap to get config from.
key: null
clustering:
# -- Deploy Alloy in a cluster to allow for load distribution.
enabled: false
# -- Name for the port used for clustering, useful if running inside an Istio Mesh
portName: http
# -- Minimum stability level of components and behavior to enable. Must be
# one of "experimental", "public-preview", or "generally-available".
stabilityLevel: "generally-available"
# -- Path to where Grafana Alloy stores data (for example, the Write-Ahead Log).
# By default, data is lost between reboots.
storagePath: /tmp/alloy
# -- Address to listen for traffic on. 0.0.0.0 exposes the UI to other
# containers.
listenAddr: 0.0.0.0
# -- Port to listen for traffic on.
listenPort: 12345
# -- Scheme is needed for readiness probes. If enabling tls in your configs, set to "HTTPS"
listenScheme: HTTP
# -- Base path where the UI is exposed.
uiPathPrefix: /
# -- Enables sending Grafana Labs anonymous usage stats to help improve Grafana
# Alloy.
enableReporting: true
# -- Extra environment variables to pass to the Alloy container.
extraEnv: []
# -- Maps all the keys on a ConfigMap or Secret as environment variables. https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.24/#envfromsource-v1-core
envFrom: []
# -- Extra args to pass to `alloy run`: https://grafana.com/docs/alloy/latest/reference/cli/run/
extraArgs: []
# -- Extra ports to expose on the Alloy container.
extraPorts: []
# - name: "faro"
# port: 12347
# targetPort: 12347
# protocol: "TCP"
mounts:
# -- Mount /var/log from the host into the container for log collection.
varlog: false
# -- Mount /var/lib/docker/containers from the host into the container for log
# collection.
dockercontainers: false
# -- Extra volume mounts to add into the Grafana Alloy container. Does not
# affect the watch container.
extra: []
# -- Security context to apply to the Grafana Alloy container.
securityContext: {}
# -- Resource requests and limits to apply to the Grafana Alloy container.
resources: {}
image:
# -- Grafana Alloy image registry (defaults to docker.io)
registry: "docker.io"
# -- Grafana Alloy image repository.
repository: grafana/alloy
# -- (string) Grafana Alloy image tag. When empty, the Chart's appVersion is
# used.
tag: null
# -- Grafana Alloy image's SHA256 digest (either in format "sha256:XYZ" or "XYZ"). When set, will override `image.tag`.
digest: null
# -- Grafana Alloy image pull policy.
pullPolicy: IfNotPresent
# -- Optional set of image pull secrets.
pullSecrets: []
rbac:
# -- Whether to create RBAC resources for Alloy.
create: true
serviceAccount:
# -- Whether to create a service account for the Grafana Alloy deployment.
create: true
# -- Additional labels to add to the created service account.
additionalLabels: {}
# -- Annotations to add to the created service account.
annotations: {}
# -- The name of the existing service account to use when
# serviceAccount.create is false.
name: null
# Options for the extra controller used for config reloading.
configReloader:
# -- Enables automatically reloading when the Alloy config changes.
enabled: true
image:
# -- Config reloader image registry (defaults to docker.io)
registry: "ghcr.io"
# -- Repository to get config reloader image from.
repository: jimmidyson/configmap-reload
# -- Tag of image to use for config reloading.
tag: v0.12.0
# -- SHA256 digest of image to use for config reloading (either in format "sha256:XYZ" or "XYZ"). When set, will override `configReloader.image.tag`
digest: ""
# -- Override the args passed to the container.
customArgs: []
# -- Resource requests and limits to apply to the config reloader container.
resources:
requests:
cpu: "1m"
memory: "5Mi"
# -- Security context to apply to the Grafana configReloader container.
securityContext: {}
controller:
# -- Type of controller to use for deploying Grafana Alloy in the cluster.
# Must be one of 'daemonset', 'deployment', or 'statefulset'.
type: 'daemonset'
# -- Number of pods to deploy. Ignored when controller.type is 'daemonset'.
replicas: 1
# -- Annotations to add to controller.
extraAnnotations: {}
# -- Whether to deploy pods in parallel. Only used when controller.type is
# 'statefulset'.
parallelRollout: true
# -- Configures Pods to use the host network. When set to true, the ports that will be used must be specified.
hostNetwork: false
# -- Configures Pods to use the host PID namespace.
hostPID: false
# -- Configures the DNS policy for the pod. https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pod-s-dns-policy
dnsPolicy: ClusterFirst
# -- Update strategy for updating deployed Pods.
updateStrategy: {}
# -- nodeSelector to apply to Grafana Alloy pods.
nodeSelector: {}
# -- Tolerations to apply to Grafana Alloy pods.
tolerations: []
# -- Topology Spread Constraints to apply to Grafana Alloy pods.
topologySpreadConstraints: []
# -- priorityClassName to apply to Grafana Alloy pods.
priorityClassName: ''
# -- Extra pod annotations to add.
podAnnotations: {}
# -- Extra pod labels to add.
podLabels: {}
# -- Whether to enable automatic deletion of stale PVCs due to a scale down operation, when controller.type is 'statefulset'.
enableStatefulSetAutoDeletePVC: false
autoscaling:
# -- Creates a HorizontalPodAutoscaler for controller type deployment.
enabled: false
# -- The lower limit for the number of replicas to which the autoscaler can scale down.
minReplicas: 1
# -- The upper limit for the number of replicas to which the autoscaler can scale up.
maxReplicas: 5
# -- Average CPU utilization across all relevant pods, a percentage of the requested value of the resource for the pods. Setting `targetCPUUtilizationPercentage` to 0 will disable CPU scaling.
targetCPUUtilizationPercentage: 0
# -- Average Memory utilization across all relevant pods, a percentage of the requested value of the resource for the pods. Setting `targetMemoryUtilizationPercentage` to 0 will disable Memory scaling.
targetMemoryUtilizationPercentage: 80
scaleDown:
# -- List of policies to determine the scale-down behavior.
policies: []
# - type: Pods
# value: 4
# periodSeconds: 60
# -- Determines which of the provided scaling-down policies to apply if multiple are specified.
selectPolicy: Max
# -- The duration that the autoscaling mechanism should look back on to make decisions about scaling down.
stabilizationWindowSeconds: 300
scaleUp:
# -- List of policies to determine the scale-up behavior.
policies: []
# - type: Pods
# value: 4
# periodSeconds: 60
# -- Determines which of the provided scaling-up policies to apply if multiple are specified.
selectPolicy: Max
# -- The duration that the autoscaling mechanism should look back on to make decisions about scaling up.
stabilizationWindowSeconds: 0
# -- Affinity configuration for pods.
affinity: {}
volumes:
# -- Extra volumes to add to the Grafana Alloy pod.
extra: []
# -- volumeClaimTemplates to add when controller.type is 'statefulset'.
volumeClaimTemplates: []
## -- Additional init containers to run.
## ref: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/
##
initContainers: []
# -- Additional containers to run alongside the Alloy container and initContainers.
extraContainers: []
service:
# -- Creates a Service for the controller's pods.
enabled: true
# -- Service type
type: ClusterIP
# -- NodePort port. Only takes effect when `service.type: NodePort`
nodePort: 31128
# -- Cluster IP, can be set to None, empty "" or an IP address
clusterIP: ''
# -- Value for internal traffic policy. 'Cluster' or 'Local'
internalTrafficPolicy: Cluster
annotations: {}
# cloud.google.com/load-balancer-type: Internal
serviceMonitor:
enabled: false
# -- Additional labels for the service monitor.
additionalLabels: {}
# -- Scrape interval. If not set, the Prometheus default scrape interval is used.
interval: ""
# -- MetricRelabelConfigs to apply to samples after scraping, but before ingestion.
# ref: https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#relabelconfig
metricRelabelings: []
# - action: keep
# regex: 'kube_(daemonset|deployment|pod|namespace|node|statefulset).+'
# sourceLabels: [__name__]
# -- Customize tls parameters for the service monitor
tlsConfig: {}
# -- RelabelConfigs to apply to samples before scraping
# ref: https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#relabelconfig
relabelings: []
# - sourceLabels: [__meta_kubernetes_pod_node_name]
# separator: ;
# regex: ^(.*)$
# targetLabel: nodename
# replacement: $1
# action: replace
ingress:
# -- Enables ingress for Alloy (Faro port)
enabled: false
# For Kubernetes >= 1.18 you should specify the ingress-controller via the field ingressClassName
# See https://kubernetes.io/blog/2020/04/02/improvements-to-the-ingress-api-in-kubernetes-1.18/#specifying-the-class-of-an-ingress
# ingressClassName: nginx
# Values can be templated
annotations:
{}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
labels: {}
path: /
faroPort: 12347
# pathType is only for k8s >= 1.1=
pathType: Prefix
hosts:
- chart-example.local
## Extra paths to prepend to every host configuration. This is useful when working with annotation based services.
extraPaths: []
# - path: /*
# backend:
# serviceName: ssl-redirect
# servicePort: use-annotation
## Or for k8s > 1.19
# - path: /*
# pathType: Prefix
# backend:
# service:
# name: ssl-redirect
# port:
# name: use-annotation
tls: []
# - secretName: chart-example-tls
# hosts:
# - chart-example.local
+7
View File
@@ -0,0 +1,7 @@
apiVersion: v2
name: argocd
version: 1.0.0
dependencies:
- name: argo-cd
version: 9.5.21
repository: https://argoproj.github.io/argo-helm
+7
View File
@@ -0,0 +1,7 @@
apiVersion: v2
name: argocd
version: 1.0.0
dependencies:
- name: argo-cd
version: 7.7.22
repository: https://argoproj.github.io/argo-helm
+7
View File
@@ -0,0 +1,7 @@
apiVersion: v2
name: argocd
version: 1.0.0
dependencies:
- name: argo-cd
version: 7.7.23
repository: https://argoproj.github.io/argo-helm
+16
View File
@@ -0,0 +1,16 @@
apiVersion: v1
name: athens-proxy
version: 0.15.1
appVersion: v0.16.0
kubeVersion: ">= 1.19-0"
description: The proxy server for Go modules
icon: https://raw.githubusercontent.com/gomods/athens/main/docs/static/banner.png
keywords:
- Golang
- Package Management
- Goproxy
- Athens
home: https://github.com/gomods/athens-charts
sources:
- https://github.com/gomods/athens-charts
engine: gotpl
+203
View File
@@ -0,0 +1,203 @@
# Athens Proxy Helm Chart: athens-proxy
![Version: 0.15.1](https://img.shields.io/badge/Version-0.15.1-informational?style=flat-square) ![AppVersion: v0.16.0](https://img.shields.io/badge/AppVersion-v0.16.0-informational?style=flat-square)
## What is Athens?
[Athens](https://docs.gomods.io) is a repository for packages used by your go packages.
Athens provides a repository for [Go Modules](https://github.com/golang/go/wiki/Modules) that you can run. It serves public code and your private code for you, so you don't have to pull directly from a version control system (VCS) like GitHub or GitLab.
## Prerequisites
Kubernetes: `>= 1.19-0`
## Requirements
- A running Kubernetes cluster
- [Kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) installed and setup to use the cluster
- [Helm](https://helm.sh/) [installed](https://github.com/helm/helm#install) and setup to use the cluster (helm init) or [Tillerless Helm](https://github.com/rimusz/helm-tiller)
## Deploy Athens
The fastest way to install Athens using Helm is to deploy it from our public Helm chart repository. First, add the repository with this command:
```console
$ helm repo add athens https://gomods.github.io/athens-charts
$ helm repo update
```
Next, install the chart with default values in the `athens` namespace:
```
$ helm install athens/athens-proxy -n athens --namespace athens
```
This will deploy a single Athens instance in the `athens` namespace with `disk` storage enabled. Additionally, a `ClusterIP` service will be created.
## Values
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| affinity | object | `{}` | see https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#scheduling |
| annotations | object | `{}` | Add extra annotations to the athens pods |
| autoscaling.apiVersionOverride | string | `""` | Overwrite the API version used for HPA, uses 'autoscaling/v2' by default. see https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/horizontal-pod-autoscaler-v2/ |
| autoscaling.behavior | object | `{}` | Define scaling behavior for HPA |
| autoscaling.enabled | bool | `false` | Enable Horizontal Pod Autoscaling |
| autoscaling.maxReplicas | int | `3` | |
| autoscaling.minReplicas | int | `1` | |
| autoscaling.targetCPUUtilizationPercentage | int | `80` | |
| autoscaling.targetMemoryUtilizationPercentage | int | `80` | |
| basicAuth.enabled | bool | `false` | If enabled, it expects to find the username and password in the named secret provided below |
| basicAuth.passwordSecretKey | string | `"password"` | |
| basicAuth.secretName | string | `"athens-proxy-basic-auth"` | Secret name, containing the 'passwordSecretKey' and 'usernameSecretKey' |
| basicAuth.usernameSecretKey | string | `"username"` | |
| configEnvVars | list | `[]` | Set environment variables to be passed to athens pods |
| extraInitContainers | list | `[]` | Define extra init containers for athens-proxy |
| extraLabels | object | `{}` | Add extra labels to all resources |
| extraVolumeMounts | object | `{}` | Add extra volume mounts to deployment pod primary container |
| extraVolumes | object | `{}` | Add extra volumes to deployment pod |
| gitconfig.enabled | bool | `false` | If enabled, it expects to find git configuration in the named secret provided below. By default, gitconfig is disabled |
| gitconfig.secretKey | string | `"gitconfig"` | Key in the kubernetes secret that contains git config data |
| gitconfig.secretName | string | `"athens-proxy-gitconfig"` | Name of the kubernetes secret (in the same namespace as athens-proxy) that contains git config |
| goGetWorkers | int | `3` | Specify the number of go workers |
| image.pullPolicy | string | `"IfNotPresent"` | Specify a imagePullPolicy. see http://kubernetes.io/docs/user-guide/images/#pre-pulling-images |
| image.pullSecrets | list | `[]` | Specify secrets containing credentials for pulling images |
| image.registry | string | `"docker.io"` | |
| image.repository | string | `"gomods/athens"` | |
| image.runAsNonRoot | bool | `false` | Determine if the image should run as `root` or user `athens` |
| ingress.annotations | object | `{}` | |
| ingress.className | string | `""` | |
| ingress.enabled | bool | `false` | Create an Ingress resource for athens |
| ingress.hosts | list | `[]` | Provide an array of values for the ingress host mapping |
| ingress.tls | list | `[]` | |
| initContainerResources | object | `{}` | sshGitServers init container resources |
| initContainerSecurityContext | object | `{}` | sshGitServers init container security context configuration |
| intiContainerResources | object | `{}` | sshGitServers init container resources (deprecated naming, if initContainerResources is defined, that will be used in preference to this value) |
| jaeger.annotations | object | `{}` | |
| jaeger.enabled | bool | `false` | Deploy a jaeger "all-in-one" pod for tracing |
| jaeger.image.repository | string | `"jaegertracing/all-in-one"` | |
| jaeger.image.tag | string | `"latest"` | |
| jaeger.type | string | `"ClusterIP"` | Type of service; valid values are "ClusterIP", "LoadBalancer", and "NodePort". |
| jaeger.url | string | `""` | Specify the jaeger URL for the environment variable used by athens. With default settings, it uses the jaeger-collector-http port of the jaeger service. |
| lifecycle | object | `{}` | Container lifecycle hooks configuration. see API reference: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/ |
| livenessProbe.failureThreshold | int | `3` | |
| livenessProbe.periodSeconds | int | `10` | |
| livenessProbe.successThreshold | int | `1` | |
| livenessProbe.timeoutSeconds | int | `1` | |
| metrics.serviceMonitor.enabled | bool | `false` | Create a ServiceMonitor for prometheus |
| metrics.serviceScrape.enabled | bool | `false` | Create a VMServiceScrape for victoria |
| netrc.enabled | bool | `false` | If enabled, it expects to find the content of a valid '.netrc' file in the named secret provided below |
| netrc.existingSecret | string | `"netrcsecret"` | Secret name, containing the '.netrc' file |
| nodeSelector | object | `{}` | see https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#scheduling |
| priorityClassName | string | `""` | Priority class for pod scheduling. see API reference: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/#priorityclass |
| readinessProbe.failureThreshold | int | `3` | |
| readinessProbe.periodSeconds | int | `10` | |
| readinessProbe.successThreshold | int | `1` | |
| readinessProbe.timeoutSeconds | int | `1` | |
| replicaCount | int | `1` | Set the number of athens-proxy replicas, unless autoscaling is enabled |
| resources | object | `{}` | Define resources for athens pods. see https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#resources |
| securityContext | object | `{}` | Container security context configuration. see API reference: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#securitycontext-v1-core. This will override the `image.runAsNonRoot` settings in the specified container if `runAsUser` or `runAsGroup` are set |
| service.annotations | object | `{}` | Add annotations to the service |
| service.servicePort | int | `80` | Port as exposed by the service |
| service.type | string | `"ClusterIP"` | Type of service; valid values are "ClusterIP", "LoadBalancer", and "NodePort". "ClusterIP" is sufficient in the case when the Proxy will be used from within the cluster. To expose externally, consider a "NodePort" or "LoadBalancer" service or use an "Ingress". |
| serviceAccount.annotations | object | `{}` | |
| serviceAccount.create | bool | `true` | Create a ServiceAccount |
| singleFlight.etcd.endpoints | string | `""` | |
| singleFlight.redis.endpoint | string | `""` | |
| singleFlight.redis.lockConfig | object | `{}` | |
| singleFlight.redis.password | string | `""` | |
| singleFlight.redisSentinel.endpoints | string | `""` | |
| singleFlight.redisSentinel.lockConfig | object | `{}` | |
| singleFlight.redisSentinel.masterName | string | `""` | |
| singleFlight.redisSentinel.redisPassword | string | `""` | |
| singleFlight.redisSentinel.redisUsername | string | `""` | |
| singleFlight.redisSentinel.sentinelPassword | string | `""` | |
| singleFlight.type | string | `""` | SingleFlight type to use. Options are ["memory", "etcd", "redis", "redis-sentinel", "gcp", "azureblob"]. see https://docs.gomods.io/configuration/storage/#running-multiple-athens-pointed-at-the-same-storage |
| sshGitServers | list | `[]` | Configuration for private git servers that will provide ssh and git config to athens in a ConfigMap |
| storage.disk.persistence.accessMode | string | `"ReadWriteOnce"` | |
| storage.disk.persistence.enabled | bool | `false` | Note if you use disk.persistence.enabled, replicaCount should be set to 1 unless your access mode is 'ReadWriteMany' and strategy type must be 'Recreate' |
| storage.disk.persistence.size | string | `"4Gi"` | |
| storage.disk.storageRoot | string | `"/var/lib/athens"` | |
| storage.gcp.bucket | string | `""` | |
| storage.gcp.projectID | string | `""` | For more information, see: https://docs.gomods.io/install/install-on-kubernetes/#google-cloud-storage you must set gcp projectID and bucket when running 'helm install' |
| storage.gcp.serviceAccount | string | `""` | Set serviceAccount to a key which has read/write access to the GCS bucket. If you are running Athens inside GCP, you will most likely not need this as GCP figures out internal authentication between products for you. |
| storage.minio.accessKey | string | `""` | |
| storage.minio.bucket | string | `""` | |
| storage.minio.endpoint | string | `""` | All these variables needs to be set when configuring athens to run with minio backend |
| storage.minio.secretKey | string | `""` | |
| storage.mongo.url | string | `""` | |
| storage.s3.accessKey | string | `""` | |
| storage.s3.bucket | string | `""` | |
| storage.s3.forcePathStyle | bool | `false` | |
| storage.s3.region | string | `""` | You must set s3 bucket and region when running 'helm install' |
| storage.s3.secretKey | string | `""` | |
| storage.s3.sessionToken | string | `""` | |
| storage.s3.useDefaultConfiguration | bool | `false` | |
| storage.type | string | `"disk"` | Storage type to use. For a single instance a PVC may be sufficient |
| strategy.rollingUpdate.maxSurge | int | `1` | |
| strategy.rollingUpdate.maxUnavailable | int | `1` | |
| strategy.type | string | `"Recreate"` | Using RollingUpdate requires a shared storage |
| terminationGracePeriodSeconds | int | `30` | see API reference: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#pod-v1-core. the default value is 30 seconds. |
| tolerations | list | `[]` | see https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#scheduling |
| tracing.enabled | bool | `false` | Set ATHENS_TRACE_EXPORTER* environment variables to point to a tracing deployment. |
| tracing.type | string | `"jaeger"` | Value of ATHENS_TRACE_EXPORTER, supported values are "jaeger", "datadog", and "stackdriver". |
| tracing.url | string | `""` | Value of ATHENS_TRACE_EXPORTER_URL |
| upstreamProxy.enabled | bool | `false` | This is where you can set the URL for the upstream module repository. If 'enabled' is set to true, Athens will try to download modules from the upstream when it doesn't find them in its own storage. Here's a non-exhaustive list of options you can set here: - https://gocenter.io - https://proxy.golang.org |
| upstreamProxy.url | string | `"https://gocenter.io"` | |
## Advanced Configuration
For more advanced configuration options please check Athens [docs](https://docs.gomods.io/install/install-on-kubernetes/#advanced-configuration).
Available options:
- [Replicas](https://docs.gomods.io/install/install-on-kubernetes/#replicas)
- [Access to private repositories via Github](https://docs.gomods.io/install/install-on-kubernetes/#give-athens-access-to-private-repositories-via-github-token-optional)
- [Storage Providers](https://docs.gomods.io/install/install-on-kubernetes/#storage-providers)
- [Kubernetes Service](https://docs.gomods.io/install/install-on-kubernetes/#kubernetes-service)
- [Ingress Resource](https://docs.gomods.io/install/install-on-kubernetes/#ingress-resource)
- [Upstream module repository](https://docs.gomods.io/install/install-on-kubernetes/#upstream-module-repository)
- [.netrc file support](https://docs.gomods.io/install/install-on-kubernetes/#netrc-file-support)
- [gitconfig support](https://docs.gomods.io/install/install-on-kubernetes/#gitconfig-support)
### Pass extra configuration environment variables
You can pass any extra environment variables supported in [config.dev.toml](../../../config.dev.toml).
The example below shows how to set username/password for basic auth:
```yaml
configEnvVars:
- name: BASIC_AUTH_USER
value: "some_user"
- name: BASIC_AUTH_PASS
value: "some_password"
```
### Private git servers over ssh support
One or more of git servers can added to `sshGitServers`, and the corresponding config files (git config and ssh config) and ssh keys will be created. Athens then will use these configs and keys to download the source from the git servers.
```yaml
sshGitServers:
## Private git servers over ssh
## to enable uncomment lines with single hash below
## hostname of the git server
- host: git.example.com
## ssh username
user: git
## ssh private key for the user
privateKey: |
-----BEGIN RSA PRIVATE KEY-----
...
-----END RSA PRIVATE KEY-----
## ssh port
port: 22
```
## Testing
Using `chart-testing` to lint, install and test the chart on a local Kubernetes (Minikube, Rancher Desktop, ...)
```shell
ct lint-and-install --all
```
@@ -0,0 +1,96 @@
{{- /* run `helm-docs` (github.com/norwoodj/helm-docs) to generate README.md */ -}}
# Athens Proxy Helm Chart: {{ template "chart.name" . }}
{{ template "chart.versionBadge" . }}{{ template "chart.typeBadge" . }}{{ template "chart.appVersionBadge" . }}
## What is Athens?
[Athens](https://docs.gomods.io) is a repository for packages used by your go packages.
Athens provides a repository for [Go Modules](https://github.com/golang/go/wiki/Modules) that you can run. It serves public code and your private code for you, so you don't have to pull directly from a version control system (VCS) like GitHub or GitLab.
## Prerequisites
{{ template "chart.kubeVersionLine" . }}
## Requirements
- A running Kubernetes cluster
- [Kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) installed and setup to use the cluster
- [Helm](https://helm.sh/) [installed](https://github.com/helm/helm#install) and setup to use the cluster (helm init) or [Tillerless Helm](https://github.com/rimusz/helm-tiller)
## Deploy Athens
The fastest way to install Athens using Helm is to deploy it from our public Helm chart repository. First, add the repository with this command:
```console
$ helm repo add athens https://gomods.github.io/athens-charts
$ helm repo update
```
Next, install the chart with default values in the `athens` namespace:
```
$ helm install athens/athens-proxy -n athens --namespace athens
```
This will deploy a single Athens instance in the `athens` namespace with `disk` storage enabled. Additionally, a `ClusterIP` service will be created.
{{ template "chart.valuesSection" . }}
## Advanced Configuration
For more advanced configuration options please check Athens [docs](https://docs.gomods.io/install/install-on-kubernetes/#advanced-configuration).
Available options:
- [Replicas](https://docs.gomods.io/install/install-on-kubernetes/#replicas)
- [Access to private repositories via Github](https://docs.gomods.io/install/install-on-kubernetes/#give-athens-access-to-private-repositories-via-github-token-optional)
- [Storage Providers](https://docs.gomods.io/install/install-on-kubernetes/#storage-providers)
- [Kubernetes Service](https://docs.gomods.io/install/install-on-kubernetes/#kubernetes-service)
- [Ingress Resource](https://docs.gomods.io/install/install-on-kubernetes/#ingress-resource)
- [Upstream module repository](https://docs.gomods.io/install/install-on-kubernetes/#upstream-module-repository)
- [.netrc file support](https://docs.gomods.io/install/install-on-kubernetes/#netrc-file-support)
- [gitconfig support](https://docs.gomods.io/install/install-on-kubernetes/#gitconfig-support)
### Pass extra configuration environment variables
You can pass any extra environment variables supported in [config.dev.toml](../../../config.dev.toml).
The example below shows how to set username/password for basic auth:
```yaml
configEnvVars:
- name: BASIC_AUTH_USER
value: "some_user"
- name: BASIC_AUTH_PASS
value: "some_password"
```
### Private git servers over ssh support
One or more of git servers can added to `sshGitServers`, and the corresponding config files (git config and ssh config) and ssh keys will be created. Athens then will use these configs and keys to download the source from the git servers.
```yaml
sshGitServers:
## Private git servers over ssh
## to enable uncomment lines with single hash below
## hostname of the git server
- host: git.example.com
## ssh username
user: git
## ssh private key for the user
privateKey: |
-----BEGIN RSA PRIVATE KEY-----
...
-----END RSA PRIVATE KEY-----
## ssh port
port: 22
```
## Testing
Using `chart-testing` to lint, install and test the chart on a local Kubernetes (Minikube, Rancher Desktop, ...)
```shell
ct lint-and-install --all
```
@@ -0,0 +1,31 @@
ingress:
enabled: true
annotations:
hosts:
- host: athens-proxy.local
paths:
- path: /
pathType: ImplementationSpecific
extraLabels:
athensIs: "awesome"
annotations:
test.annotation: "athens-proxy"
configEnvVars:
- name: KEY
value: "value"
image:
runAsNonRoot: true
securityContext:
allowPrivilegeEscalation: false
runAsNonRoot: true
jaeger:
enabled: true
annotations:
test.annotation: "jaeger"
service:
type: "NodePort"
terminationGracePeriodSeconds: 60
lifecycle:
preStop:
exec:
command: ["/bin/sleep", "10"]
@@ -0,0 +1,27 @@
{{- if .Values.ingress.enabled }}
The Athens can be accessed via URL:
{{- else }}
Get the Athens URL by running these commands:
{{- end }}
{{- if (and .Values.ingress.enabled .Values.ingress.tls) }}
{{- range .Values.ingress.tls }}
https://{{ .host }}
{{- end }}
{{- else if .Values.ingress.enabled }}
{{- range .Values.ingress.hosts }}
http://{{ .host }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get svc -w {{ template "fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo http://$SERVICE_IP:{{ .Values.service.externalPort }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "fullname" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl port-forward $POD_NAME 8080:3000
{{- end }}
@@ -0,0 +1,69 @@
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{/*
Common labels used by all resources in their meta fields.
Includes existing labels for passivity, new standard labels, and user-defined extra labels.
https://helm.sh/docs/chart_best_practices/labels/
https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/#labels
*/}}
{{- define "athens.metaLabels" -}}
{{- /* Allow an app suffix name to be passed in to append to the fullname */}}
{{- $defaultAppName := include "fullname" . }}
{{- $appName := printf "%s%s" $defaultAppName (default "" .appSuffix) }}
{{- /* Existing Legacy labels for passivity */}}
app: {{ $appName }}
chart: {{ template "athens.chart" . }}
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
{{- /* New Standard labels */}}
app.kubernetes.io/name: {{ $appName }}
helm.sh/chart: {{ template "athens.chart" . }}
app.kubernetes.io/managed-by: "{{ .Release.Service }}"
app.kubernetes.io/instance: "{{ .Release.Name }}"
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- /* Include user defined labels */}}
{{- if .Values.extraLabels }}
{{ toYaml .Values.extraLabels }}
{{- end -}}
{{- end }}
{{/*
A common helper for creating the full chart name and version as used by the chart label.
*/}}
{{- define "athens.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Determine the home directory of the current user.
*/}}
{{- define "home" -}}
{{- if not .Values.image.runAsNonRoot -}}
/root
{{- else -}}
/home/athens
{{- end -}}
{{- end -}}
{{- define "serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "fullname" .) .Values.serviceAccount.name | trunc 63 | trimSuffix "-" }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name | trunc 63 | trimSuffix "-" }}
{{- end -}}
{{- end -}}
@@ -0,0 +1,23 @@
{{- if .Values.sshGitServers -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "fullname" . }}-ssh-git-servers
labels:
{{- include "athens.metaLabels" . | nindent 4 }}
data:
ssh_config: |
{{- range $server := .Values.sshGitServers }}
Host {{ $server.host }}
Hostname {{ $server.host }}
User {{ $server.user }}
Port {{ $server.port | default 22 }}
StrictHostKeyChecking no
IdentityFile /ssh-keys/id_rsa-{{ $server.host }}
{{- end }}
git_config: |
{{- range $server := .Values.sshGitServers }}
[url "ssh://{{ $server.user }}@{{ $server.host }}:{{ $server.port }}"]
insteadOf = https://{{ $server.host }}{{ default "" $server.path }}
{{- end }}
{{- end -}}
@@ -0,0 +1,12 @@
{{- if .Values.upstreamProxy.enabled -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "fullname" . }}-upstream
labels:
{{- include "athens.metaLabels" . | nindent 4 }}
data:
FilterForUpstreamProxy: |-
# FilterFile for fetching modules directly from upstream proxy
D
{{- end -}}
@@ -0,0 +1,415 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "fullname" . }}
labels:
{{- include "athens.metaLabels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
{{- with .Values.strategy }}
strategy:
{{- if eq .type "Recreate" }}
type: Recreate
{{- else }}
{{ toYaml . | nindent 4 }}
{{- end }}
{{- end }}
selector:
matchLabels:
app: {{ include "fullname" . }}
release: "{{ .Release.Name }}"
template:
metadata:
labels:
{{- include "athens.metaLabels" . | nindent 8 }}
annotations:
checksum/upstream: {{ include (print $.Template.BasePath "/config-upstream.yaml") . | sha256sum }}
checksum/ssh-config: {{ include (print $.Template.BasePath "/config-ssh-git-servers.yaml") . | sha256sum }}
checksum/ssh-secret: {{ include (print $.Template.BasePath "/secret-ssh-git-servers.yaml") . | sha256sum }}
{{- if .Values.annotations }}
{{- toYaml .Values.annotations | nindent 8 }}
{{- end }}
spec:
{{- if .Values.priorityClassName }}
priorityClassName: {{ .Values.priorityClassName | quote }}
{{- end }}
{{- if .Values.terminationGracePeriodSeconds }}
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
{{- end }}
{{- if .Values.image.runAsNonRoot }}
securityContext:
runAsUser: 1000
runAsGroup: 1000
{{- end }}
serviceAccountName: {{ include "serviceAccountName" . | quote }}
{{- if .Values.image.pullSecrets }}
imagePullSecrets:
{{- toYaml .Values.image.pullSecrets | nindent 8 }}
{{- end }}
{{- if or .Values.sshGitServers .Values.extraInitContainers }}
initContainers:
{{- if .Values.sshGitServers }}
- name: copy-key-files
image: alpine:3.9
command:
- sh
- -c
args: ["cp {{ include "home" . }}/.ssh/id_rsa* /ssh-keys && chmod 400 /ssh-keys/*"]
volumeMounts:
- name: ssh-keys
mountPath: /ssh-keys
{{- $dot := . -}}
{{- range $server := .Values.sshGitServers }}
{{- if $server.existingSecret }}
- name: ssh-git-servers-secret-{{ $server.host | replace "." "-" }}
mountPath: "{{ include "home" $dot }}/.ssh/id_rsa-{{ $server.host }}"
subPath: {{ $server.existingSecret.subPath | quote }}
{{- else }}
- name: ssh-git-servers-secret
mountPath: {{ include "home" $dot }}/.ssh/id_rsa-{{ $server.host }}
subPath: id_rsa-{{ $server.host }}
{{- end }}
{{- end }}
{{- with .Values.initContainerSecurityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with (default .Values.intiContainerResources .Values.initContainerResources) }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- end }}
{{- if .Values.extraInitContainers }}
{{- toYaml .Values.extraInitContainers | nindent 6 }}
{{- end }}
{{- end }}
containers:
- name: {{ include "fullname" . }}
image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
livenessProbe:
failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
httpGet:
path: "/healthz"
port: 3000
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
successThreshold: {{ .Values.livenessProbe.successThreshold }}
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
readinessProbe:
failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
httpGet:
path: "/readyz"
port: 3000
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
successThreshold: {{ .Values.readinessProbe.successThreshold }}
timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
env:
- name: ATHENS_GOGET_WORKERS
value: {{ .Values.goGetWorkers | quote }}
- name: ATHENS_STORAGE_TYPE
value: {{ .Values.storage.type | quote }}
{{- if eq .Values.storage.type "disk"}}
- name: ATHENS_DISK_STORAGE_ROOT
value: {{ .Values.storage.disk.storageRoot | quote }}
{{- else if eq .Values.storage.type "mongo"}}
- name: ATHENS_MONGO_STORAGE_URL
valueFrom:
secretKeyRef:
name: {{ include "fullname" . }}-secret
key: ATHENS_MONGO_STORAGE_URL
{{- else if eq .Values.storage.type "s3" }}
- name: AWS_REGION
value: {{ .Values.storage.s3.region | quote }}
- name: ATHENS_S3_BUCKET_NAME
value: {{ .Values.storage.s3.bucket | quote }}
- name: AWS_USE_DEFAULT_CONFIGURATION
value: {{ .Values.storage.s3.useDefaultConfiguration | quote }}
- name: AWS_FORCE_PATH_STYLE
value: {{ .Values.storage.s3.forcePathStyle | quote }}
{{- if .Values.storage.s3.accessKey }}
- name: AWS_ACCESS_KEY_ID
valueFrom:
secretKeyRef:
name: {{ include "fullname" . }}-secret
key: AWS_ACCESS_KEY_ID
{{- end }}
{{- if .Values.storage.s3.secretKey }}
- name: AWS_SECRET_ACCESS_KEY
valueFrom:
secretKeyRef:
name: {{ include "fullname" . }}-secret
key: AWS_SECRET_ACCESS_KEY
{{- end }}
{{- if .Values.storage.s3.sessionToken }}
- name: AWS_SESSION_TOKEN
valueFrom:
secretKeyRef:
name: {{ include "fullname" . }}-secret
key: AWS_SESSION_TOKEN
{{- end }}
{{- else if eq .Values.storage.type "gcp"}}
- name: GOOGLE_CLOUD_PROJECT
value: {{ .Values.storage.gcp.projectID | quote }}
- name: ATHENS_STORAGE_GCP_BUCKET
value: {{ .Values.storage.gcp.bucket | quote }}
{{- if .Values.storage.gcp.serviceAccount }}
- name: ATHENS_STORAGE_GCP_JSON_KEY
valueFrom:
secretKeyRef:
name: {{ include "fullname" . }}-secret
key: ATHENS_STORAGE_GCP_JSON_KEY
{{- end }}
{{- else if eq .Values.storage.type "minio" }}
{{- if .Values.storage.minio.endpoint }}
- name: ATHENS_MINIO_ENDPOINT
value: {{ .Values.storage.minio.endpoint | quote }}
{{- end }}
{{- if .Values.storage.minio.accessKey }}
- name: ATHENS_MINIO_ACCESS_KEY_ID
valueFrom:
secretKeyRef:
name: {{ include "fullname" . }}-secret
key: ATHENS_MINIO_ACCESS_KEY_ID
{{- end }}
{{- if .Values.storage.minio.secretKey }}
- name: ATHENS_MINIO_SECRET_ACCESS_KEY
valueFrom:
secretKeyRef:
name: {{ include "fullname" . }}-secret
key: ATHENS_MINIO_SECRET_ACCESS_KEY
{{- end }}
{{- if .Values.storage.minio.bucket }}
- name: ATHENS_MINIO_BUCKET_NAME
value: {{ .Values.storage.minio.bucket | quote }}
{{- end }}
{{- end }}
{{- if .Values.singleFlight.type }}
- name: ATHENS_SINGLE_FLIGHT_TYPE
value: {{ .Values.singleFlight.type | quote }}
{{- end }}
{{- if eq .Values.singleFlight.type "etcd"}}
{{- if .Values.singleFlight.etcd.endpoints }}
- name: ATHENS_ETCD_ENDPOINTS
value: {{ .Values.singleFlight.etcd.endpoints | quote }}
{{- end }}
{{- else if eq .Values.singleFlight.type "redis"}}
{{- if .Values.singleFlight.redis.endpoint }}
- name: ATHENS_REDIS_ENDPOINT
value: {{ .Values.singleFlight.redis.endpoint | quote }}
{{- end }}
{{- if .Values.singleFlight.redis.password }}
- name: ATHENS_REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "fullname" . }}-secret
key: ATHENS_SINGLE_FLIGHT_REDIS_PASSWORD
{{- end }}
{{- with .Values.singleFlight.redis.lockConfig }}
{{- if .ttl }}
- name: ATHENS_REDIS_LOCK_TTL
value: {{ .ttl | quote }}
{{- end }}
{{- if .timeout }}
- name: ATHENS_REDIS_LOCK_TIMEOUT
value: {{ .timeout | quote }}
{{- end }}
{{- if .maxRetries }}
- name: ATHENS_REDIS_LOCK_MAX_RETRIES
value: {{ .maxRetries | quote }}
{{- end }}
{{- end }}
{{- else if eq .Values.singleFlight.type "redis-sentinel"}}
{{- if .Values.singleFlight.redisSentinel.endpoints }}
- name: ATHENS_REDIS_SENTINEL_ENDPOINTS
value: {{ .Values.singleFlight.redisSentinel.endpoints | quote }}
{{- end }}
{{- if .Values.singleFlight.redisSentinel.masterName }}
- name: ATHENS_REDIS_SENTINEL_MASTER_NAME
value: {{ .Values.singleFlight.redisSentinel.masterName | quote }}
{{- end }}
{{- if .Values.singleFlight.redisSentinel.sentinelPassword }}
- name: ATHENS_REDIS_SENTINEL_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "fullname" . }}-secret
key: ATHENS_SINGLE_FLIGHT_REDIS_SENTINEL_SENTINEL_PASSWORD
{{- end }}
{{- if .Values.singleFlight.redisSentinel.redisUsername }}
- name: ATHENS_REDIS_USERNAME
value: {{ .Values.singleFlight.redisSentinel.redisUsername | quote }}
{{- end }}
{{- if .Values.singleFlight.redisSentinel.redisPassword }}
- name: ATHENS_REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "fullname" . }}-secret
key: ATHENS_SINGLE_FLIGHT_REDIS_SENTINEL_REDIS_PASSWORD
{{- end }}
{{- with .Values.singleFlight.redisSentinel.lockConfig }}
{{- if .ttl }}
- name: ATHENS_REDIS_LOCK_TTL
value: {{ .ttl | quote }}
{{- end }}
{{- if .timeout }}
- name: ATHENS_REDIS_LOCK_TIMEOUT
value: {{ .timeout | quote }}
{{- end }}
{{- if .maxRetries }}
- name: ATHENS_REDIS_LOCK_MAX_RETRIES
value: {{ .maxRetries | quote }}
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.netrc.enabled }}
- name: ATHENS_NETRC_PATH
value: "/etc/netrc/.netrc"
{{- end }}
{{- if .Values.upstreamProxy.enabled }}
- name: ATHENS_FILTER_FILE
value: "/usr/local/lib/FilterForUpstreamProxy"
- name: ATHENS_GLOBAL_ENDPOINT
value: {{ .Values.upstreamProxy.url | quote }}
{{- end }}
{{- if .Values.jaeger.enabled }}
- name: ATHENS_TRACE_EXPORTER_URL
value: {{ .Values.jaeger.url | default (print "http://" (include "fullname" .) "-jaeger:14268" ) | quote }}
- name: ATHENS_TRACE_EXPORTER
value: "jaeger"
{{- end }}
{{- if and .Values.tracing.enabled (not .Values.jaeger.enabled) }}
- name: ATHENS_TRACE_EXPORTER_URL
value: {{ .Values.tracing.url }}
- name: ATHENS_TRACE_EXPORTER
value: {{ .Values.tracing.type }}
{{- end }}
{{- if .Values.basicAuth.enabled }}
- name: BASIC_AUTH_USER
valueFrom:
secretKeyRef:
name: {{ default "athens-proxy-basic-auth" .Values.basicAuth.secretName | quote }}
key: {{ default "username" .Values.basicAuth.usernameSecretKey | quote }}
- name: BASIC_AUTH_PASS
valueFrom:
secretKeyRef:
name: {{ default "athens-proxy-basic-auth" .Values.basicAuth.secretName | quote }}
key: {{ default "password" .Values.basicAuth.passwordSecretKey | quote }}
{{- end }}
{{- if .Values.configEnvVars }}
{{- toYaml .Values.configEnvVars | nindent 8 }}
{{- end }}
ports:
- containerPort: 3000
{{- if or (eq .Values.storage.type "disk") .Values.upstreamProxy.enabled .Values.netrc.enabled .Values.sshGitServers .Values.gitconfig.enabled .Values.extraVolumeMounts }}
volumeMounts:
{{- end }}
{{- if eq .Values.storage.type "disk" }}
- name: storage-volume
mountPath: {{ .Values.storage.disk.storageRoot | quote }}
{{- end }}
{{- if .Values.upstreamProxy.enabled }}
- name: upstream-config
mountPath: "/usr/local/lib"
readOnly: true
{{- end }}
{{- if .Values.netrc.enabled }}
- name: netrc
mountPath: "/etc/netrc"
readOnly: true
{{- end }}
{{- if .Values.sshGitServers }}
- name: ssh-git-servers-config
mountPath: {{ include "home" . }}/.ssh/config
subPath: ssh_config
- name: ssh-git-servers-config
mountPath: {{ include "home" . }}/.gitconfig
subPath: git_config
- name: ssh-keys
mountPath: /ssh-keys
{{- end }}
{{- if .Values.gitconfig.enabled }}
- name: gitconfig
mountPath: "/etc/gitconfig"
subPath: "gitconfig"
{{- end }}
{{- range $server := .Values.sshGitServers }}
{{- if $server.existingSecret }}
- name: ssh-git-servers-secret-{{ $server.host | replace "." "-" }}
mountPath: {{ include "home" $ }}/.ssh/id_rsa-{{ $server.host }}
subPath: {{ $server.existingSecret.subPath | quote }}
{{- end }}
{{- end }}
{{- with .Values.extraVolumeMounts }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.securityContext }}
securityContext:
{{- toYaml . | nindent 10 }}
{{- end }}
{{- with .Values.lifecycle }}
lifecycle:
{{- toYaml . | nindent 10 }}
{{- end }}
{{- with .Values.resources }}
resources:
{{- toYaml . | nindent 10 }}
{{- end }}
volumes:
- name: storage-volume
{{- if .Values.storage.disk.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ include "fullname" . }}-storage
{{- else }}
emptyDir: {}
{{- end }}
{{- if .Values.upstreamProxy.enabled }}
- name: upstream-config
configMap:
name: {{ include "fullname" . }}-upstream
{{- end }}
{{- if .Values.netrc.enabled }}
- name: netrc
secret:
secretName: {{ .Values.netrc.existingSecret }}
{{- end }}
{{- if .Values.sshGitServers }}
- name: ssh-keys
emptyDir: {}
- name: ssh-git-servers-config
configMap:
name: {{ include "fullname" . }}-ssh-git-servers
- name: ssh-git-servers-secret
secret:
secretName: {{ include "fullname" . }}-ssh-git-servers
{{- range $server := .Values.sshGitServers }}
{{- if $server.existingSecret }}
- name: ssh-git-servers-secret-{{ $server.host | replace "." "-" }}
secret:
secretName: {{ $server.existingSecret.name | quote }}
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.gitconfig.enabled }}
- name: gitconfig
secret:
secretName: {{ .Values.gitconfig.secretName }}
items:
- key: {{ .Values.gitconfig.secretKey }}
path: "gitconfig"
{{- end }}
{{- with .Values.extraVolumes }}
{{- toYaml . | nindent 6 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
@@ -0,0 +1,50 @@
{{- if .Values.autoscaling.enabled }}
{{- $apiVersion := "autoscaling/v2" }}
{{- if .Values.autoscaling.apiVersionOverride -}}
{{- $apiVersion = .Values.autoscaling.apiVersionOverride }}
{{- else if .Capabilities.APIVersions.Has "autoscaling/v2beta1" }}
{{- $apiVersion = "autoscaling/v2beta1" }}
{{- end }}
apiVersion: {{ $apiVersion }}
kind: HorizontalPodAutoscaler
metadata:
name: {{ template "fullname" . }}
labels:
{{- include "athens.metaLabels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ template "fullname" . }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
{{- with .Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
{{- if eq $apiVersion "autoscaling/v2beta1" }}
targetAverageUtilization: {{ . }}
{{- else }}
target:
averageUtilization: {{ . }}
type: Utilization
{{- end }}
{{- end }}
{{- with .Values.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
{{- if eq $apiVersion "autoscaling/v2beta1" }}
targetAverageUtilization: {{ . }}
{{- else }}
target:
averageUtilization: {{ . }}
type: Utilization
{{- end }}
{{- end }}
{{- with .Values.autoscaling.behavior }}
behavior:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
@@ -0,0 +1,61 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "fullname" . -}}
{{- $svcPort := .Values.service.servicePort -}}
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
{{- end }}
{{- end }}
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1" -}}
apiVersion: networking.k8s.io/v1
{{- else if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1" -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
{{- include "athens.metaLabels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.ingress.className }}
{{- end }}
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ .path }}
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
pathType: {{ .pathType }}
{{- end }}
backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
{{- else }}
serviceName: {{ $fullName }}
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
@@ -0,0 +1,44 @@
{{- if .Values.jaeger.enabled -}}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "fullname" . }}-jaeger
labels:
{{- include "athens.metaLabels" (dict "appSuffix" "-jaeger" "Values" .Values "Release" .Release "Chart" .Chart) | nindent 4 }}
spec:
replicas: 1
selector:
matchLabels:
app: {{ template "fullname" . }}-jaeger
release: "{{ .Release.Name }}"
template:
metadata:
labels:
{{- include "athens.metaLabels" (dict "appSuffix" "-jaeger" "Values" .Values "Release" .Release "Chart" .Chart) | nindent 8 }}
{{- if .Values.jaeger.annotations }}
annotations:
{{- toYaml .Values.jaeger.annotations | nindent 8 }}
{{- end }}
spec:
containers:
- env:
- name: COLLECTOR_ZIPKIN_HTTP_PORT
value: "9441"
image: "{{ .Values.jaeger.image.repository }}:{{ .Values.jaeger.image.tag }}"
name: {{ template "fullname" . }}-jaeger
ports:
- containerPort: 14268
protocol: TCP
- containerPort: 5775
protocol: UDP
- containerPort: 6831
protocol: UDP
- containerPort: 6832
protocol: UDP
- containerPort: 5778
protocol: TCP
- containerPort: 16686
protocol: TCP
- containerPort: 9411
protocol: TCP
{{- end -}}
@@ -0,0 +1,38 @@
{{- if .Values.jaeger.enabled -}}
apiVersion: v1
kind: Service
metadata:
name: {{ template "fullname" . }}-jaeger
labels:
{{- include "athens.metaLabels" (dict "appSuffix" "-jaeger" "Values" .Values "Release" .Release "Chart" .Chart) | nindent 4 }}
spec:
type: {{ .Values.jaeger.type }}
ports:
- name: jaeger-collector-http
port: 14268
protocol: TCP
targetPort: 14268
- name: jaeger-zipkin-thrift
port: 5775
protocol: UDP
targetPort: 5775
- name: jaeger-compact
port: 6831
protocol: UDP
targetPort: 6831
- name: jaeger-binary
port: 6832
protocol: UDP
targetPort: 6832
- name: jaeger-configs
port: 5778
protocol: TCP
targetPort: 5778
- name: jaeger-query-http
port: 16686
protocol: TCP
targetPort: 16686
selector:
app: {{ template "fullname" . }}-jaeger
release: "{{ .Release.Name }}"
{{- end -}}

Some files were not shown because too many files have changed in this diff Show More