From 0c1ee1ea324c06f2a4bcafc54a7e036952909428 Mon Sep 17 00:00:00 2001 From: Priamo Germosen <6233424+pgermosen@users.noreply.github.com> Date: Wed, 18 Nov 2026 11:00:31 -0400 Subject: [PATCH] test: run the kubelet registration class on IamEnforcedServiceSettingsProfile (#8869) EksKubeletRegistrationIntegrationTest's profile only named the kubelet image catalog. The catalog replaces EC2's built-in one, so it can only share an application with classes that launch no instance and look up no image, which holds for the four classes on IamEnforcedServiceSettingsProfile. The kubelet class's one request through the HTTP layer signs with a 12-digit account id as the access key, which IAM enforcement passes through, and it creates its cluster through the service directly. --- .../eks/EksKubeletRegistrationIntegrationTest.java | 12 ++---------- .../testing/IamEnforcedServiceSettingsProfile.java | 11 +++++++++-- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/test/java/io/floci/aws/services/eks/EksKubeletRegistrationIntegrationTest.java b/src/test/java/io/floci/aws/services/eks/EksKubeletRegistrationIntegrationTest.java index 31ca97cbd7..fa05ae68ad 100644 --- a/src/test/java/io/floci/aws/services/eks/EksKubeletRegistrationIntegrationTest.java +++ b/src/test/java/io/floci/aws/services/eks/EksKubeletRegistrationIntegrationTest.java @@ -6,8 +6,8 @@ import io.floci.aws.services.ec2.Ec2Service; import io.floci.aws.services.ec2.model.Instance; import io.floci.aws.services.eks.model.Cluster; import io.floci.aws.services.eks.model.CreateClusterRequest; +import io.floci.aws.testing.IamEnforcedServiceSettingsProfile; import io.quarkus.test.junit.QuarkusTest; -import io.quarkus.test.junit.QuarkusTestProfile; import io.quarkus.test.junit.TestProfile; import io.quarkus.test.junit.mockito.InjectSpy; import jakarta.inject.Inject; @@ -17,7 +17,6 @@ import java.nio.charset.StandardCharsets; import java.time.Duration; import java.util.Base64; import java.util.List; -import java.util.Map; import java.util.UUID; import static io.restassured.RestAssured.given; @@ -33,16 +32,9 @@ import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; @QuarkusTest -@TestProfile(EksKubeletRegistrationIntegrationTest.ImageCatalogProfile.class) +@TestProfile(IamEnforcedServiceSettingsProfile.class) class EksKubeletRegistrationIntegrationTest { - public static final class ImageCatalogProfile implements QuarkusTestProfile { - @Override - public Map getConfigOverrides() { - return Map.of("floci.services.ec2.image-catalog-path", "src/test/resources/ec2/kubelet-image-catalog.yaml"); - } - } - @Inject EksService eksService; diff --git a/src/test/java/io/floci/aws/testing/IamEnforcedServiceSettingsProfile.java b/src/test/java/io/floci/aws/testing/IamEnforcedServiceSettingsProfile.java index 7fe3091757..9ee04891e5 100644 --- a/src/test/java/io/floci/aws/testing/IamEnforcedServiceSettingsProfile.java +++ b/src/test/java/io/floci/aws/testing/IamEnforcedServiceSettingsProfile.java @@ -31,6 +31,12 @@ import java.util.Map; *
  • {@code floci.services.s3.global-bucket-namespace=true} resolves a bucket name across * accounts, so finding the bucket does not depend on the ambient account. * {@code S3PresignedPostBucketPolicyAccountContextIntegrationTest} relies on it.
  • + *
  • {@code floci.services.ec2.image-catalog-path} names + * {@code src/test/resources/ec2/kubelet-image-catalog.yaml}, a full EC2 image catalog in place of + * the built-in one, whose kubelet worker image registers its node itself. + * {@code EksKubeletRegistrationIntegrationTest} relies on it. Its one request through the HTTP + * layer signs with a 12-digit account id as the access key, which IAM enforcement passes through, + * and it creates its cluster through the service directly, so enforcement never reaches it.
  • *
  • The HTTP port, {@code floci.port} and {@code floci.base-url} name one free port, chosen once * when the class loads, so a Lambda container calls back to the port the application listens on. * {@code LambdaExecutionRoleDockerIntegrationTest} relies on it. The other classes send to the @@ -38,9 +44,9 @@ import java.util.Map; * * *

    Each service setting is inert for the other classes: none of them calls RDS, DocumentDB, DSQL - * or Lambda, and the only S3 call outside the S3 class is the function's ListBuckets in + * or Lambda, the only S3 call outside the S3 class is the function's ListBuckets in * {@code LambdaExecutionRoleDockerIntegrationTest}, which its execution role denies whichever way - * bucket names resolve. + * bucket names resolve, and only the kubelet class launches an instance or looks up an image. * *

    A class joins if every setting here is either one it relies on or one that never reaches its * requests, and if any setting it adds never reaches the requests of a class already here. @@ -57,6 +63,7 @@ public class IamEnforcedServiceSettingsProfile extends IamEnforcementProfile { overrides.put("floci.services.dsql.mock", "false"); overrides.put("floci.services.lambda.ephemeral", "true"); overrides.put("floci.services.s3.global-bucket-namespace", "true"); + overrides.put("floci.services.ec2.image-catalog-path", "src/test/resources/ec2/kubelet-image-catalog.yaml"); overrides.put("quarkus.http.test-port", String.valueOf(TEST_PORT)); overrides.put("floci.port", String.valueOf(TEST_PORT)); overrides.put("floci.base-url", "http://localhost:" + TEST_PORT);