Skip to content

Commit

Permalink
feat: added jaeger and loki addons
Browse files Browse the repository at this point in the history
  • Loading branch information
rishitz committed Oct 17, 2024
1 parent 0b51b2e commit 8854581
Show file tree
Hide file tree
Showing 20 changed files with 1,547 additions and 0 deletions.
1,061 changes: 1,061 additions & 0 deletions addons/jaeger/config/jaeger.yaml

Large diffs are not rendered by default.

41 changes: 41 additions & 0 deletions addons/jaeger/locals.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
locals {
name = "jaeger"

default_helm_config = {
name = try(var.jaeger_extra_configs.name, local.name)
chart = try(var.jaeger_extra_configs.chart, local.name)
repository = try(var.jaeger_extra_configs.repository, "https://jaegertracing.github.io/helm-charts")
version = try(var.jaeger_extra_configs.version, "3.3.0")
namespace = try(var.jaeger_extra_configs.namespace, "monitoring")
create_namespace = try(var.jaeger_extra_configs.create_namespace, true)
description = "Jaeger helm Chart deployment configuration"
timeout = try(var.jaeger_extra_configs.timeout, "600")
lint = try(var.jaeger_extra_configs.lint, "false")
repository_key_file = try(var.jaeger_extra_configs.repository_key_file, "")
repository_cert_file = try(var.jaeger_extra_configs.repository_cert_file, "")
repository_username = try(var.jaeger_extra_configs.repository_username, "")
repository_password = try(var.jaeger_extra_configs.repository_password, "")
verify = try(var.jaeger_extra_configs.verify, "false")
keyring = try(var.jaeger_extra_configs.keyring, "")
disable_webhooks = try(var.jaeger_extra_configs.disable_webhooks, "false")
reuse_values = try(var.jaeger_extra_configs.reuse_values, "false")
reset_values = try(var.jaeger_extra_configs.reset_values, "false")
force_update = try(var.jaeger_extra_configs.force_update, "false")
recreate_pods = try(var.jaeger_extra_configs.recreate_pods, "false")
cleanup_on_fail = try(var.jaeger_extra_configs.cleanup_on_fail, "false")
max_history = try(var.jaeger_extra_configs.max_history, "0")
atomic = try(var.jaeger_extra_configs.atomic, "false")
skip_crds = try(var.jaeger_extra_configs.skip_crds, "false")
render_subchart_notes = try(var.jaeger_extra_configs.render_subchart_notes, "true")
disable_openapi_validation = try(var.jaeger_extra_configs.disable_openapi_validation, "false")
wait = try(var.jaeger_extra_configs.wait, "true")
wait_for_jobs = try(var.jaeger_extra_configs.wait_for_jobs, "false")
dependency_update = try(var.jaeger_extra_configs.dependency_update, "false")
replace = try(var.jaeger_extra_configs.replace, "false")
}

helm_config = merge(
local.default_helm_config,
var.helm_config
)
}
7 changes: 7 additions & 0 deletions addons/jaeger/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module "helm_addon" {
source = "../helm"

manage_via_gitops = var.manage_via_gitops
helm_config = local.helm_config
addon_context = var.addon_context
}
11 changes: 11 additions & 0 deletions addons/jaeger/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
output "namespace" {
value = local.default_helm_config.namespace
}

output "chart_version" {
value = local.default_helm_config.version
}

output "repository" {
value = local.default_helm_config.repository
}
32 changes: 32 additions & 0 deletions addons/jaeger/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
variable "helm_config" {
description = "Helm provider config for Loki"
type = any
default = {}
}

variable "manage_via_gitops" {
description = "Determines if the add-on should be managed via GitOps"
type = bool
default = false
}

variable "addon_context" {
description = "Input configuration for the addon"
type = object({
aws_caller_identity_account_id = string
aws_caller_identity_arn = string
aws_eks_cluster_endpoint = string
aws_partition_id = string
aws_region_name = string
eks_cluster_id = string
eks_oidc_issuer_url = string
eks_oidc_provider_arn = string
tags = map(string)
})
}

