Skip to content

Support opening up container and service ports based on agent config YAML #238

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Oct 1, 2024

Conversation

mitali-salvi
Copy link
Contributor

@mitali-salvi mitali-salvi commented Sep 26, 2024

Issue #, if available:

Description of changes:

  1. Add support for opening up service and container ports for CloudWatch Agent based on the otelConfig provided
  2. Add support for live-ness probe if health_check extension is configured

Testing

  1. Unit tests
  2. Tested manually
    a. Default ports for receivers --
    receivers:
      statsd:
    processors:
    exporters:
      debug:
    service:
      pipelines:
        metrics:
          receivers: [ statsd ]
          exporters: [ debug ]

Checking agent container ports

Containers:
  otc-container:
    Container ID:   containerd://48e9dcff6b061490a7a3b7b8726eaad0ae31eda0d17a261829c7c83056517e83
    Ports:          4315/TCP, 4316/TCP, 2000/TCP, 4322/TCP
    Host Ports:     4315/TCP, 4316/TCP, 2000/TCP, 4322/TCP

Checking agent service ports

cloudwatch-agent                                         ClusterIP   10.100.15.241    <none>        4315/TCP,4316/TCP,2000/TCP,4322/TCP   110s
cloudwatch-agent-headless                                ClusterIP   None             <none>        4315/TCP,4316/TCP,2000/TCP,4322/TCP   110s
cloudwatch-agent-monitoring                              ClusterIP   10.100.224.40    <none>        8888/TCP                              110s

b. Override ports for receivers --

    receivers:
      otlp:
        protocols:
          grpc:
            endpoint: "localhost:4322"
    processors:
    exporters:
      debug:
    service:
      pipelines:
        metrics:
          receivers: [ otlp ]
          exporters: [ debug ]

Verified container ports and service ports are updated

c. Conflicting ports for receivers --

    receivers:
      otlp:
        protocols:
          grpc:
            endpoint: "localhost:4315" //conflicts with AppSignals
    processors:
    exporters:
      debug:
    service:
      pipelines:
        metrics:
          receivers: [ otlp ]
          exporters: [ debug ]

In this case, the JSON config ports are prioritized and duplicate ports from the YAML config are dropped.
Agent will also fail in this case with

2024-09-27T18:54:59Z E! Error running agent: cannot start pipelines: listen tcp 127.0.0.1:4315: bind: address already in use 

d. Enabling health_check extension should create a liveness probe

receivers:
  statsd:
processors:
exporters:
  debug:
extensions:
  zpages:
  health_check:
  pprof:
service:
  extensions: [health_check, pprof, zpages]
  pipelines:
    metrics:
      receivers: [ statsd ]
      exporters: [ debug ]

Will create a liveness probe on the agent container

Liveness:  http-get http://:13133/ delay=0s timeout=1s period=10s #success=1 #failure=3

Although this scenario only works when the agent runs on a non sidecar mode - open-telemetry/opentelemetry-operator#571 and mounted on the application pod.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@mitali-salvi mitali-salvi merged commit 261f946 into yaml-support Oct 1, 2024
@mitali-salvi mitali-salvi deleted the support-yaml-port branch October 1, 2024 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants