aws-samples / aws-samples/sample-strands-chaos-engineering-agents
## Bug Report: EKS Resource Discovery Tool
- Dominant language
- Python
- Stars
- 13
- Forks
- 2
- Avg merge
- 43m
- Merged PRs (30d)
- 1
Description
Issue: ExperimentsAgent fails to discover actual EKS cluster state, causing FIS experiments to target non-existent namespaces and service accounts.
Current Problem:
• Agent tries to use non-existent AWS API eks list_pods
• Hardcoded namespace assumptions in system prompt
• No dynamic discovery of actual cluster resources
Suggested Fix: Add this tool to /assets/src/ExperimentsAgent/agent.py:
python
@tool
def discover_eks_cluster_state(cluster_name: str) -> dict:
"""
Discover actual EKS cluster namespaces, pods, and service accounts.
Args:
cluster_name: Name of the EKS cluster to discover
Returns:
dict: Cluster state with namespaces, pods, and service accounts
"""
try:
import subprocess
# Get actual namespaces
ns_result = subprocess.run(['kubectl', 'get', 'namespaces', '-o', 'jsonpath={.items[*].metadata.name}'],
capture_output=True, text=True, check=True)
namespaces = ns_result.stdout.strip().split()
# Get all pods with labels and namespaces
pods_result = subprocess.run(['kubectl', 'get', 'pods', '--all-namespaces',
'-o', 'jsonpath={range .items[*]}{.metadata.namespace}{" "}{.metadata.name}{" "}{.metadata.labels}{"\n"}{end}'],
capture_output=True, text=True, check=True)
# Get service accounts in each namespace
sa_result = subprocess.run(['kubectl', 'get', 'serviceaccounts', '--all-namespaces',
'-o', 'jsonpath={range .items[*]}{.metadata.namespace}{" "}{.metadata.name}{"\n"}{end}'],
capture_output=True, text=True, check=True)
return {
"success": True,
"cluster_name": cluster_name,
"namespaces": namespaces,
"pods_output": pods_result.stdout,
"service_accounts_output": sa_result.stdout,
"message": f"Discovered {len(namespaces)} namespaces in cluster {cluster_name}"
}
except subprocess.CalledProcessError as e:
return {
"success": False,
"error": f"kubectl command failed: {e.stderr}",
"message": "Failed to discover cluster state - ensure kubectl is configured"
}
except Exception as e:
return {
"success": False,
"error": str(e),
"message": "Unexpected error during cluster discovery"
}
Usage: Agent should call discover_eks_cluster_state("retail-store") before creating any FIS experiments to get actual cluster state instead of using hardcoded assumptions.
Contributor guide
Research direction
Start with /assets/src/ExperimentsAgent/agent.py and inspect the existing tool definitions and the path that creates FIS experiments. No test file is named in the issue. Done means discovery runs before experiment creation and uses actual namespaces, pods, and service accounts instead of hardcoded assumptions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, kubernetes, python
- Domain
- cloud, devops, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100