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
+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