Skip to content

Commit

Permalink
feat: replace eventHandler by grafana alloy (#123)
Browse files Browse the repository at this point in the history
* feat: replace eventHandler by grafana alloy

To collect event we used a custom template. This commit will replace the
event handler template, by a configuration of alloy to collect events. The
local.tf file contains the alloy block to configure the default pipeline.
This block can be override completly, but currently it is not possible
to use parameter to fine tune default config.

* docs(terraform-docs): generate docs and write to README.adoc

* chore(enable_monitor): add var in flavour

* docs(terraform-docs): generate docs and write to README.adoc

* feat(alloy): remove event handler

- remove pod limits and requests for events handler

* docs(terraform-docs): generate docs and write to README.adoc

---------

Co-authored-by: Xavier Rakotomamonjy <[email protected]>
Co-authored-by: Xaving <[email protected]>
  • Loading branch information
3 people authored Dec 20, 2024
1 parent 25a16f3 commit fb87844
Show file tree
Hide file tree
Showing 15 changed files with 140 additions and 293 deletions.
40 changes: 15 additions & 25 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@ Type: `string`

Default: `"v10.0.0"`

==== [[input_enable_service_monitor]] <<input_enable_service_monitor,enable_service_monitor>>

Description: Enable Prometheus ServiceMonitor in the Helm chart.

Type: `bool`

Default: `true`

==== [[input_helm_values]] <<input_helm_values,helm_values>>

Description: Helm chart value overrides. They should be passed as a list of HCL structures.
Expand Down Expand Up @@ -260,18 +268,6 @@ object({
memory = optional(string, "512Mi")
}), {})
}), {})
grafana_eventhandler = optional(object({
requests = optional(object({
cpu = optional(string, "100m")
memory = optional(string, "128Mi")
}), {})
limits = optional(object({
cpu = optional(string)
memory = optional(string, "256Mi")
}), {})
}), {})
})
----

Expand Down Expand Up @@ -331,11 +327,11 @@ Description: Credentials to access the Loki ingress, if activated.
[cols="a,a",options="header,autowidth"]
|===
|Name |Version
|[[provider_null]] <<provider_null,null>> |>= 3
|[[provider_random]] <<provider_random,random>> |>= 3
|[[provider_htpasswd]] <<provider_htpasswd,htpasswd>> |>= 1
|[[provider_argocd]] <<provider_argocd,argocd>> |>= 6
|[[provider_utils]] <<provider_utils,utils>> |>= 1
|[[provider_null]] <<provider_null,null>> |>= 3
|===

= Resources
Expand Down Expand Up @@ -381,6 +377,12 @@ Description: Credentials to access the Loki ingress, if activated.
|`"v10.0.0"`
|no

|[[input_enable_service_monitor]] <<input_enable_service_monitor,enable_service_monitor>>
|Enable Prometheus ServiceMonitor in the Helm chart.
|`bool`
|`true`
|no

|[[input_helm_values]] <<input_helm_values,helm_values>>
|Helm chart value overrides. They should be passed as a list of HCL structures.
|`any`
Expand Down Expand Up @@ -561,18 +563,6 @@ object({
memory = optional(string, "512Mi")
}), {})
}), {})
grafana_eventhandler = optional(object({
requests = optional(object({
cpu = optional(string, "100m")
memory = optional(string, "128Mi")
}), {})
limits = optional(object({
cpu = optional(string)
memory = optional(string, "256Mi")
}), {})
}), {})
})
----

Expand Down
38 changes: 14 additions & 24 deletions aks/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,14 @@ Type: `string`

Default: `"v10.0.0"`

==== [[input_enable_service_monitor]] <<input_enable_service_monitor,enable_service_monitor>>

Description: Enable Prometheus ServiceMonitor in the Helm chart.

Type: `bool`

Default: `true`

==== [[input_helm_values]] <<input_helm_values,helm_values>>

Description: Helm chart value overrides. They should be passed as a list of HCL structures.
Expand Down Expand Up @@ -280,18 +288,6 @@ object({
memory = optional(string, "512Mi")
}), {})
}), {})
grafana_eventhandler = optional(object({
requests = optional(object({
cpu = optional(string, "100m")
memory = optional(string, "128Mi")
}), {})
limits = optional(object({
cpu = optional(string)
memory = optional(string, "256Mi")
}), {})
}), {})
})
----

Expand Down Expand Up @@ -423,6 +419,12 @@ object({
|`"v10.0.0"`
|no

|[[input_enable_service_monitor]] <<input_enable_service_monitor,enable_service_monitor>>
|Enable Prometheus ServiceMonitor in the Helm chart.
|`bool`
|`true`
|no

|[[input_helm_values]] <<input_helm_values,helm_values>>
|Helm chart value overrides. They should be passed as a list of HCL structures.
|`any`
Expand Down Expand Up @@ -603,18 +605,6 @@ object({
memory = optional(string, "512Mi")
}), {})
}), {})
grafana_eventhandler = optional(object({
requests = optional(object({
cpu = optional(string, "100m")
memory = optional(string, "128Mi")
}), {})
limits = optional(object({
cpu = optional(string)
memory = optional(string, "256Mi")
}), {})
}), {})
})
----

