Skip to content

Commit

Permalink
[Kubernetes]: Update Alloy Integrations
Browse files Browse the repository at this point in the history
Signed-off-by: Weifeng Wang <[email protected]>

[Kubernetes]: Update Alloy Integrations

Signed-off-by: Weifeng Wang <[email protected]>
  • Loading branch information
qclaogui committed Apr 23, 2024
1 parent 3f95c34 commit a2d6f2d
Show file tree
Hide file tree
Showing 43 changed files with 1,008 additions and 1,681 deletions.
56 changes: 0 additions & 56 deletions alloy-modules/kubernetes/integrations/k8s-events.alloy

This file was deleted.

53 changes: 53 additions & 0 deletions alloy-modules/kubernetes/integrations/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# ============================================================================ #
# Alloy Integrations Components
# ============================================================================ #

# ----------------------------------------------------
# apiVersion and kind of Kustomization
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

# Alloy Integrations Configs
configMapGenerator:
- name: alloy-integrations
namespace: monitoring-system
options:
disableNameSuffixHash: true
literals:
- MEMCACHED_K8S_SECRET_NAME=alloy-integrations-memcached
- REDIS_K8S_SECRET_NAME=alloy-integrations-redis
- MYSQL_K8S_SECRET_NAME=alloy-integrations-mysql
files:
- memcached.alloy
- redis.alloy
- mysql.alloy

secretGenerator:
# integrations memcached credentials
- name: alloy-integrations-memcached
namespace: monitoring-system
options:
disableNameSuffixHash: true
literals:
- instance-name=primary
- instance-address=memcached.memcached-system.svc.cluster.local:11211
- instance-timeout=5s
# integrations redis credentials
- name: alloy-integrations-redis
namespace: monitoring-system
options:
disableNameSuffixHash: true
literals:
- instance-name=primary
- instance-address=redis-master.redis-system.svc.cluster.local:6379
- instance-password=VD538OYxSEiGD4I9mmFfqFMCGq1vIiGm
# integrations mysql credentials
- name: alloy-integrations-mysql
namespace: monitoring-system
options:
disableNameSuffixHash: true
literals:
- instance-name=primary
- mysql-host=mysql.mysql-system.svc.cluster.local
- mysql-username=lgtmp
- mysql-password=VD538OYxSEiGD4I9mmFfqFMCGq1vIiGm
2 changes: 1 addition & 1 deletion alloy-modules/kubernetes/integrations/memcached.alloy
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Module Components: component_memcached
*/

declare "component_memcached" {
declare "memcached_metrics_scrape" {

/*****************************************************************
* ARGUMENTS
Expand Down
2 changes: 1 addition & 1 deletion alloy-modules/kubernetes/integrations/mysql.alloy
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Module Components: component_mysql
*/

declare "component_mysql" {
declare "mysql_metrics_scrape" {

/*****************************************************************
* ARGUMENTS
Expand Down
2 changes: 1 addition & 1 deletion alloy-modules/kubernetes/integrations/redis.alloy
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Module Components: component_redis_exporter
*/

declare "component_redis_exporter" {
declare "redis_exporter_metrics_scrape" {

/*****************************************************************
* ARGUMENTS
Expand Down
36 changes: 36 additions & 0 deletions alloy-modules/kubernetes/logs/k8s-events.alloy
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
Module Components: component_cluster_events
*/

declare "kubernetes_cluster_events" {

/*****************************************************************
* ARGUMENTS
*****************************************************************/
argument "forward_to" {
comment = "Must be a list(LogsReceiver) where collected logs should be forwarded to"
}

argument "job_label" {
optional = true
}

argument "cluster" {
optional = true
}

loki.source.kubernetes_events "cluster_events" {
job_name = coalesce(argument.job_label.value, "integrations/kubernetes/eventhandler")
log_format = "logfmt"
forward_to = [loki.process.logs_service.receiver]
}

loki.process "logs_service" {
stage.static_labels {
values = {
cluster = coalesce(argument.cluster.value, "k3d"),
}
}
forward_to = argument.forward_to.value
}
}
79 changes: 0 additions & 79 deletions alloy-modules/kubernetes/metrics/integrations-scrape.alloy

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# ============================================================================ #
# Alloy Integrations Components
# ============================================================================ #

# ----------------------------------------------------
# apiVersion and kind of Kustomization
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

# Alloy Integrations Configs
configMapGenerator:
- name: alloy-integrations
namespace: monitoring-system
options:
disableNameSuffixHash: true
literals:
- MEMCACHED_K8S_SECRET_NAME=alloy-integrations-memcached
- REDIS_K8S_SECRET_NAME=alloy-integrations-redis
- MYSQL_K8S_SECRET_NAME=alloy-integrations-mysql
files:
- memcached.alloy
- redis.alloy
- mysql.alloy

secretGenerator:
# integrations memcached credentials
- name: alloy-integrations-memcached
namespace: monitoring-system
options:
disableNameSuffixHash: true
literals:
- instance-name=primary
- instance-address=memcached.memcached-system.svc.cluster.local:11211
- instance-timeout=5s
# integrations redis credentials
- name: alloy-integrations-redis
namespace: monitoring-system
options:
disableNameSuffixHash: true
literals:
- instance-name=primary
- instance-address=redis-master.redis-system.svc.cluster.local:6379
- instance-password=VD538OYxSEiGD4I9mmFfqFMCGq1vIiGm
# integrations mysql credentials
- name: alloy-integrations-mysql
namespace: monitoring-system
options:
disableNameSuffixHash: true
literals:
- instance-name=primary
- mysql-host=mysql.mysql-system.svc.cluster.local
- mysql-username=lgtmp
- mysql-password=VD538OYxSEiGD4I9mmFfqFMCGq1vIiGm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Module Components: component_memcached
*/

declare "component_memcached" {
declare "memcached_metrics_scrape" {

/*****************************************************************
* ARGUMENTS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Module Components: component_mysql
*/

declare "component_mysql" {
declare "mysql_metrics_scrape" {

/*****************************************************************
* ARGUMENTS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Module Components: component_redis_exporter
*/

declare "component_redis_exporter" {
declare "redis_exporter_metrics_scrape" {

/*****************************************************************
* ARGUMENTS
Expand Down
Loading

0 comments on commit a2d6f2d

Please sign in to comment.