From 57242fee6808e47718605ae81e69bd244942d992 Mon Sep 17 00:00:00 2001 From: mulmuri Date: Wed, 19 Feb 2025 03:48:40 +0900 Subject: [PATCH] feat: manage telegraf on manifests --- modules/infra/fetch-system/telegraf/main.tf | 15 -- .../infra/fetch-system/telegraf/values.yaml | 189 ------------------ .../infra/fetch-system/telegraf/variables.tf | 3 - 3 files changed, 207 deletions(-) delete mode 100644 modules/infra/fetch-system/telegraf/main.tf delete mode 100644 modules/infra/fetch-system/telegraf/values.yaml delete mode 100644 modules/infra/fetch-system/telegraf/variables.tf diff --git a/modules/infra/fetch-system/telegraf/main.tf b/modules/infra/fetch-system/telegraf/main.tf deleted file mode 100644 index f14b680..0000000 --- a/modules/infra/fetch-system/telegraf/main.tf +++ /dev/null @@ -1,15 +0,0 @@ -locals { - values_yaml = templatefile("${path.module}/values.yaml", { - influxdb_token = var.influxdb_token - }) -} - -resource "helm_release" "telegraf" { - name = "telegraf" - repository = "https://helm.influxdata.com/" - chart = "telegraf" - namespace = "fetch-system" - version = "1.8.55" - - values = [local.values_yaml] -} diff --git a/modules/infra/fetch-system/telegraf/values.yaml b/modules/infra/fetch-system/telegraf/values.yaml deleted file mode 100644 index 68fd12c..0000000 --- a/modules/infra/fetch-system/telegraf/values.yaml +++ /dev/null @@ -1,189 +0,0 @@ -## Default values.yaml for Telegraf -## This is a YAML-formatted file. -## ref: https://hub.docker.com/r/library/telegraf/tags/ - -replicaCount: 1 -image: - repo: "docker.io/library/telegraf" - tag: "1.32-alpine" - pullPolicy: IfNotPresent -podAnnotations: {} -podLabels: {} -imagePullSecrets: [] -## Configure args passed to Telegraf containers -args: [] -# The name of a secret in the same kubernetes namespace which contains values to -# be added to the environment (must be manually created) -# This can be useful for auth tokens, etc. - -# envFromSecret: "telegraf-tokens" -env: - - name: HOSTNAME - value: "telegraf-polling-service" -# An older "volumeMounts" key was previously added which will likely -# NOT WORK as you expect. Please use this newer configuration. - -# volumes: -# - name: telegraf-output-influxdb2 -# configMap: -# name: "telegraf-output-influxdb2" -# mountPoints: -# - name: telegraf-output-influxdb2 -# mountPath: /etc/telegraf/conf.d -# subPath: influxdb2.conf - -## Configure resource requests and limits -## ref: http://kubernetes.io/docs/user-guide/compute-resources/ -resources: {} -# requests: -# memory: 128Mi -# cpu: 100m -# limits: -# memory: 128Mi -# cpu: 100m - -## Node labels for pod assignment -## ref: https://kubernetes.io/docs/user-guide/node-selection/ -nodeSelector: {} -## Affinity for pod assignment -## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity -## -affinity: {} -## Tolerations for pod assignment -## Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ -## -tolerations: [] -# - key: "key" -# operator: "Equal|Exists" -# value: "value" -# effect: "NoSchedule|PreferNoSchedule|NoExecute(1.6 only)" - -## Configure the updateStrategy used to replace Telegraf Pods -## See https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/deployment-v1/ -updateStrategy: {} -# type: RollingUpdate|Recreate -# rollingUpdate: -# maxUnavailable: 1 -# maxSurge: 1 - -service: - enabled: true - type: ClusterIP - annotations: {} -rbac: - # Specifies whether RBAC resources should be created - create: true - # Create only for the release namespace or cluster wide (Role vs ClusterRole) - clusterWide: false - # Rules for the created rule - rules: [] -# When using the prometheus input to scrape all pods you need extra rules set to the ClusterRole to be -# able to scan the pods for scraping labels. The following rules have been taken from: -# https://github.com/helm/charts/blob/master/stable/prometheus/templates/server-clusterrole.yaml#L8-L46 -# - apiGroups: -# - "" -# resources: -# - nodes -# - nodes/proxy -# - nodes/metrics -# - services -# - endpoints -# - pods -# - ingresses -# - configmaps -# verbs: -# - get -# - list -# - watch -# - apiGroups: -# - "extensions" -# resources: -# - ingresses/status -# - ingresses -# verbs: -# - get -# - list -# - watch -# - nonResourceURLs: -# - "/metrics" -# verbs: -# - get - -serviceAccount: - # Specifies whether a ServiceAccount should be created - create: true - # The name of the ServiceAccount to use. - # If not set and create is true, a name is generated using the fullname template - name: - # Annotations for the ServiceAccount - annotations: {} -## Exposed telegraf configuration -## For full list of possible values see `/docs/all-config-values.yaml` and `/docs/all-config-values.toml` -## ref: https://docs.influxdata.com/telegraf/v1.1/administration/configuration/ -config: - agent: - interval: "10s" - round_interval: true - metric_batch_size: 1000 - metric_buffer_limit: 10000 - collection_jitter: "0s" - flush_interval: "10s" - flush_jitter: "0s" - precision: "" - debug: false - quiet: false - logfile: "" - hostname: "$HOSTNAME" - omit_hostname: false - processors: - - enum: - mapping: - field: "status" - dest: "status_code" - value_mappings: - healthy: 1 - problem: 2 - critical: 3 - outputs: - - influxdb_v2: - urls: ["http://influxdb2.influxdata.svc.cluster.local:80"] - token: ${influxdb_token} - organization: "goboolean" - bucket: "default" - bucket_tag: "topic" - exclude_bucket_tag: true - - inputs: - - kafka_consumer: - brokers: ["kafka.kafka.svc.cluster.local:9092"] - topic_regexps: [ ".*\\.(1s|5s|1m|5m)$" ] - topic_tag: "topic" - consumer_group: "fetch-system-telegraf" - data_format: "json" - -metrics: - health: - enabled: true - service_address: "http://:8888" - threshold: 5000.0 - internal: - enabled: true - collect_memstats: false -# Lifecycle hooks -# hooks: -# postStart: ["/bin/sh", "-c", "echo Telegraf started"] -# preStop: ["/bin/sh", "-c", "sleep 60"] - -## Pod disruption budget configuration -## -pdb: - ## Specifies whether a Pod disruption budget should be created - ## - create: true - minAvailable: 1 - # maxUnavailable: 1 - -# containerPorts: -# - name: http -# containerPort: 9273 -# protocol: TCP diff --git a/modules/infra/fetch-system/telegraf/variables.tf b/modules/infra/fetch-system/telegraf/variables.tf deleted file mode 100644 index bd0c2c5..0000000 --- a/modules/infra/fetch-system/telegraf/variables.tf +++ /dev/null @@ -1,3 +0,0 @@ -variable "influxdb_token" { - description = "influxdb token" -}