variable "jaeger_extra_configs" {
description = "Override attributes of helm_release terraform resource"
type = any
default = {}
}
10 changes: 10 additions & 0 deletions addons/jaeger/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
terraform {
required_version = ">= 1.0.0"

required_providers {
kubernetes = {
source = "hashicorp/kubernetes"
version = ">= 2.10"
}
}
}
111 changes: 111 additions & 0 deletions addons/loki/config/loki.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
test_pod:
enabled: true
image: bats/bats:1.8.2
pullPolicy: IfNotPresent

loki:
enabled: true
isDefault: true
url: http://{{(include "loki.serviceName" .)}}:{{ .Values.loki.service.port }}
readinessProbe:
httpGet:
path: /ready
port: http-metrics
initialDelaySeconds: 45
livenessProbe:
httpGet:
path: /ready
port: http-metrics
initialDelaySeconds: 45
datasource:
jsonData: "{}"
uid: ""


promtail:
enabled: true
config:
logLevel: info
serverPort: 3101
clients:
- url: http://{{ .Release.Name }}:3100/loki/api/v1/push

fluent-bit:
enabled: false

grafana:
enabled: false
sidecar:
datasources:
label: ""
labelValue: ""
enabled: true
maxLines: 1000
image:
tag: 10.3.3

prometheus:
enabled: false
isDefault: false
url: http://{{ include "prometheus.fullname" .}}:{{ .Values.prometheus.server.service.servicePort }}{{ .Values.prometheus.server.prefixURL }}
datasource:
jsonData: "{}"

