add scrape config for tuya bridge and prohibit access to the metrics path via ingress [ci skip]

This commit is contained in:
Viktor Barzin 2025-10-28 21:38:40 +00:00
parent 562040bd45
commit 3161da29a4
2 changed files with 21 additions and 1 deletions

View file

@ -440,3 +440,14 @@ extraScrapeConfigs: |
action: replace
regex: '(.*)'
replacement: 'registry_$${1}'
- job_name: 'automatic-transfer-switch'
static_configs:
- targets:
- "tuya-bridge.tuya-bridge.svc.cluster.local:80" # devvm
metrics_path: '/metrics'
metric_relabel_configs:
- source_labels: [ __name__ ]
target_label: '__name__'
action: replace
regex: '(.*)'
replacement: 'automatic_transfer_switch_$${1}'

View file

@ -41,7 +41,7 @@ resource "kubernetes_deployment" "tuya-bridge" {
}
spec {
container {
image = "viktorbarzin/tuya_bridge"
image = "viktorbarzin/tuya_bridge:latest"
name = "tuya-bridge"
port {
container_port = 8080
@ -90,4 +90,13 @@ module "ingress" {
namespace = "tuya-bridge"
name = "tuya-bridge"
tls_secret_name = var.tls_secret_name
extra_annotations = {
"nginx.ingress.kubernetes.io/server-snippet" : <<-EOF
location /metrics {
deny all;
return 403;
}
EOF
}
}