feat(cloudformation): create and update AWS::EKS::Cluster with EKS Auto Mode (#9284)

This commit is contained in:
mrfelek authored and GitHub committed 2026-11-23 20:04:50 -04:00
1 parent 077fd41bdf
commit ad651873d6
8 files changed
+329 -56

No files matched your search

+1 -1
View File
@@ -219,7 +219,7 @@ cross-resource references.
| ECR | `Repository` |
| ECS | `Cluster`, `TaskDefinition`, `Service`, `CapacityProvider`, `ClusterCapacityProviderAssociations` |
| EFS | `FileSystem` (metadata only, there is no NFS data plane), `MountTarget` (`SecurityGroups` update in place, every other property replaces), `AccessPoint` (`AccessPointTags` update in place, every other property replaces) |
| EKS | `Cluster` (created with `Name`, `Version`, `RoleArn`, `Tags`, `EncryptionConfig`, `ResourcesVpcConfig`, `Logging`, `AccessConfig`, `UpgradePolicy` and `KubernetesNetworkConfig.IpFamily` and `ServiceIpv4Cidr`, a replacement included; a change to `EncryptionConfig`, `IpFamily` or `ServiceIpv4Cidr` replaces the cluster with the new value applied; `ElasticLoadBalancing`, `ServiceIpv6Cidr` and `ResourcesVpcConfig.ControlPlaneEgressMode` are accepted and ignored; updated in place for `Tags`, keeping tags added outside the stack, for `Logging`, for `AccessConfig.AuthenticationMode` (a mode cannot be moved back, so a stack update that does so fails, and a stack rollback restores it), for `UpgradePolicy` (a dropped one returns the cluster to `EXTENDED`) and for `ResourcesVpcConfig` endpoint access and `PublicAccessCidrs`; a change to `Name`, `RoleArn`, `EncryptionConfig`, `BootstrapSelfManagedAddons`, `OutpostConfig`, `AccessConfig.BootstrapClusterCreatorAdminPermissions`, `KubernetesNetworkConfig.IpFamily` or `KubernetesNetworkConfig.ServiceIpv4Cidr` replaces the cluster, as the registry marks them create-only, and deletes the old one once the update commits; a change to `Version` is accepted with a warning and not applied, as the emulator has no `UpdateClusterVersion`; a change to the subnets or security groups of `ResourcesVpcConfig` fails the resource, as the emulator's `UpdateClusterConfig` does not change them), `Nodegroup` (created with `ClusterName`, `NodegroupName`, `NodeRole`, `Subnets` and `Tags`; updated in place for `Tags`, keeping tags added outside the stack; a change to `ClusterName`, `NodegroupName`, `NodeRole`, `Subnets`, `AmiType`, `CapacityType`, `DiskSize`, `InstanceTypes` or `RemoteAccess` replaces the nodegroup, as the registry marks them create-only, and deletes the old one once the update commits; `ScalingConfig`, `Labels`, `Taints`, `UpdateConfig`, `Version`, `ReleaseVersion`, `ForceUpdateEnabled`, `LaunchTemplate`, `NodeRepairConfig` and `WarmPoolConfig` are accepted and not applied, whether changed or dropped, with a warning, as the emulator cannot update a nodegroup in place) |
| EKS | `Cluster` (created with `Name`, `Version`, `RoleArn`, `Tags`, `EncryptionConfig`, `ResourcesVpcConfig`, `Logging`, `AccessConfig`, `UpgradePolicy`, `ComputeConfig`, `StorageConfig` and `KubernetesNetworkConfig.IpFamily`, `ServiceIpv4Cidr` and `ElasticLoadBalancing`, a replacement included; a change to `EncryptionConfig`, `IpFamily` or `ServiceIpv4Cidr` replaces the cluster with the new value applied; `ServiceIpv6Cidr` and `ResourcesVpcConfig.ControlPlaneEgressMode` are accepted and ignored; updated in place for `Tags`, keeping tags added outside the stack, for `Logging`, for `AccessConfig.AuthenticationMode` (a mode cannot be moved back, so a stack update that does so fails, and a stack rollback restores it), for `UpgradePolicy` (a dropped one returns the cluster to `EXTENDED`), for the EKS Auto Mode properties `ComputeConfig`, `StorageConfig` and `KubernetesNetworkConfig.ElasticLoadBalancing` through `UpdateClusterConfig` (a dropped one is read as disabled, a stack update that leaves the three neither all enabled nor all disabled fails as `UpdateClusterConfig` refuses it, and a stack rollback restores the configuration before) and for `ResourcesVpcConfig` endpoint access and `PublicAccessCidrs`; a change to `Name`, `RoleArn`, `EncryptionConfig`, `BootstrapSelfManagedAddons`, `OutpostConfig`, `AccessConfig.BootstrapClusterCreatorAdminPermissions`, `KubernetesNetworkConfig.IpFamily` or `KubernetesNetworkConfig.ServiceIpv4Cidr` replaces the cluster, as the registry marks them create-only, and deletes the old one once the update commits; a change to `Version` is accepted with a warning and not applied, as the emulator has no `UpdateClusterVersion`; a change to the subnets or security groups of `ResourcesVpcConfig` fails the resource, as the emulator's `UpdateClusterConfig` does not change them), `Nodegroup` (created with `ClusterName`, `NodegroupName`, `NodeRole`, `Subnets` and `Tags`; updated in place for `Tags`, keeping tags added outside the stack; a change to `ClusterName`, `NodegroupName`, `NodeRole`, `Subnets`, `AmiType`, `CapacityType`, `DiskSize`, `InstanceTypes` or `RemoteAccess` replaces the nodegroup, as the registry marks them create-only, and deletes the old one once the update commits; `ScalingConfig`, `Labels`, `Taints`, `UpdateConfig`, `Version`, `ReleaseVersion`, `ForceUpdateEnabled`, `LaunchTemplate`, `NodeRepairConfig` and `WarmPoolConfig` are accepted and not applied, whether changed or dropped, with a warning, as the emulator cannot update a nodegroup in place) |
| EMR | `Cluster` (created through `RunJobFlow`, once it is waiting or running, its master, core and task groups or fleets as `RunJobFlow`'s `InstanceGroups` or `InstanceFleets`; `AdditionalInfo` and `Instances`' `HadoopVersion` are accepted with a warning and not stored; task groups and fleets need unique names; a template that sets the read-only `Id` or `MasterPublicDNS` is refused; updated in place for `AutoTerminationPolicy`, `ManagedScalingPolicy`, `StepConcurrencyLevel`, `VisibleToAllUsers`, `Tags` (keeping tags added outside the stack), `TerminationProtected`, `UnhealthyNodeReplacement`, a core or task group's `InstanceCount` and `AutoScalingPolicy` and a core or task fleet's target capacities, a dropped one taking its default; any other change, within `Instances` included, replaces the cluster and terminates the old one once the update commits; a termination-protected cluster refuses the delete), `InstanceGroupConfig` (a `TASK` group, the one role the reference allows, added through `AddInstanceGroups`; `InstanceCount` and `AutoScalingPolicy` update in place, and a create-only change adds a new group; the delete removes its policy and shrinks it to nothing, as a group cannot be removed from its cluster), `InstanceFleetConfig` (a `TASK` fleet, the one type the reference allows, added through `AddInstanceFleet`; `TargetOnDemandCapacity`, `TargetSpotCapacity`, `InstanceTypeConfigs` and `ResizeSpecifications` update in place through `ModifyInstanceFleet`, and a create-only change adds a new fleet; a rollback puts them back, but not an instance type the update added, which every later `ModifyInstanceFleet` must include, nor resize specifications where the fleet had none, which no request can clear, and dropped configs or resize specifications are kept for the same reason; the delete shrinks the fleet to nothing, as a fleet cannot be removed from its cluster), `Step` (added through `AddJobFlowSteps`, `LogUri` and `EncryptionKeyArn` as its `StepMonitoringConfiguration`; every property is create-only, so a change adds a new step, and a step stays in its cluster's history when deleted, as the schema's delete handler calls nothing), `SecurityConfiguration` (created with `Name`, generated when the template gives none, and the `SecurityConfiguration` JSON, as an object or its text; both are create-only, so any change replaces it and deletes the old one once the update commits, and a change that keeps a template's own `Name` is refused, as for every custom-named resource), `Studio` (created with every property; a template that sets the read-only `Arn`, `StudioId` or `Url` is refused; updated in place through `UpdateStudio` for `Name`, `Description`, `SubnetIds` and `DefaultS3Location`, a dropped setting kept as it is, and for `Tags`, keeping tags added outside the stack; a change to `IdpAuthUrl` or `IdpRelayStateParameterName` is accepted with a warning and not applied, as no Studio API changes them; a rollback puts back the name, description, location and tags, but not subnets an update added, which `UpdateStudio` cannot take away; a change to a create-only property replaces the Studio and deletes the old one once the update commits), `StudioSessionMapping` (`Ref` is `StudioId|IdentityType|IdentityName`, the schema's primary identifier; `SessionPolicyArn` updates in place, and a change to any of the three others replaces the mapping) |
| EMR on EKS | `VirtualCluster` (created with `Name`, `ContainerProvider`, `SecurityConfigurationId`, `SessionEnabled` and `Tags`; a template that sets the read-only `Arn` or `Id` is refused; updated in place for `Tags` alone, which end as the template lists them, any other but an `aws:` one removed; a change to any other property replaces the virtual cluster, as the registry marks them create-only, and terminates the old one once the update commits; an update of a virtual cluster that is terminated or gone fails) |
| EMR Serverless | `Application` (created with every property, `Name` and `Type` included; updated in place through `UpdateApplication` for the settings a template changes, a dropped setting kept as it is but for `InitialCapacity`, which is cleared, and for `Tags`, which end as the template lists them, any other removed; a change to `Name` or `Type` replaces the application and deletes the old one once the update commits; neither an update nor a delete stops a `STARTED` application, so one it refuses fails the resource, as on AWS) |
+10 -3
View File
@@ -408,9 +408,16 @@ populated"), and one that names a `nodeRoleArn` without node pools with `Invalid
Compute Config nodeRoleArn is not null or empty, nodePool value(s) must be provided."). A `computeConfig` with
neither is accepted, as AWS accepts it for Auto Mode without its built-in node pools.
In CloudFormation, `AWS::EKS::Cluster` leaves EKS Auto Mode out for now: it accepts `ComputeConfig`,
`StorageConfig` and `KubernetesNetworkConfig.ElasticLoadBalancing` and ignores them, so a template that enables
Auto Mode creates its cluster without it.
`UpdateClusterConfig` turns Auto Mode on or off for an existing cluster and changes its node pools, taking
`computeConfig`, `storageConfig` and `kubernetesNetworkConfig.elasticLoadBalancing` together as one update, which
it records as an `AutoModeUpdate`. A member the request leaves out keeps its stored value, and while compute stays
on, a `computeConfig` without `nodeRoleArn` keeps the cluster's role, which can't change while it is on. A request
that changes nothing is refused with `InvalidRequestException` ("No changes needed for EKS Auto Mode
configuration provided").
In CloudFormation, `AWS::EKS::Cluster` creates its cluster with `ComputeConfig`, `StorageConfig` and
`KubernetesNetworkConfig.ElasticLoadBalancing`, and an update changes them in place through `UpdateClusterConfig`:
a property the template drops is read as disabled, and a stack rollback puts the configuration before back.
With IAM enforcement on, `CreateCluster` checks `iam:PassRole` on the cluster role, passed to
`eks.amazonaws.com`, and not yet on the node role. AWS's Service Reference lists both `ec2.amazonaws.com` and
@@ -9,13 +9,17 @@ import io.floci.aws.core.common.ReservedTags;
import io.floci.aws.services.cloudformation.model.StackResource;
import io.floci.aws.services.eks.EksService;
import io.floci.aws.services.eks.model.AccessConfig;
import io.floci.aws.services.eks.model.BlockStorage;
import io.floci.aws.services.eks.model.Cluster;
import io.floci.aws.services.eks.model.ComputeConfig;
import io.floci.aws.services.eks.model.CreateClusterRequest;
import io.floci.aws.services.eks.model.ElasticLoadBalancing;
import io.floci.aws.services.eks.model.KubernetesNetworkConfig;
import io.floci.aws.services.eks.model.LogSetup;
import io.floci.aws.services.eks.model.Logging;
import io.floci.aws.services.eks.model.Nodegroup;
import io.floci.aws.services.eks.model.ResourcesVpcConfig;
import io.floci.aws.services.eks.model.StorageConfig;
import io.floci.aws.services.eks.model.UpdateClusterConfigRequest;
import io.floci.aws.services.eks.model.UpgradePolicy;
import jakarta.enterprise.context.ApplicationScoped;
@@ -28,6 +32,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.TreeSet;
import java.util.function.Consumer;
@@ -57,7 +62,8 @@ public class EksCfnProvisioner implements CfnResourceProvisioner {
private static final String SNAPSHOT_ATTR = CfnRollback.EKS_CLUSTER_UPDATE_SNAPSHOT_ATTR;
/** The cluster properties updateInPlace applies through UpdateClusterConfig, besides Tags. */
private static final Set<String> CLUSTER_APPLIED =
Set.of("ResourcesVpcConfig", "Logging", "AccessConfig", "UpgradePolicy");
Set.of("ResourcesVpcConfig", "Logging", "AccessConfig", "UpgradePolicy", "ComputeConfig", "StorageConfig",
"KubernetesNetworkConfig");
private static final String NODEGROUP_SNAPSHOT_ATTR = CfnRollback.EKS_NODEGROUP_UPDATE_SNAPSHOT_ATTR;
// The tag keys the last deployment resolved, reserved ones included, as Ec2Tags.recordKeys records
// them, so an update removes only those and keeps a tag added outside the stack.
@@ -125,14 +131,9 @@ public class EksCfnProvisioner implements CfnResourceProvisioner {
Map<String, String> templateTags = ctx.resolveTags(props, "Tags");
request.setTags(templateTags);
request.setEncryptionConfig(createSetting(props, "EncryptionConfig", ctx, new TypeReference<>() { }));
KubernetesNetworkConfig network =
createSetting(props, "KubernetesNetworkConfig", ctx, new TypeReference<>() { });
if (network != null) {
// EKS Auto Mode stays out until ComputeConfig and StorageConfig go with it: CreateCluster refuses load
// balancing without the other two.
network.setElasticLoadBalancing(null);
}
request.setKubernetesNetworkConfig(network);
request.setKubernetesNetworkConfig(createSetting(props, "KubernetesNetworkConfig", ctx, new TypeReference<>() { }));
request.setComputeConfig(createSetting(props, "ComputeConfig", ctx, new TypeReference<>() { }));
request.setStorageConfig(createSetting(props, "StorageConfig", ctx, new TypeReference<>() { }));
request.setResourcesVpcConfig(createSetting(props, "ResourcesVpcConfig", ctx, new TypeReference<>() { }));
request.setAccessConfig(createSetting(props, "AccessConfig", ctx, new TypeReference<>() { }));
request.setLogging(logging(props, ctx));
@@ -159,8 +160,7 @@ public class EksCfnProvisioner implements CfnResourceProvisioner {
* template value is read against the type the resource schema declares, so a value of another type
* fails the resource with CloudFormation's wording. The request model has no ServiceIpv6Cidr member
* of KubernetesNetworkConfig and no ControlPlaneEgressMode member of ResourcesVpcConfig, so those
* are not read, and a create leaves out KubernetesNetworkConfig's ElasticLoadBalancing, as it does
* EKS Auto Mode's other settings.
* are not read.
*/
private static <T> T createSetting(JsonNode props, String name, ProvisionContext ctx, TypeReference<T> type) {
JsonNode resolved = readSetting(props, name, ctx);
@@ -437,8 +437,63 @@ public class EksCfnProvisioner implements CfnResourceProvisioner {
upgradePolicy = new UpgradePolicy(supportType);
}
}
return vpc == null && logging == null && access == null && upgradePolicy == null ? null
: new UpdateClusterConfigRequest(vpc, logging, access, upgradePolicy, null);
AutoModeChange autoMode = autoModeChange(props, ctx, changes, live);
if (vpc == null && logging == null && access == null && upgradePolicy == null && autoMode == null) {
return null;
}
return autoMode == null ? new UpdateClusterConfigRequest(vpc, logging, access, upgradePolicy, null)
: new UpdateClusterConfigRequest(vpc, logging, access, upgradePolicy, null,
autoMode.compute(), autoMode.storage(), autoMode.network());
}
/** The EKS Auto Mode members of an UpdateClusterConfig request. */
private record AutoModeChange(ComputeConfig compute, StorageConfig storage, KubernetesNetworkConfig network) { }
/**
* The EKS Auto Mode change the template asks for, or null when it asks for none. ComputeConfig, StorageConfig
* and KubernetesNetworkConfig.ElasticLoadBalancing are updated in place, not create-only, and go to
* UpdateClusterConfig together, as its Auto Mode members: one the template drops is read as disabled. The
* request is sent only when it changes the live cluster's configuration, as {@link EksService#changesAutoMode}
* decides with UpdateClusterConfig's own rules, and names the node role {@link EksService#keepingNodeRole}
* keeps.
*/
private static AutoModeChange autoModeChange(JsonNode props, ProvisionContext ctx, PropertyChanges changes,
Cluster live) {
if (!changed(changes, "ComputeConfig") && !changed(changes, "StorageConfig")
&& !loadBalancingChanged(changes)) {
return null;
}
ComputeConfig compute = createSetting(props, "ComputeConfig", ctx, new TypeReference<>() { });
StorageConfig storage = createSetting(props, "StorageConfig", ctx, new TypeReference<>() { });
KubernetesNetworkConfig declaredNetwork =
createSetting(props, "KubernetesNetworkConfig", ctx, new TypeReference<>() { });
ElasticLoadBalancing loadBalancing = declaredNetwork == null || declaredNetwork.getElasticLoadBalancing() == null
? new ElasticLoadBalancing(false) : declaredNetwork.getElasticLoadBalancing();
compute = compute == null ? new ComputeConfig(false, null, null) : compute;
storage = storage == null || storage.blockStorage() == null ? new StorageConfig(new BlockStorage(false)) : storage;
if (!EksService.changesAutoMode(live, compute, storage, loadBalancing)) {
return null;
}
// A role the template leaves out is the live one; UpdateClusterConfig refuses node pools named without one.
compute = EksService.keepingNodeRole(live, compute);
KubernetesNetworkConfig network = new KubernetesNetworkConfig();
network.setElasticLoadBalancing(loadBalancing);
return new AutoModeChange(compute, storage, network);
}
/**
* Whether KubernetesNetworkConfig's ElasticLoadBalancing is what changed. Its other members are create-only
* (IpFamily, ServiceIpv4Cidr) or not applied (ServiceIpv6Cidr), so a change to one of them asks for no Auto Mode
* change, and doesn't turn off Auto Mode a cluster got outside the stack.
*/
private static boolean loadBalancingChanged(PropertyChanges changes) {
if (!changed(changes, "KubernetesNetworkConfig")) {
return false;
}
PropertyChanges.PropertyChange change = changes.byName().get("KubernetesNetworkConfig");
JsonNode prior = change.prior() == null ? null : change.prior().get("ElasticLoadBalancing");
JsonNode current = change.current() == null ? null : change.current().get("ElasticLoadBalancing");
return !Objects.equals(prior, current);
}
private static boolean changed(PropertyChanges changes, String name) {
@@ -478,6 +533,13 @@ public class EksCfnProvisioner implements CfnResourceProvisioner {
if (request.upgradePolicy() != null) {
snapshot.set("upgradePolicy", MAPPER.valueToTree(live.getUpgradePolicy()));
}
if (request.changesAutoMode()) {
ObjectNode autoMode = snapshot.putObject("autoMode");
autoMode.set("compute", MAPPER.valueToTree(live.getComputeConfig()));
autoMode.set("storage", MAPPER.valueToTree(live.getStorageConfig()));
KubernetesNetworkConfig network = live.getKubernetesNetworkConfig();
autoMode.set("loadBalancing", MAPPER.valueToTree(network == null ? null : network.getElasticLoadBalancing()));
}
}
/**
@@ -508,6 +570,12 @@ public class EksCfnProvisioner implements CfnResourceProvisioner {
snapshot.has("upgradePolicy")
? MAPPER.convertValue(snapshot.get("upgradePolicy"), UpgradePolicy.class) : null);
}
JsonNode autoMode = snapshot.get("autoMode");
if (name != null && autoMode != null) {
eksService.restoreAutoMode(name, MAPPER.convertValue(autoMode.get("compute"), ComputeConfig.class),
MAPPER.convertValue(autoMode.get("storage"), StorageConfig.class),
MAPPER.convertValue(autoMode.get("loadBalancing"), ElasticLoadBalancing.class));
}
Ec2Tags.restoreRecord(r, keysAttr, snapshot);
}
@@ -1281,23 +1281,17 @@ public class EksService implements TagHandler, ResourceProvider, Ec2InstanceLaun
private static AutoMode requireAutoModeChange(Cluster cluster, UpdateClusterConfigRequest request) {
AutoMode current = autoMode(cluster);
ComputeConfig requested = request.computeConfig();
ComputeConfig compute = current.compute();
if (requested != null) {
requireNodePoolsWithRole(requested);
boolean staysOn = current.computeOn() && Boolean.TRUE.equals(requested.enabled());
String role = requested.nodeRoleArn();
if (staysOn && role != null && !role.isEmpty() && !role.equals(current.compute().nodeRoleArn())) {
if (current.computeOn() && Boolean.TRUE.equals(requested.enabled()) && role != null && !role.isEmpty()
&& !role.equals(current.compute().nodeRoleArn())) {
throw new AwsException("InvalidParameterException",
"nodeRoleArn cannot be changed after the compute capability of EKS Auto Mode is enabled", 400);
}
compute = staysOn && (role == null || role.isEmpty())
? new ComputeConfig(requested.enabled(), requested.nodePools(), current.compute().nodeRoleArn())
: requested;
}
ElasticLoadBalancing requestedLoadBalancing = elasticLoadBalancing(request.kubernetesNetworkConfig());
AutoMode next = new AutoMode(compute,
request.storageConfig() != null ? request.storageConfig() : current.storage(),
requestedLoadBalancing != null ? requestedLoadBalancing : current.loadBalancing());
AutoMode next = nextAutoMode(cluster, requested, request.storageConfig(),
elasticLoadBalancing(request.kubernetesNetworkConfig()));
requireCapabilitiesTogether(next.compute(), next.storage(), next.loadBalancing());
if (current.state().equals(next.state())) {
throw new AwsException("InvalidRequestException",
@@ -1306,13 +1300,51 @@ public class EksService implements TagHandler, ResourceProvider, Ec2InstanceLaun
return next;
}
/** The configuration an update leaves: a member it leaves null keeps the stored one; see {@link #keepingNodeRole}. */
private static AutoMode nextAutoMode(Cluster cluster, ComputeConfig compute, StorageConfig storage,
ElasticLoadBalancing loadBalancing) {
AutoMode current = autoMode(cluster);
return new AutoMode(compute == null ? current.compute() : keepingNodeRole(cluster, compute),
storage != null ? storage : current.storage(),
loadBalancing != null ? loadBalancing : current.loadBalancing());
}
/**
* The compute configuration an update leaves {@code cluster} with: while the compute capability stays on, one
* that names no node role keeps the cluster's, which can't change while it is on.
*/
public static ComputeConfig keepingNodeRole(Cluster cluster, ComputeConfig requested) {
ComputeConfig live = cluster.getComputeConfig();
boolean staysOn = live != null && Boolean.TRUE.equals(live.enabled()) && Boolean.TRUE.equals(requested.enabled());
String role = requested.nodeRoleArn();
return staysOn && (role == null || role.isEmpty())
? new ComputeConfig(requested.enabled(), requested.nodePools(), live.nodeRoleArn()) : requested;
}
/**
* Whether an UpdateClusterConfig naming these EKS Auto Mode members changes {@code cluster}'s configuration; it
* answers one that doesn't "No changes needed". A member left null keeps the stored one. The three capabilities
* are first checked to be on or off together, as UpdateClusterConfig checks them, since a configuration with
* compute off compares as off whatever the other two are. UpdateClusterConfig checks the rest.
*/
public static boolean changesAutoMode(Cluster cluster, ComputeConfig compute, StorageConfig storage,
ElasticLoadBalancing loadBalancing) {
AutoMode next = nextAutoMode(cluster, compute, storage, loadBalancing);
requireCapabilitiesTogether(next.compute(), next.storage(), next.loadBalancing());
return !autoMode(cluster).state().equals(next.state());
}
private static void storeAutoMode(Cluster cluster, AutoMode autoMode) {
cluster.setComputeConfig(autoMode.compute());
cluster.setStorageConfig(autoMode.storage());
if (cluster.getKubernetesNetworkConfig() != null) {
cluster.getKubernetesNetworkConfig().setElasticLoadBalancing(autoMode.loadBalancing());
}
}
/** Stores {@code next}, and returns the Auto Mode members the request names as the update's parameters. */
private static List<UpdateParam> applyAutoMode(Cluster cluster, AutoMode next, UpdateClusterConfigRequest request) {
cluster.setComputeConfig(next.compute());
cluster.setStorageConfig(next.storage());
if (cluster.getKubernetesNetworkConfig() != null) {
cluster.getKubernetesNetworkConfig().setElasticLoadBalancing(next.loadBalancing());
}
storeAutoMode(cluster, next);
List<UpdateParam> params = new ArrayList<>();
if (request.computeConfig() != null) {
params.add(new UpdateParam("ComputeConfig", json(request.computeConfig())));
@@ -1371,6 +1403,18 @@ public class EksService implements TagHandler, ResourceProvider, Ec2InstanceLaun
});
}
/**
* Puts back the EKS Auto Mode configuration an update changed, with no AWS rules applied: a stack rollback
* restores the node role an update may not change and a configuration UpdateClusterConfig would answer "No
* changes needed" to.
*/
public synchronized void restoreAutoMode(String name, ComputeConfig compute, StorageConfig storage,
ElasticLoadBalancing loadBalancing) {
Cluster cluster = requireClusterInRequestRegion(name);
saveClusterIfNotDeleting(regionResolver.getAccountId(), clusterKey(cluster),
current -> storeAutoMode(current, new AutoMode(compute, storage, loadBalancing)));
}
/** The log types a {@link Logging} setting enables; empty for a null setting. */
public static Set<String> enabledLogTypes(Logging logging) {
Set<String> enabled = new HashSet<>();
@@ -251,29 +251,42 @@ class CloudFormationEksIntegrationTest {
}
}
/** EKS Auto Mode stays out of AWS::EKS::Cluster for now, so a template enabling it still creates its cluster. */
@Test
void aClusterEnablingAutoModeIsCreatedWithoutIt() {
void aClusterIsCreatedWithAutoModeAndAnUpdateDroppingItTurnsItOffInPlace() {
String stack = "cfn-eks-auto-" + Long.toString(System.nanoTime(), 36);
String autoMode = "\"ComputeConfig\": {\"Enabled\": true, \"NodePools\": [\"general-purpose\", \"system\"],"
+ " \"NodeRoleArn\": \"arn:aws:iam::000000000000:role/eks-auto-node\"},"
+ " \"StorageConfig\": {\"BlockStorage\": {\"Enabled\": true}},"
+ " \"KubernetesNetworkConfig\": {\"ElasticLoadBalancing\": {\"Enabled\": true}}";
// The Gateway API settings, which Floci doesn't model, don't fail the conversion either.
// The Gateway API settings, which Floci doesn't model, don't fail the conversion.
String gatewayApi = "\"KubernetesNetworkConfig\": {\"ElasticLoadBalancing\": {\"Enabled\": false,"
+ " \"GatewayApi\": {\"Crds\": {\"Managed\": true}}}}";
String template = "{\"Resources\": {"
+ "\"Subject\": {\"Type\": \"AWS::EKS::Cluster\", \"Properties\": {" + ROLE + autoMode + "}},"
+ "\"Gateway\": {\"Type\": \"AWS::EKS::Cluster\", \"Properties\": {" + ROLE + gatewayApi + "}}}}";
String gateway = "\"Gateway\": {\"Type\": \"AWS::EKS::Cluster\", \"Properties\": {" + ROLE + gatewayApi + "}}";
try (CloudFormationClient client = AwsTestClients.create(
CloudFormationClient.builder(), "test", Region.US_EAST_1)) {
CfnStackWaits.createStack(client, stack, template, "CREATE_COMPLETE");
for (String resource : List.of("Subject", "Gateway")) {
JsonPath cluster = given().get("/clusters/" + physicalId(client, stack, resource)).jsonPath();
assertNull(cluster.get("cluster.computeConfig"), resource);
assertNull(cluster.get("cluster.storageConfig"), resource);
assertNull(cluster.get("cluster.kubernetesNetworkConfig.elasticLoadBalancing"), resource);
}
CfnStackWaits.createStack(client, stack, "{\"Resources\": {"
+ "\"Subject\": {\"Type\": \"AWS::EKS::Cluster\", \"Properties\": {" + ROLE + autoMode + "}},"
+ gateway + "}}", "CREATE_COMPLETE");
String subject = physicalId(client, stack, "Subject");
JsonPath cluster = given().get("/clusters/" + subject).jsonPath();
assertEquals(true, cluster.getBoolean("cluster.computeConfig.enabled"));
assertEquals(List.of("general-purpose", "system"), cluster.getList("cluster.computeConfig.nodePools"));
assertEquals("arn:aws:iam::000000000000:role/eks-auto-node",
cluster.getString("cluster.computeConfig.nodeRoleArn"));
assertEquals(true, cluster.getBoolean("cluster.storageConfig.blockStorage.enabled"));
assertEquals(true, cluster.getBoolean("cluster.kubernetesNetworkConfig.elasticLoadBalancing.enabled"));
assertEquals(false, given().get("/clusters/" + physicalId(client, stack, "Gateway")).jsonPath()
.getBoolean("cluster.kubernetesNetworkConfig.elasticLoadBalancing.enabled"));
CfnStackWaits.updateStack(client, stack, "{\"Resources\": {"
+ "\"Subject\": {\"Type\": \"AWS::EKS::Cluster\", \"Properties\": {"
+ ROLE.substring(0, ROLE.length() - 2) + "}}," + gateway + "}}", "UPDATE_COMPLETE");
assertEquals(subject, physicalId(client, stack, "Subject"));
JsonPath updated = given().get("/clusters/" + subject).jsonPath();
assertEquals(false, updated.getBoolean("cluster.computeConfig.enabled"));
assertEquals(false, updated.getBoolean("cluster.storageConfig.blockStorage.enabled"));
assertEquals(false, updated.getBoolean("cluster.kubernetesNetworkConfig.elasticLoadBalancing.enabled"));
} finally {
CfnStackWaits.deleteStack(stack);
}
@@ -6,16 +6,23 @@ import io.floci.aws.core.common.AwsException;
import io.floci.aws.services.cloudformation.CloudFormationTemplateEngine;
import io.floci.aws.services.cloudformation.model.StackResource;
import io.floci.aws.services.eks.EksService;
import io.floci.aws.services.eks.model.BlockStorage;
import io.floci.aws.services.eks.model.CertificateAuthority;
import io.floci.aws.services.eks.model.Cluster;
import io.floci.aws.services.eks.model.ClusterIdentity;
import io.floci.aws.services.eks.model.ComputeConfig;
import io.floci.aws.services.eks.model.CreateClusterRequest;
import io.floci.aws.services.eks.model.ElasticLoadBalancing;
import io.floci.aws.services.eks.model.KubernetesNetworkConfig;
import io.floci.aws.services.eks.model.Logging;
import io.floci.aws.services.eks.model.Nodegroup;
import io.floci.aws.services.eks.model.OidcIdentity;
import io.floci.aws.services.eks.model.StorageConfig;
import io.floci.aws.services.eks.model.UpdateClusterConfigRequest;
import io.floci.aws.services.eks.model.UpgradePolicy;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import org.mockito.ArgumentCaptor;
import java.util.ArrayList;
@@ -47,6 +54,14 @@ class EksCfnProvisionerTest {
private final EksCfnProvisioner provisioner = new EksCfnProvisioner(eks);
private final ObjectMapper mapper = new ObjectMapper();
private static final String PROD_ROLE = "{\"Name\": \"prod\", \"RoleArn\": \"arn:aws:iam::000000000000:role/eks\", ";
private static final String NODE_ROLE = "arn:aws:iam::000000000000:role/eks-auto-node";
/** EKS Auto Mode on: both built-in pools with their node role, block storage and load balancing. */
private static final String AUTO_MODE = "\"ComputeConfig\": {\"Enabled\": true, "
+ "\"NodePools\": [\"general-purpose\", \"system\"], \"NodeRoleArn\": \"" + NODE_ROLE + "\"}, "
+ "\"StorageConfig\": {\"BlockStorage\": {\"Enabled\": true}}, "
+ "\"KubernetesNetworkConfig\": {\"ElasticLoadBalancing\": {\"Enabled\": true}}";
@Test
void clusterRefIsItsNameAndItPublishesTheResolvableReadOnlyAttributes() throws Exception {
Cluster created = new Cluster();
@@ -125,6 +140,132 @@ class EksCfnProvisionerTest {
verify(eks).restoreClusterConfig("prod", null, null, null, new UpgradePolicy("STANDARD"));
}
@Test
void aClusterCreatedWithAutoModeAsksForItsComputeStorageAndLoadBalancing() throws Exception {
Cluster created = new Cluster();
created.setName("prod");
created.setArn("arn:aws:eks:us-east-1:000000000000:cluster/prod");
when(eks.createCluster(any(CreateClusterRequest.class))).thenReturn(created);
provisioner.provision(resource("AWS::EKS::Cluster", "Control"), props(PROD_ROLE + AUTO_MODE + "}"), ctx());
ArgumentCaptor<CreateClusterRequest> create = ArgumentCaptor.forClass(CreateClusterRequest.class);
verify(eks).createCluster(create.capture());
assertEquals(new ComputeConfig(true, List.of("general-purpose", "system"),
NODE_ROLE), create.getValue().getComputeConfig());
assertEquals(new StorageConfig(new BlockStorage(true)), create.getValue().getStorageConfig());
assertEquals(new ElasticLoadBalancing(true),
create.getValue().getKubernetesNetworkConfig().getElasticLoadBalancing());
}
@Test
void anUpdateTurningAutoModeOnSendsItsThreeMembersAndARollbackRestoresTheConfigurationBefore() throws Exception {
Cluster created = new Cluster();
created.setName("prod");
created.setArn("arn:aws:eks:us-east-1:000000000000:cluster/prod");
created.setKubernetesNetworkConfig(new KubernetesNetworkConfig());
when(eks.createCluster(any(CreateClusterRequest.class))).thenReturn(created);
StackResource r = resource("AWS::EKS::Cluster", "Control");
JsonNode before = props("{\"Name\": \"prod\", \"RoleArn\": \"arn:aws:iam::000000000000:role/eks\"}");
provisioner.provision(r, before, ctx());
when(eks.describeCluster("prod")).thenReturn(created);
JsonNode after = props(PROD_ROLE + AUTO_MODE + "}");
provisioner.provision(r, after, update(before, after));
ArgumentCaptor<UpdateClusterConfigRequest> request = ArgumentCaptor.forClass(UpdateClusterConfigRequest.class);
verify(eks).updateClusterConfig(eq("prod"), request.capture());
assertEquals(new ComputeConfig(true, List.of("general-purpose", "system"), NODE_ROLE),
request.getValue().computeConfig());
assertEquals(new StorageConfig(new BlockStorage(true)), request.getValue().storageConfig());
assertEquals(new ElasticLoadBalancing(true),
request.getValue().kubernetesNetworkConfig().getElasticLoadBalancing());
assertTrue(provisioner.rollbackUpdate(r));
verify(eks).restoreAutoMode("prod", null, null, null);
}
@Test
void anUpdateThatOnlyLeavesOutTheNodeRoleChangesNoAutoMode() throws Exception {
StackResource r = autoModeCluster();
JsonNode before = props(PROD_ROLE + AUTO_MODE + "}");
// The same pools in another order, and no node role: the live one is kept.
JsonNode after = props(PROD_ROLE + AUTO_MODE.replace("[\"general-purpose\", \"system\"], \"NodeRoleArn\": \""
+ NODE_ROLE + "\"", "[\"system\", \"general-purpose\"]") + "}");
provisioner.provision(r, after, update(before, after));
verify(eks, never()).updateClusterConfig(any(), any());
}
@Test
void anUpdateChangingTheNodePoolsWithoutTheNodeRoleSendsTheLiveRole() throws Exception {
StackResource r = autoModeCluster();
JsonNode before = props(PROD_ROLE + AUTO_MODE + "}");
JsonNode after = props(PROD_ROLE + AUTO_MODE.replace("[\"general-purpose\", \"system\"], \"NodeRoleArn\": \""
+ NODE_ROLE + "\"", "[\"general-purpose\"]") + "}");
provisioner.provision(r, after, update(before, after));
ArgumentCaptor<UpdateClusterConfigRequest> request = ArgumentCaptor.forClass(UpdateClusterConfigRequest.class);
verify(eks).updateClusterConfig(eq("prod"), request.capture());
assertEquals(new ComputeConfig(true, List.of("general-purpose"), NODE_ROLE), request.getValue().computeConfig());
}
@Test
void aNetworkChangeOtherThanLoadBalancingLeavesAutoModeTheStackNeverDeclaredAlone() throws Exception {
// Auto Mode was turned on outside the stack, whose template never declares it.
StackResource r = autoModeCluster();
JsonNode before = props(PROD_ROLE + "\"KubernetesNetworkConfig\": {\"IpFamily\": \"ipv6\"}}");
JsonNode after = props(PROD_ROLE + "\"KubernetesNetworkConfig\": {\"IpFamily\": \"ipv6\", "
+ "\"ServiceIpv6Cidr\": \"fd00::/108\"}}");
provisioner.provision(r, after, update(before, after));
verify(eks, never()).updateClusterConfig(any(), any());
}
@ParameterizedTest
@ValueSource(strings = {"\"StorageConfig\": {\"BlockStorage\": {\"Enabled\": true}}",
"\"KubernetesNetworkConfig\": {\"ElasticLoadBalancing\": {\"Enabled\": true}}"})
void anUpdateTurningOnOneCapabilityAloneIsRefusedAsUpdateClusterConfigRefusesIt(String capability)
throws Exception {
Cluster created = new Cluster();
created.setName("prod");
created.setArn("arn:aws:eks:us-east-1:000000000000:cluster/prod");
created.setKubernetesNetworkConfig(new KubernetesNetworkConfig());
when(eks.createCluster(any(CreateClusterRequest.class))).thenReturn(created);
StackResource r = resource("AWS::EKS::Cluster", "Control");
JsonNode before = props("{\"Name\": \"prod\", \"RoleArn\": \"arn:aws:iam::000000000000:role/eks\"}");
provisioner.provision(r, before, ctx());
when(eks.describeCluster("prod")).thenReturn(created);
JsonNode after = props(PROD_ROLE + capability + "}");
AwsException refused = assertThrows(AwsException.class,
() -> provisioner.provision(r, after, update(before, after)));
assertEquals("InvalidParameterException", refused.getErrorCode());
assertEquals("For EKS Auto Mode, please ensure that all required configs, including computeConfig, "
+ "kubernetesNetworkConfig, and blockStorage are all either fully enabled or fully disabled.",
refused.getMessage());
verify(eks, never()).updateClusterConfig(any(), any());
}
/** A cluster the stack created, now running EKS Auto Mode with both built-in pools. */
private StackResource autoModeCluster() throws Exception {
Cluster created = new Cluster();
created.setName("prod");
created.setArn("arn:aws:eks:us-east-1:000000000000:cluster/prod");
when(eks.createCluster(any(CreateClusterRequest.class))).thenReturn(created);
StackResource r = resource("AWS::EKS::Cluster", "Control");
provisioner.provision(r, props(PROD_ROLE + AUTO_MODE + "}"), ctx());
created.setComputeConfig(new ComputeConfig(true, List.of("general-purpose", "system"), NODE_ROLE));
created.setStorageConfig(new StorageConfig(new BlockStorage(true)));
KubernetesNetworkConfig network = new KubernetesNetworkConfig();
network.setElasticLoadBalancing(new ElasticLoadBalancing(true));
created.setKubernetesNetworkConfig(network);
when(eks.describeCluster("prod")).thenReturn(created);
return r;
}
@Test
void anUnrelatedUpdateStoresThePolicyTheTemplateDeclaresForAClusterThatHoldsNone() throws Exception {
Cluster created = new Cluster();
@@ -261,17 +402,19 @@ class EksCfnProvisionerTest {
});
when(engine.resolveNode(any())).thenAnswer(inv -> inv.getArgument(0));
when(engine.omitNoValue(any())).thenAnswer(inv -> inv.getArgument(0));
when(engine.resolveStringList(any())).thenAnswer(inv -> {
JsonNode node = inv.getArgument(0);
List<String> out = new ArrayList<>();
if (node != null && node.isArray()) {
node.forEach(element -> out.add(element.asText()));
}
return out;
});
when(engine.resolveStringList(any())).thenAnswer(inv -> strings(inv.getArgument(0)));
when(engine.resolveLiteralList(any())).thenAnswer(inv -> strings(inv.getArgument(0)));
return new ProvisionContext(engine, "us-east-1", "000000000000", "my-stack");
}
private static List<String> strings(JsonNode node) {
List<String> out = new ArrayList<>();
if (node != null && node.isArray()) {
node.forEach(element -> out.add(element.asText()));
}
return out;
}
private JsonNode props(String json) throws Exception {
return mapper.readTree(json);
}
@@ -290,7 +290,6 @@ AWS::EFS::FileSystem ReplicationConfiguration not modeled: Floci has no EFS repl
AWS::EKS::Cluster ActiveCertificateAuthorityId accepted and ignored
AWS::EKS::Cluster BootstrapSelfManagedAddons accepted and ignored
AWS::EKS::Cluster CertificateAuthority accepted and ignored
AWS::EKS::Cluster ComputeConfig accepted and ignored
AWS::EKS::Cluster ControlPlaneScalingConfig accepted and ignored
AWS::EKS::Cluster DeletionProtection accepted and ignored
AWS::EKS::Cluster Force accepted and ignored
@@ -300,7 +299,6 @@ AWS::EKS::Cluster KubeSchedulerConfig accepted and ignored
AWS::EKS::Cluster OutpostConfig accepted and ignored
AWS::EKS::Cluster RemoteNetworkConfig accepted and ignored
AWS::EKS::Cluster RollbackConfig accepted and ignored
AWS::EKS::Cluster StorageConfig accepted and ignored
AWS::EKS::Cluster ZonalShiftConfig accepted and ignored
AWS::EKS::Nodegroup AmiType accepted and ignored
AWS::EKS::Nodegroup CapacityType accepted and ignored
1 AWS::ApiGateway::ApiKey StageKeys accepted and ignored, as the ApiGatewayApiKeyCfnProvisioner javadoc records
290 AWS::EKS::Cluster ActiveCertificateAuthorityId accepted and ignored
291 AWS::EKS::Cluster BootstrapSelfManagedAddons accepted and ignored
292 AWS::EKS::Cluster CertificateAuthority accepted and ignored
AWS::EKS::Cluster ComputeConfig accepted and ignored
293 AWS::EKS::Cluster ControlPlaneScalingConfig accepted and ignored
294 AWS::EKS::Cluster DeletionProtection accepted and ignored
295 AWS::EKS::Cluster Force accepted and ignored
299 AWS::EKS::Cluster OutpostConfig accepted and ignored
300 AWS::EKS::Cluster RemoteNetworkConfig accepted and ignored
301 AWS::EKS::Cluster RollbackConfig accepted and ignored
AWS::EKS::Cluster StorageConfig accepted and ignored
302 AWS::EKS::Cluster ZonalShiftConfig accepted and ignored
303 AWS::EKS::Nodegroup AmiType accepted and ignored
304 AWS::EKS::Nodegroup CapacityType accepted and ignored
+1 -1
View File
@@ -236,7 +236,7 @@ notes:
AWS::CDK::Metadata: accepted; no-op
AWS::Transfer::Server: 'management plane only; Ref returns the server ARN; Arn, ServerId and State attributes supported; AS2 managed egress IPs are not modeled; Domain replacement and IdentityProviderType changes are not supported'
AWS::Transfer::User: 'management plane only; Ref returns the user ARN; Arn attribute supported; Policy and PosixProfile are not supported; a ServerId or UserName change replaces the user'
AWS::EKS::Cluster: 'created with `Name`, `Version`, `RoleArn`, `Tags`, `EncryptionConfig`, `ResourcesVpcConfig`, `Logging`, `AccessConfig`, `UpgradePolicy` and `KubernetesNetworkConfig.IpFamily` and `ServiceIpv4Cidr`, a replacement included; a change to `EncryptionConfig`, `IpFamily` or `ServiceIpv4Cidr` replaces the cluster with the new value applied; `ElasticLoadBalancing`, `ServiceIpv6Cidr` and `ResourcesVpcConfig.ControlPlaneEgressMode` are accepted and ignored; updated in place for `Tags`, keeping tags added outside the stack, for `Logging`, for `AccessConfig.AuthenticationMode` (a mode cannot be moved back, so a stack update that does so fails, and a stack rollback restores it), for `UpgradePolicy` (a dropped one returns the cluster to `EXTENDED`) and for `ResourcesVpcConfig` endpoint access and `PublicAccessCidrs`; a change to `Name`, `RoleArn`, `EncryptionConfig`, `BootstrapSelfManagedAddons`, `OutpostConfig`, `AccessConfig.BootstrapClusterCreatorAdminPermissions`, `KubernetesNetworkConfig.IpFamily` or `KubernetesNetworkConfig.ServiceIpv4Cidr` replaces the cluster, as the registry marks them create-only, and deletes the old one once the update commits; a change to `Version` is accepted with a warning and not applied, as the emulator has no `UpdateClusterVersion`; a change to the subnets or security groups of `ResourcesVpcConfig` fails the resource, as the emulator''s `UpdateClusterConfig` does not change them'
AWS::EKS::Cluster: 'created with `Name`, `Version`, `RoleArn`, `Tags`, `EncryptionConfig`, `ResourcesVpcConfig`, `Logging`, `AccessConfig`, `UpgradePolicy`, `ComputeConfig`, `StorageConfig` and `KubernetesNetworkConfig.IpFamily`, `ServiceIpv4Cidr` and `ElasticLoadBalancing`, a replacement included; a change to `EncryptionConfig`, `IpFamily` or `ServiceIpv4Cidr` replaces the cluster with the new value applied; `ServiceIpv6Cidr` and `ResourcesVpcConfig.ControlPlaneEgressMode` are accepted and ignored; updated in place for `Tags`, keeping tags added outside the stack, for `Logging`, for `AccessConfig.AuthenticationMode` (a mode cannot be moved back, so a stack update that does so fails, and a stack rollback restores it), for `UpgradePolicy` (a dropped one returns the cluster to `EXTENDED`), for the EKS Auto Mode properties `ComputeConfig`, `StorageConfig` and `KubernetesNetworkConfig.ElasticLoadBalancing` through `UpdateClusterConfig` (a dropped one is read as disabled, a stack update that leaves the three neither all enabled nor all disabled fails as `UpdateClusterConfig` refuses it, and a stack rollback restores the configuration before) and for `ResourcesVpcConfig` endpoint access and `PublicAccessCidrs`; a change to `Name`, `RoleArn`, `EncryptionConfig`, `BootstrapSelfManagedAddons`, `OutpostConfig`, `AccessConfig.BootstrapClusterCreatorAdminPermissions`, `KubernetesNetworkConfig.IpFamily` or `KubernetesNetworkConfig.ServiceIpv4Cidr` replaces the cluster, as the registry marks them create-only, and deletes the old one once the update commits; a change to `Version` is accepted with a warning and not applied, as the emulator has no `UpdateClusterVersion`; a change to the subnets or security groups of `ResourcesVpcConfig` fails the resource, as the emulator''s `UpdateClusterConfig` does not change them'
AWS::EKS::Nodegroup: 'created with `ClusterName`, `NodegroupName`, `NodeRole`, `Subnets` and `Tags`; updated in place for `Tags`, keeping tags added outside the stack; a change to `ClusterName`, `NodegroupName`, `NodeRole`, `Subnets`, `AmiType`, `CapacityType`, `DiskSize`, `InstanceTypes` or `RemoteAccess` replaces the nodegroup, as the registry marks them create-only, and deletes the old one once the update commits; `ScalingConfig`, `Labels`, `Taints`, `UpdateConfig`, `Version`, `ReleaseVersion`, `ForceUpdateEnabled`, `LaunchTemplate`, `NodeRepairConfig` and `WarmPoolConfig` are accepted and not applied, whether changed or dropped, with a warning, as the emulator cannot update a nodegroup in place'
AWS::EMR::Cluster: 'created through `RunJobFlow`, once it is waiting or running, its master, core and task groups or fleets as `RunJobFlow`''s `InstanceGroups` or `InstanceFleets`; `AdditionalInfo` and `Instances`'' `HadoopVersion` are accepted with a warning and not stored; task groups and fleets need unique names; a template that sets the read-only `Id` or `MasterPublicDNS` is refused; updated in place for `AutoTerminationPolicy`, `ManagedScalingPolicy`, `StepConcurrencyLevel`, `VisibleToAllUsers`, `Tags` (keeping tags added outside the stack), `TerminationProtected`, `UnhealthyNodeReplacement`, a core or task group''s `InstanceCount` and `AutoScalingPolicy` and a core or task fleet''s target capacities, a dropped one taking its default; any other change, within `Instances` included, replaces the cluster and terminates the old one once the update commits; a termination-protected cluster refuses the delete'
AWS::EMR::InstanceFleetConfig: 'a `TASK` fleet, the one type the reference allows, added through `AddInstanceFleet`; `TargetOnDemandCapacity`, `TargetSpotCapacity`, `InstanceTypeConfigs` and `ResizeSpecifications` update in place through `ModifyInstanceFleet`, and a create-only change adds a new fleet; a rollback puts them back, but not an instance type the update added, which every later `ModifyInstanceFleet` must include, nor resize specifications where the fleet had none, which no request can clear, and dropped configs or resize specifications are kept for the same reason; the delete shrinks the fleet to nothing, as a fleet cannot be removed from its cluster'