Skip to content
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

Add environmental variable to determine the agent's cluster name #167

Merged
merged 3 commits into from
Feb 4, 2025

Conversation

musa-asad
Copy link
Collaborator

@musa-asad musa-asad commented Feb 2, 2025

Description of the issue

When running on a Kubernetes cluster, the only way the CloudWatch Agent can detect the cluster name is:

  1. If it's provided in the configuration:
"kubernetes": {
  "cluster_name": "<cluster-name>",
  "enhanced_container_insights": true
},
"application_signals": {
  "hosted_in": "<cluster-name>"
}
  1. By making a ec2:DescribeTags call.

Ideally, the agent should minimize external API calls, so we should implement a global way to retrieve the cluster name in case it isn't provided in the configuration. The Amazon CloudWatch Observability EKS add-on / Helm chart includes a .Values.clusterName, which can be passed in as an environmental variable for the agent's pod.

Description of changes

  • Add K8S_CLUSTER_NAME with cluster name from received from .Values.clusterName.

License

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

Tests

Screenshot 2025-02-02 at 11 32 40 PM

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

@musa-asad musa-asad self-assigned this Feb 2, 2025
@musa-asad musa-asad changed the title Add environmental variables to determine the agent's workload type Add environmental variables to determine the agent's workload type / sidecar status Feb 2, 2025
@musa-asad musa-asad requested review from zhihonl, duhminick and lisguo and removed request for agarakan, mitali-salvi and zhihonl February 3, 2025 02:29
@musa-asad musa-asad changed the title Add environmental variables to determine the agent's workload type / sidecar status Add environmental variables to determine the agent's cluster name and workload type / sidecar status Feb 3, 2025
@musa-asad musa-asad changed the title Add environmental variables to determine the agent's cluster name and workload type / sidecar status Add environmental variables to determine the agent's cluster name, workload type, and sidecar status Feb 3, 2025
@musa-asad musa-asad changed the title Add environmental variables to determine the agent's cluster name, workload type, and sidecar status Add environmental variable to determine the agent's cluster name Feb 3, 2025
@musa-asad musa-asad requested review from mitali-salvi and agarakan and removed request for duhminick and lisguo February 3, 2025 04:33
@musa-asad musa-asad changed the base branch from main to custom-metrics-entity February 3, 2025 05:19
@musa-asad musa-asad marked this pull request as ready for review February 3, 2025 06:49
@musa-asad musa-asad requested review from varunch77 and removed request for agarakan February 3, 2025 06:51
@musa-asad musa-asad merged commit 6cc4c25 into feature-custom-metrics-entity Feb 4, 2025
3 checks passed
@musa-asad musa-asad deleted the k8s-attr branch February 4, 2025 01:21
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.

3 participants