Skip to content

Commit

Permalink
chore: adot first addon development (#239)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmetayd authored Jun 21, 2024
1 parent 24cde2d commit 00da287
Show file tree
Hide file tree
Showing 2 changed files with 120 additions and 1 deletion.
92 changes: 91 additions & 1 deletion modules/aws-eks-addons/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -912,7 +912,7 @@ resource "kubectl_manifest" "karpenter_stateless_windows2022_provisioner" {
key = "kubernetes.io/os"
operator = "In"
values = [
"windows",
"windows"
]
},
]
Expand Down Expand Up @@ -992,3 +992,93 @@ resource "kubectl_manifest" "karpenter_windows2022_node_template" {
helm_release.karpenter[0]
]
}


resource "kubectl_manifest" "deploy_adot_collector_service_account" {
count = var.deploy_adot_collector ? 1 : 0
yaml_body = <<-YAML
apiVersion: v1
kind: ServiceAccount
metadata:
annotations:
eks.amazonaws.com/role-arn: ${var.adot_collector_role}
name: ${var.adot_collector_service_account}
namespace: ${var.adot_collector_namespace}
YAML
}

resource "kubectl_manifest" "deploy_adot_collector" {
count = var.deploy_adot_collector ? 1 : 0
yaml_body = <<-YAML
apiVersion: opentelemetry.io/v1alpha1
kind: OpenTelemetryCollector
metadata:
name: adot
namespace: ${var.adot_collector_namespace}
spec:
mode: deployment
serviceAccount: ${var.adot_collector_service_account}
managementState: managed
podDisruptionBudget:
maxUnavailable: 1
replicas: 2
targetAllocator:
prometheusCR:
scrapeInterval: 30s
upgradeStrategy: automatic
config: |
receivers:
awsxray:
transport: udp
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
http:
endpoint: 0.0.0.0:4318
processors:
exporters:
awsxray:
region: ${var.cluster_region}
service:
pipelines:
traces:
receivers: [awsxray, otlp]
processors: []
exporters: [awsxray]
YAML
}

resource "kubectl_manifest" "deploy_adot_collector_ingress" {
count = var.deploy_adot_collector ? 1 : 0
yaml_body = <<-YAML
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
nginx.ingress.kubernetes.io/configuration-snippet: |
more_set_headers "Access-Control-Allow-Origin: $http_origin";
nginx.ingress.kubernetes.io/cors-allow-credentials: "true"
nginx.ingress.kubernetes.io/cors-allow-headers: Content-Type, authorization, x-ms-request-id,
x-ms-request-root-id, x-originating-page
nginx.ingress.kubernetes.io/cors-allow-methods: PUT, GET, POST, OPTIONS, DELETE
nginx.ingress.kubernetes.io/cors-allow-origin: "*"
nginx.ingress.kubernetes.io/enable-cors: "true"
name: adot-collector
namespace: ${var.adot_collector_namespace}
spec:
ingressClassName: nginx
rules:
- host: ${var.adot_collector_hostname}
http:
paths:
- backend:
service:
name: adot-collector
port:
number: 4318
path: /
pathType: Prefix
YAML
}
29 changes: 29 additions & 0 deletions modules/aws-eks-addons/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -435,3 +435,32 @@ variable "waf_acl_arn" {
default = ""
type = string
}

variable "deploy_adot_collector" {
default = false
description = "enable the ADOT collector"
}

variable "adot_collector_role" {
description = "ADOT collector IAM role ARN"
default = "arn:aws:iam::123456789012:role/adot-role"
type = string
}

variable "adot_collector_namespace" {
description = "ADOT collector namespace name"
default = "opentelemetry-operator-system"
type = string
}

variable "adot_collector_service_account" {
description = "ADOT collector service account name"
default = "opentelemetry-operator-system"
type = string
}

variable "adot_collector_hostname" {
description = "ADOT collector IAM role ARN"
default = "trace.example.com"
type = string
}

0 comments on commit 00da287

Please sign in to comment.