Commit b03928d
weichao
fix(eks): forward stored AWS integration credentials to k8s client builder
Fixes Tracer-Cloud#969. Follow-up to Tracer-Cloud#724.
Problem
-------
PR Tracer-Cloud#724 let EKS be detected when the AWS integration is configured with
stored IAM user credentials (access_key_id + secret_access_key, no
role_arn), but build_k8s_clients still had no way to use those stored
credentials. After Tracer-Cloud#724 it supports:
1. role_arn -> STS AssumeRole
2. ambient botocore chain (env / shared config / instance profile / IRSA)
The stored integration credentials (persisted by resolve_integrations
and surfaced in _eks_int['credentials']) were silently dropped. On hosts
that happen to have ambient credentials pointing elsewhere, this picks
up the wrong principal; on hosts without ambient credentials the call
fails entirely, even though the integration has perfectly usable keys.
Fix (approach Tracer-Cloud#2, pre-approved by Greptile in PR Tracer-Cloud#724 review)
-------------------------------------------------------------
Forward the stored credentials through the existing eks_params pipeline:
* detect_sources.py: set eks_params['credentials'] = _eks_int.get(
'credentials') or None alongside the other EKS integration fields.
* eks_k8s_client.build_k8s_clients: accept an optional credentials
kwarg. Resolution priority:
1. explicit credentials kwarg (stored-integration, new)
2. role_arn AssumeRole (existing production path)
3. ambient botocore chain (Tracer-Cloud#724 fallback)
The two secondary fixes from Tracer-Cloud#724 are preserved (empty SessionToken
coerced to None, regional STS endpoint).
Test plan
---------
- py_compile passes on both files.
- ruff check + ruff format clean on both files.
- Regression safety: the role_arn (AssumeRole) and ambient-botocore
branches are unchanged; the new explicit branch only runs when the
credentials kwarg is truthy and has access_key_id + secret_access_key.
Related
-------
- Fixes Tracer-Cloud#969.
- Follow-up to Tracer-Cloud#724.
- Greptile pre-approved this approach in
Tracer-Cloud#724 (comment)1 parent 72dc93b commit b03928d
2 files changed
Lines changed: 50 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
714 | 714 | | |
715 | 715 | | |
716 | 716 | | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
717 | 723 | | |
718 | 724 | | |
719 | 725 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| 79 | + | |
79 | 80 | | |
80 | 81 | | |
81 | 82 | | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
82 | 88 | | |
83 | 89 | | |
84 | 90 | | |
85 | | - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
86 | 126 | | |
87 | 127 | | |
88 | 128 | | |
89 | 129 | | |
90 | 130 | | |
91 | 131 | | |
92 | 132 | | |
93 | | - | |
| 133 | + | |
94 | 134 | | |
95 | 135 | | |
96 | 136 | | |
| |||
0 commit comments