Expand Down
13 changes: 7 additions & 6 deletions aks/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,13 @@ resource "azurerm_federated_identity_credential" "loki" {
module "loki-stack" {
source = "../"

argocd_project = var.argocd_project
argocd_labels = var.argocd_labels
destination_cluster = var.destination_cluster
target_revision = var.target_revision
app_autosync = var.app_autosync
dependency_ids = var.dependency_ids
argocd_project = var.argocd_project
argocd_labels = var.argocd_labels
destination_cluster = var.destination_cluster
target_revision = var.target_revision
enable_service_monitor = var.enable_service_monitor
app_autosync = var.app_autosync
dependency_ids = var.dependency_ids

resources = var.resources
retention = var.retention
Expand Down
7 changes: 5 additions & 2 deletions charts/loki-microservice/Chart.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@ dependencies:
- name: promtail
repository: https://grafana.github.io/helm-charts
version: 6.16.3
digest: sha256:681eee98e61cc20537a6d960b47126e1e41d9693a87d8d04d0315013eb0a993f
generated: "2024-07-15T07:01:54.548457538Z"
- name: alloy
repository: https://grafana.github.io/helm-charts
version: 0.9.2
digest: sha256:43e2fc71a6bd46a321a052867c881e87100da35719a35f379933a08f04cab143
generated: "2024-10-29T15:39:42.138921452+01:00"
3 changes: 3 additions & 0 deletions charts/loki-microservice/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ dependencies:
- name: promtail
repository: https://grafana.github.io/helm-charts
version: 6.16.3
- name: alloy
repository: https://grafana.github.io/helm-charts
version: 0.9.2
description: |
This chart installs loki-distributed.
Loki is a log aggregation system made by Grafana Labs, and inspired by Prometheus.
Expand Down
Binary file added charts/loki-microservice/charts/alloy-0.9.2.tgz
Binary file not shown.
126 changes: 0 additions & 126 deletions charts/loki-microservice/templates/event_handler.yaml

This file was deleted.

38 changes: 14 additions & 24 deletions eks/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,14 @@ Type: `string`

Default: `"v10.0.0"`

==== [[input_enable_service_monitor]] <<input_enable_service_monitor,enable_service_monitor>>

Description: Enable Prometheus ServiceMonitor in the Helm chart.

Type: `bool`

Default: `true`

==== [[input_helm_values]] <<input_helm_values,helm_values>>

Description: Helm chart value overrides. They should be passed as a list of HCL structures.
Expand Down Expand Up @@ -282,18 +290,6 @@ object({
memory = optional(string, "512Mi")
}), {})
}), {})
grafana_eventhandler = optional(object({
requests = optional(object({
cpu = optional(string, "100m")
memory = optional(string, "128Mi")
}), {})
limits = optional(object({
cpu = optional(string)
memory = optional(string, "256Mi")
}), {})
}), {})
})
----

Expand Down Expand Up @@ -424,6 +420,12 @@ object({
|`"v10.0.0"`
|no

|[[input_enable_service_monitor]] <<input_enable_service_monitor,enable_service_monitor>>
|Enable Prometheus ServiceMonitor in the Helm chart.
|`bool`
|`true`
|no

|[[input_helm_values]] <<input_helm_values,helm_values>>
|Helm chart value overrides. They should be passed as a list of HCL structures.
|`any`
Expand Down Expand Up @@ -604,18 +606,6 @@ object({
memory = optional(string, "512Mi")
}), {})
}), {})
grafana_eventhandler = optional(object({
requests = optional(object({
cpu = optional(string, "100m")
memory = optional(string, "128Mi")
}), {})
limits = optional(object({
cpu = optional(string)
memory = optional(string, "256Mi")
}), {})
}), {})
})
----

Expand Down
13 changes: 7 additions & 6 deletions eks/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,13 @@ module "iam_assumable_role_loki" {
module "loki-stack" {
source = "../"

argocd_project = var.argocd_project
argocd_labels = var.argocd_labels
destination_cluster = var.destination_cluster
target_revision = var.target_revision
app_autosync = var.app_autosync
dependency_ids = var.dependency_ids
argocd_project = var.argocd_project
argocd_labels = var.argocd_labels
destination_cluster = var.destination_cluster
target_revision = var.target_revision
enable_service_monitor = var.enable_service_monitor
app_autosync = var.app_autosync
dependency_ids = var.dependency_ids

resources = var.resources
retention = var.retention
Expand Down
Loading

0 comments on commit fb87844

Please sign in to comment.