Commit a907cec
weichao
fix(eks): detect EKS source when AWS integration uses IAM user credentials
Problem
-------
When the AWS integration is configured with IAM user credentials
(env AK/SK or stored access_key_id/secret_access_key), opensre does
not register EKS as an investigable source. The investigation plan
produces zero EKS tool calls even though a cluster_name is present
in the alert annotations and the credentials would otherwise work.
Reproduction
------------
1. Configure AWS integration with access_key_id/secret_access_key
(no role_arn, no injected _backend):
opensre onboarding aws
# enter access key / secret / region, skip role ARN
2. Run investigate on a kubernetes alert with cluster_name set:
opensre investigate -i tests/e2e/kubernetes/fixtures/datadog_k8s_alert.json
3. Expected: EKS appears in detected sources and pods/events tools
are planned.
Actual: EKS is silently skipped; plan has no EKS tools.
Root Cause
----------
app/integrations/catalog.py (resolve_integrations) already lifts IAM
user credentials into _eks_int["credentials"] (see L229-235), but
detect_sources only checks _eks_int.get("role_arn") or an injected
_backend before entering the EKS branch. IAM-user integrations have
neither, so the branch is skipped entirely.
Fix
---
Accept _eks_int.get("credentials") as a third way to gate the EKS
branch. The downstream code already tolerates an empty role_arn
(L693 uses _eks_int.get("role_arn", "")), so no other change is
required at the planning layer.
The k8s client that actually consumes these credentials still needs
to learn to honour them — that is a separate bug tracked in the
follow-up PR on app/services/eks/eks_k8s_client.py.
Risk / Backward Compatibility
-----------------------------
Strict superset of current behaviour: any integration previously
accepted (role_arn or injected backend) is still accepted. The new
branch only activates for integrations that already carry a
credentials dict produced by catalog.resolve_integrations.1 parent 14d0b2d commit a907cec
1 file changed
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
657 | 657 | | |
658 | 658 | | |
659 | 659 | | |
660 | | - | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
661 | 663 | | |
662 | 664 | | |
663 | 665 | | |
| |||
0 commit comments