filebeat:
enabled: false
filebeatConfig:
filebeat.yml: |
# logging.level: debug
filebeat.inputs:
- type: container
paths:
- /var/log/containers/*.log
processors:
- add_kubernetes_metadata:
host: ${NODE_NAME}
matchers:
- logs_path:
logs_path: "/var/log/containers/"
output.logstash:
hosts: ["logstash-loki:5044"]
logstash:
enabled: false
image: grafana/logstash-output-loki
imageTag: 1.0.1
filters:
main: |-
filter {
if [kubernetes] {
mutate {
add_field => {
"container_name" => "%{[kubernetes][container][name]}"
"namespace" => "%{[kubernetes][namespace]}"
"pod" => "%{[kubernetes][pod][name]}"
}
replace => { "host" => "%{[kubernetes][node][name]}"}
}
}
mutate {
remove_field => ["tags"]
}
}
outputs:
main: |-
output {
loki {
url => "http://loki:3100/loki/api/v1/push"
#username => "test"
#password => "test"
}
# stdout { codec => rubydebug }
}
# proxy is currently only used by loki test pod
# Note: If http_proxy/https_proxy are set, then no_proxy should include the
# loki service name, so that tests are able to communicate with the loki
# service.
proxy:
http_proxy: ""
https_proxy: ""
no_proxy: ""
41 changes: 41 additions & 0 deletions addons/loki/locals.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
locals {
name = "loki-stack"

default_helm_config = {
name = try(var.loki_extra_configs.name, local.name)
chart = try(var.loki_extra_configs.chart, local.name)
repository = try(var.loki_extra_configs.repository, "https://grafana.github.io/helm-charts")
version = try(var.loki_extra_configs.version, "2.10.2")
namespace = try(var.loki_extra_configs.namespace, "monitoring")
create_namespace = try(var.loki_extra_configs.create_namespace, true)
description = "Loki helm Chart deployment configuration"
timeout = try(var.loki_extra_configs.timeout, "600")
lint = try(var.loki_extra_configs.lint, "false")
repository_key_file = try(var.loki_extra_configs.repository_key_file, "")
repository_cert_file = try(var.loki_extra_configs.repository_cert_file, "")
repository_username = try(var.loki_extra_configs.repository_username, "")
repository_password = try(var.loki_extra_configs.repository_password, "")
verify = try(var.loki_extra_configs.verify, "false")
keyring = try(var.loki_extra_configs.keyring, "")
disable_webhooks = try(var.loki_extra_configs.disable_webhooks, "false")
reuse_values = try(var.loki_extra_configs.reuse_values, "false")
reset_values = try(var.loki_extra_configs.reset_values, "false")
force_update = try(var.loki_extra_configs.force_update, "false")
recreate_pods = try(var.loki_extra_configs.recreate_pods, "false")
cleanup_on_fail = try(var.loki_extra_configs.cleanup_on_fail, "false")
max_history = try(var.loki_extra_configs.max_history, "0")
atomic = try(var.loki_extra_configs.atomic, "false")
skip_crds = try(var.loki_extra_configs.skip_crds, "false")
render_subchart_notes = try(var.loki_extra_configs.render_subchart_notes, "true")
disable_openapi_validation = try(var.loki_extra_configs.disable_openapi_validation, "false")
wait = try(var.loki_extra_configs.wait, "true")
wait_for_jobs = try(var.loki_extra_configs.wait_for_jobs, "false")
dependency_update = try(var.loki_extra_configs.dependency_update, "false")
replace = try(var.loki_extra_configs.replace, "false")
}

helm_config = merge(
local.default_helm_config,
var.helm_config
)
}
7 changes: 7 additions & 0 deletions addons/loki/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module "helm_addon" {
source = "../helm"

manage_via_gitops = var.manage_via_gitops
helm_config = local.helm_config
addon_context = var.addon_context
}
11 changes: 11 additions & 0 deletions addons/loki/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
output "namespace" {
value = local.default_helm_config.namespace
}

output "chart_version" {
value = local.default_helm_config.version
}

output "repository" {
value = local.default_helm_config.repository
}
32 changes: 32 additions & 0 deletions addons/loki/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
variable "helm_config" {
description = "Helm provider config for Loki"
type = any
default = {}
}

variable "manage_via_gitops" {
description = "Determines if the add-on should be managed via GitOps"
type = bool
default = false
}

variable "addon_context" {
description = "Input configuration for the addon"
type = object({
aws_caller_identity_account_id = string
aws_caller_identity_arn = string
aws_eks_cluster_endpoint = string
aws_partition_id = string
aws_region_name = string
eks_cluster_id = string
eks_oidc_issuer_url = string
eks_oidc_provider_arn = string
tags = map(string)
})
}

variable "loki_extra_configs" {
description = "Override attributes of helm_release terraform resource"
type = any
default = {}
}
10 changes: 10 additions & 0 deletions addons/loki/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
terraform {
required_version = ">= 1.0.0"

required_providers {
kubernetes = {
source = "hashicorp/kubernetes"
version = ">= 2.10"
}
}
}
21 changes: 21 additions & 0 deletions examples/complete/config/override-jaeger.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
provisionDataStore:
cassandra: false
allInOne:
enabled: true
storage:
type: memory
agent:
enabled: true
collector:
enabled: true
query:
enabled: true
ingress:
certManager:
enabled: false


esIndexCleaner:
certManager:
enabled: false
5 changes: 5 additions & 0 deletions examples/complete/config/override-loki.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
loki:
enabled: true

promtail:
enabled: true
6 changes: 6 additions & 0 deletions examples/complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ module "addons" {
velero = true
keda = true
certification_manager = true
loki = true
jaeger = true
filebeat = true
reloader = true
external_dns = true
Expand Down Expand Up @@ -209,6 +211,8 @@ module "addons" {
kube_state_metrics_helm_config = { values = [file("./config/override-kube-state-matrics.yaml")] }
keda_helm_config = { values = [file("./config/keda/override-keda.yaml")] }
certification_manager_helm_config = { values = [file("./config/override-certification-manager.yaml")] }
loki_helm_config = { values = [file("./config/override-loki.yaml")] }
jaeger_helm_config = { values = [file("./config/override-jaeger.yaml")] }
filebeat_helm_config = { values = [file("./config/override-filebeat.yaml")] }
reloader_helm_config = { values = [file("./config/reloader/override-reloader.yaml")] }
external_dns_helm_config = { values = [file("./config/override-external-dns.yaml")] }
Expand Down Expand Up @@ -237,6 +241,8 @@ module "addons" {
kube_state_metrics_extra_configs = var.kube_state_metrics_extra_configs
keda_extra_configs = var.keda_extra_configs
certification_manager_extra_configs = var.certification_manager_extra_configs
loki_extra_configs = var.loki_extra_configs
jaeger_extra_configs = var.jaeger_extra_configs
external_secrets_extra_configs = var.external_secrets_extra_configs
filebeat_extra_configs = var.filebeat_extra_configs
reloader_extra_configs = var.reloader_extra_configs
Expand Down
Loading

0 comments on commit 8854581

Please sign in to comment.