fix(eks): preserve worker webhook scope in the URL path (#3849)

* fix(eks): preserve worker webhook scope in the URL path

* docs(eks): clarify scoped and legacy webhook routes
This commit is contained in:
luiseterc authored and GitHub committed 2026-09-18 09:35:00 -04:00
1 parent bd9700db0d
commit fdec637c27
5 files changed
+44 -5

No files matched your search

@@ -700,8 +700,9 @@ public class EksClusterManager {
}
static String webhookPath(Cluster cluster) {
return webhookPath(cluster.getName()) + "?accountId=" + cluster.getAccountId()
+ "&region=" + cluster.getArn().split(":", 6)[3] + "&createdAt=" + cluster.getCreatedAt();
// client-go replaces a server URL query when constructing its TokenReview request.
return webhookPath(cluster.getName()) + "/scope/" + cluster.getAccountId()
+ "/" + cluster.getArn().split(":", 6)[3] + "/" + cluster.getCreatedAt();
}
static String webhookPath(String clusterName) {
@@ -24,6 +24,11 @@ import java.util.Optional;
* the request signature, expiration, and signed cluster ID before resolving worker access entries.
* Non-worker credentials retain the legacy cluster-admin compatibility behavior.
*
* <p>New clusters use {@code token-webhook/scope/{accountId}/{region}/{createdAt}}, keeping
* scope in the path because Kubernetes client-go replaces URL query parameters. The base
* {@code token-webhook} route retains query-parameter scope for legacy compatibility;
* unscoped requests cannot authenticate workers.
*
* <p>This is Floci plumbing under the {@code _floci/...} namespace, not an AWS API.
*/
@ApplicationScoped
@@ -42,6 +47,16 @@ public class EksTokenWebhookController {
this.authentication = authentication;
}
@POST
@Path("scope/{accountId}/{region}/{createdAt}")
public Response reviewScoped(@PathParam("clusterName") String clusterName,
@PathParam("accountId") String accountId,
@PathParam("region") String region,
@PathParam("createdAt") String createdAt,
Map<String, Object> tokenReview) {
return review(clusterName, accountId, region, createdAt, tokenReview);
}
@POST
public Response review(@PathParam("clusterName") String clusterName, @QueryParam("accountId") String accountId,
@QueryParam("region") String region, @QueryParam("createdAt") String createdAt,