Skip to content

Commit

Permalink
Add ADOT component
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmorton committed Jun 21, 2023
1 parent fcdc46d commit 5c873af
Show file tree
Hide file tree
Showing 5 changed files with 192 additions and 1 deletion.
1 change: 1 addition & 0 deletions gitops/components/adot/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Amazon Distro for Open Telemetry (OTEL)
74 changes: 74 additions & 0 deletions gitops/components/adot/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
apiVersion: kustomize.config.k8s.io/v1alpha1
kind: Component

resources:
- ./resources.yaml

patches:
- target:
group: argoproj.io
version: v1alpha1
kind: AppProject
name: admins
patch: |-
- op: add
path: /spec/sourceRepos/-
value: https://aws-observability.github.io/aws-otel-helm-charts
- op: add
path: /spec/destinations/-
value:
namespace: adot
server: https://kubernetes.default.svc
replacements:
- source:
version: v1
kind: ConfigMap
name: kustomize-environment
fieldPath: data.ADOT_ROLE_ARN
targets:
- select:
version: v1
kind: ServiceAccount
name: adot-collector
fieldPaths:
- metadata.annotations.eks\.amazonaws\.com/role-arn
- source:
version: v1
kind: ConfigMap
name: kustomize-environment
fieldPath: data.CLUSTER_NAME
targets:
- select:
group: argoproj.io
version: v1alpha1
kind: Application
name: adot-collector
fieldPaths:
- spec.source.helm.parameters.[name=clusterName].value
- source:
version: v1
kind: ConfigMap
name: kustomize-environment
fieldPath: data.AWS_REGION
targets:
- select:
group: argoproj.io
version: v1alpha1
kind: Application
name: adot-collector
fieldPaths:
- spec.source.helm.parameters.[name=awsRegion].value
- source:
version: v1
kind: ConfigMap
name: kustomize-environment
fieldPath: data.AMP_RW_ENDPOINT
targets:
- select:
group: argoproj.io
version: v1alpha1
kind: Application
name: adot-collector
fieldPaths:
- spec.source.helm.parameters.[name=ampexporters.endpoint].value
116 changes: 116 additions & 0 deletions gitops/components/adot/resources.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: adot
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: adot-collector
namespace: adot
annotations:
eks.amazonaws.com/role-arn: ADOT_ROLE_ARN
eks.amazonaws.com/sts-regional-endpoints: "true"
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: adot-collector
namespace: argocd
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
project: admins
source:
chart: adot-exporter-for-eks-on-ec2
repoURL: https://aws-observability.github.io/aws-otel-helm-charts
targetRevision: 0.13.0
helm:
releaseName: adot-collector
parameters:
- name: clusterName
value: CLUSTER_NAME
- name: awsRegion
value: AWS_REGION
- name: ampexporters.endpoint
value: AMP_RW_ENDPOINT
# https://aps-workspaces.us-west-2.amazonaws.com/workspaces/ws-30b74c49-746c-4cc2-b93c-539f15d45259/api/v1/remote_write
values: |
serviceAccount:
create: false
name: "adot-collector"
adotCollector:
daemonSet:
createNamespace: false
namespace: adot
serviceAccount:
create: false
name: "adot-collector"
resources:
limits:
memory: 200Mi
requests:
cpu: 200m
memory: 200Mi
ampreceivers:
scrapeInterval: 15s
scrapeTimeout: 10s
scrapeConfigs: |
- job_name: 'pod_metrics_scrape'
sample_limit: 10000
metrics_path: /metrics
kubernetes_sd_configs:
- role: pod
relabel_configs:
- source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape]
action: keep
regex: true
- source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_path]
action: replace
regex: (.+)
target_label: __metrics_path__
- source_labels: [__address__, __meta_kubernetes_pod_annotation_prometheus_io_port]
action: replace
regex: ([^:]+)(?::\d+)?;(\d+)
replacement: $$1:$$2
target_label: __address__
- source_labels: [__meta_kubernetes_namespace]
action: replace
target_label: Namespace
- source_labels: [__meta_kubernetes_pod_name]
action: replace
target_label: PodName
- job_name: 'kubelets-cadvisor-metrics'
sample_limit: 10000
scheme: https
kubernetes_sd_configs:
- role: node
tls_config:
ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
relabel_configs:
- action: labelmap
regex: __meta_kubernetes_node_label_(.+)
# Only for Kubernetes ^1.7.3.
# See: https://github.com/prometheus/prometheus/issues/2916
- target_label: __address__
# Changes the address to Kube API server's default address and port
replacement: kubernetes.default.svc:443
- source_labels: [__meta_kubernetes_node_name]
regex: (.+)
target_label: __metrics_path__
# Changes the default metrics path to kubelet's proxy cadvdisor metrics endpoint
replacement: /api/v1/nodes/$${1}/proxy/metrics/cadvisor
metric_relabel_configs:
# extract readable container/pod name from id field
- action: replace
source_labels: [id]
regex: '^/machine\.slice/machine-rkt\\x2d([^\\]+)\\.+/([^/]+)\.service$'
target_label: rkt_container_name
replacement: '$${2}-$${1}'
- action: replace
source_labels: [id]
regex: '^/system\.slice/(.+)\.service$'
target_label: systemd_service_name
replacement: '$${1}'
1 change: 1 addition & 0 deletions gitops/components/fluent-bit/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ patches:
path: /spec/destinations/-
value:
namespace: fluent-bit
server: https://kubernetes.default.svc
replacements:
- source:
Expand Down
1 change: 0 additions & 1 deletion gitops/components/fluent-bit/resources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ spec:
[OUTPUT]
name loki
host loki.loki.svc.cluster.local
tenant_id b87173c0-e9fc-4209-8896-a93dfd073adb
match *
labels job=fluentbit
auto_kubernetes_labels on

0 comments on commit 5c873af

Please sign in to comment.