Skip to content

Commit

Permalink
Revert "Nginx config options (#265)"
Browse files Browse the repository at this point in the history
This reverts commit 65c50e6.
  • Loading branch information
bonclay7 authored Feb 20, 2024
1 parent 99d6b6d commit d34a8b0
Show file tree
Hide file tree
Showing 7 changed files with 128 additions and 99 deletions.
19 changes: 9 additions & 10 deletions modules/eks-monitoring/README.md

Large diffs are not rendered by default.

7 changes: 1 addition & 6 deletions modules/eks-monitoring/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ locals {
grafana_dashboard_url = "https://raw.githubusercontent.com/aws-observability/aws-observability-accelerator/v0.2.0/artifacts/grafana-dashboards/eks/java/default.json"
}

nginx_pattern_config_defaults = {
nginx_pattern_config = {
# disabled if options from module are disabled, by default
# can be overriden by providing a config
enable_alerting_rules = var.enable_alerting_rules
Expand All @@ -78,11 +78,6 @@ locals {
grafana_dashboard_url = "https://raw.githubusercontent.com/aws-observability/aws-observability-accelerator/v0.2.0/artifacts/grafana-dashboards/eks/nginx/nginx.json"
}

nginx_pattern_config = {
# Merge input variable with defaults and rebuild with non-null values
for k, v in merge(local.nginx_pattern_config_defaults, var.nginx_config) : k => v != null ? v : local.nginx_pattern_config_defaults[k]
}

istio_pattern_config = {
# disabled if options from module are disabled, by default
# can be overriden by providing a config
Expand Down
10 changes: 3 additions & 7 deletions modules/eks-monitoring/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,6 @@ module "helm_addon" {
name = "adotLoglevel"
value = var.adot_loglevel
},
{
name = "adotServiceTelemetryLoglevel"
value = var.adot_service_telemetry_loglevel
},
{
name = "accountId"
value = local.context.aws_caller_identity_account_id
Expand Down Expand Up @@ -178,11 +174,11 @@ module "helm_addon" {
},
{
name = "nginxScrapeSampleLimit"
value = local.nginx_pattern_config.scrape_sample_limit
value = try(var.nginx_config.scrape_sample_limit, local.nginx_pattern_config.scrape_sample_limit)
},
{
name = "nginxPrometheusMetricsEndpoint"
value = local.nginx_pattern_config.prometheus_metrics_endpoint
value = try(var.nginx_config.prometheus_metrics_endpoint, local.nginx_pattern_config.prometheus_metrics_endpoint)
},
{
name = "enableIstio"
Expand Down Expand Up @@ -243,7 +239,7 @@ module "nginx_monitoring" {
source = "./patterns/nginx"
count = var.enable_nginx ? 1 : 0

pattern_config = local.nginx_pattern_config
pattern_config = coalesce(var.nginx_config, local.nginx_pattern_config)
}

module "istio_monitoring" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1536,9 +1536,9 @@ spec:
exporters: [logging, prometheusremotewrite]
{{ if .Values.enableAdotcollectorMetrics }}
metrics/1:
receivers: [prometheus/1]
processors: []
exporters: [prometheusremotewrite]
receivers: [prometheus/1]
processors: []
exporters: [prometheusremotewrite]
{{ end }}
{{ if .Values.enableTracing }}
traces:
Expand All @@ -1551,6 +1551,4 @@ spec:
metrics:
address: 0.0.0.0:8888
level: basic
logging:
level: {{ .Values.adotServiceTelemetryLoglevel }}
{{ end }}
1 change: 0 additions & 1 deletion modules/eks-monitoring/otel-config/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ istioScrapeSampleLimit: ${istio_scrape_sample_limit}
istioPrometheusMetricsEndpoint: ${istio_prometheus_metrics_endpoint}

adotLoglevel: ${adot_loglevel}
adotServiceTelemetryLoglevel: ${adot_service_telemetry_loglevel}

enableAdotcollectorMetrics: ${enable_adotcollector_metrics}

Expand Down
180 changes: 111 additions & 69 deletions modules/eks-monitoring/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,11 @@ variable "irsa_iam_additional_policies" {
}

variable "adot_loglevel" {
description = "Verbosity level for ADOT collector logs. This accepts (detailed|normal|basic), see https://aws-otel.github.io/docs/components/misc-exporters for more info."
description = "Verbosity level for ADOT collector logs. This accepts (detailed|normal|basic), see https://aws-otel.github.io/docs/components/misc-exporters for mor infos."
type = string
default = "normal"
}

variable "adot_service_telemetry_loglevel" {
description = "Verbosity level for ADOT service telemetry logs. See https://opentelemetry.io/docs/collector/configuration/#telemetry for more info."
type = string
default = "INFO"
}

variable "managed_prometheus_workspace_endpoint" {
description = "Amazon Managed Prometheus Workspace Endpoint"
type = string
Expand Down Expand Up @@ -150,20 +144,32 @@ variable "enable_kube_state_metrics" {
variable "ksm_config" {
description = "Kube State metrics configuration"
type = object({
create_namespace = optional(bool, true)
k8s_namespace = optional(string, "kube-system")
helm_chart_name = optional(string, "kube-state-metrics")
helm_chart_version = optional(string, "5.15.2")
helm_release_name = optional(string, "kube-state-metrics")
helm_repo_url = optional(string, "https://prometheus-community.github.io/helm-charts")
helm_settings = optional(map(string), {})
helm_values = optional(map(any), {})

scrape_interval = optional(string, "60s")
scrape_timeout = optional(string, "15s")
create_namespace = bool
k8s_namespace = string
helm_chart_name = string
helm_chart_version = string
helm_release_name = string
helm_repo_url = string
helm_settings = map(string)
helm_values = map(any)

scrape_interval = string
scrape_timeout = string
})

default = {}
default = {
create_namespace = true
helm_chart_name = "kube-state-metrics"
helm_chart_version = "5.15.2"
helm_release_name = "kube-state-metrics"
helm_repo_url = "https://prometheus-community.github.io/helm-charts"
helm_settings = {}
helm_values = {}
k8s_namespace = "kube-system"

scrape_interval = "60s"
scrape_timeout = "15s"
}
nullable = false
}

Expand All @@ -176,20 +182,32 @@ variable "enable_node_exporter" {
variable "ne_config" {
description = "Node exporter configuration"
type = object({
create_namespace = optional(bool, true)
k8s_namespace = optional(string, "prometheus-node-exporter")
helm_chart_name = optional(string, "prometheus-node-exporter")
helm_chart_version = optional(string, "4.24.0")
helm_release_name = optional(string, "prometheus-node-exporter")
helm_repo_url = optional(string, "https://prometheus-community.github.io/helm-charts")
helm_settings = optional(map(string), {})
helm_values = optional(map(any), {})

scrape_interval = optional(string, "60s")
scrape_timeout = optional(string, "60s")
create_namespace = bool
k8s_namespace = string
helm_chart_name = string
helm_chart_version = string
helm_release_name = string
helm_repo_url = string
helm_settings = map(string)
helm_values = map(any)

scrape_interval = string
scrape_timeout = string
})

default = {}
default = {
create_namespace = true
helm_chart_name = "prometheus-node-exporter"
helm_chart_version = "4.24.0"
helm_release_name = "prometheus-node-exporter"
helm_repo_url = "https://prometheus-community.github.io/helm-charts"
helm_settings = {}
helm_values = {}
k8s_namespace = "prometheus-node-exporter"

scrape_interval = "60s"
scrape_timeout = "60s"
}
nullable = false
}

Expand All @@ -202,11 +220,14 @@ variable "tags" {
variable "prometheus_config" {
description = "Controls default values such as scrape interval, timeouts and ports globally"
type = object({
global_scrape_interval = optional(string, "120s")
global_scrape_timeout = optional(string, "15s")
global_scrape_interval = string
global_scrape_timeout = string
})

default = {}
default = {
global_scrape_interval = "120s"
global_scrape_timeout = "15s"
}
nullable = false
}

Expand Down Expand Up @@ -245,14 +266,18 @@ variable "enable_tracing" {
variable "tracing_config" {
description = "Configuration object for traces collection to AWS X-Ray"
type = object({
otlp_grpc_endpoint = optional(string, "0.0.0.0:4317")
otlp_http_endpoint = optional(string, "0.0.0.0:4318")
send_batch_size = optional(number, 50)
timeout = optional(string, "30s")
otlp_grpc_endpoint = string
otlp_http_endpoint = string
send_batch_size = number
timeout = string
})

default = {}
nullable = false
default = {
otlp_grpc_endpoint = "0.0.0.0:4317"
otlp_http_endpoint = "0.0.0.0:4318"
send_batch_size = 50
timeout = "30s"
}
}

variable "enable_custom_metrics" {
Expand Down Expand Up @@ -311,27 +336,28 @@ variable "enable_nginx" {
default = false
}


variable "nginx_config" {
description = "Configuration object for NGINX monitoring"
type = object({
enable_alerting_rules = optional(bool)
enable_recording_rules = optional(bool)
enable_dashboards = optional(bool)
scrape_sample_limit = optional(number)
enable_alerting_rules = bool
enable_recording_rules = bool
enable_dashboards = bool
scrape_sample_limit = number

flux_gitrepository_name = optional(string)
flux_gitrepository_url = optional(string)
flux_gitrepository_branch = optional(string)
flux_kustomization_name = optional(string)
flux_kustomization_path = optional(string)
flux_gitrepository_name = string
flux_gitrepository_url = string
flux_gitrepository_branch = string
flux_kustomization_name = string
flux_kustomization_path = string

grafana_dashboard_url = optional(string)
grafana_dashboard_url = string

prometheus_metrics_endpoint = optional(string)
prometheus_metrics_endpoint = string
})

# defaults are pre-computed in locals.tf
default = {}
# defaults are pre-computed in locals.tf, provide a full definition to override
default = null
}

variable "enable_istio" {
Expand Down Expand Up @@ -397,17 +423,26 @@ variable "enable_fluxcd" {
variable "flux_config" {
description = "FluxCD configuration"
type = object({
create_namespace = optional(bool, true)
k8s_namespace = optional(string, "flux-system")
helm_chart_name = optional(string, "flux2")
helm_chart_version = optional(string, "2.12.2")
helm_release_name = optional(string, "observability-fluxcd-addon")
helm_repo_url = optional(string, "https://fluxcd-community.github.io/helm-charts")
helm_settings = optional(map(string), {})
helm_values = optional(map(any), {})
create_namespace = bool
k8s_namespace = string
helm_chart_name = string
helm_chart_version = string
helm_release_name = string
helm_repo_url = string
helm_settings = map(string)
helm_values = map(any)
})

default = {}
default = {
create_namespace = true
helm_chart_name = "flux2"
helm_chart_version = "2.12.2"
helm_release_name = "observability-fluxcd-addon"
helm_repo_url = "https://fluxcd-community.github.io/helm-charts"
helm_settings = {}
helm_values = {}
k8s_namespace = "flux-system"
}
nullable = false
}

Expand All @@ -420,15 +455,22 @@ variable "enable_grafana_operator" {
variable "go_config" {
description = "Grafana Operator configuration"
type = object({
create_namespace = optional(bool, true)
helm_chart = optional(string, "oci://ghcr.io/grafana-operator/helm-charts/grafana-operator")
helm_name = optional(string, "grafana-operator")
k8s_namespace = optional(string, "grafana-operator")
helm_release_name = optional(string, "grafana-operator")
helm_chart_version = optional(string, "v5.5.2")
create_namespace = bool
helm_chart = string
helm_name = string
k8s_namespace = string
helm_release_name = string
helm_chart_version = string
})

default = {}
default = {
create_namespace = true
helm_chart = "oci://ghcr.io/grafana-operator/helm-charts/grafana-operator"
helm_name = "grafana-operator"
k8s_namespace = "grafana-operator"
helm_release_name = "grafana-operator"
helm_chart_version = "v5.5.2"
}
nullable = false
}

Expand Down
2 changes: 1 addition & 1 deletion modules/eks-monitoring/versions.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
terraform {
required_version = ">= 1.3.0"
required_version = ">= 1.1.0"

required_providers {
aws = {
Expand Down

0 comments on commit d34a8b0

Please sign in to comment.