mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
fix(emr): give back a cluster's Kerberos realm, OS release, root volume, placement groups and logging settings (#9183)
RunJobFlow dropped the cluster's KerberosAttributes, OSReleaseLabel, EbsRootVolumeIops, EbsRootVolumeThroughput, PlacementGroupConfigs, LogEncryptionKmsKeyId, RepoUpgradeOnBoot and MonitoringConfiguration, so DescribeCluster gave back none of them. - DescribeCluster gives each back as it was asked for, the placement group configs as its PlacementGroups. - OSReleaseLabel is the one asked for, else the latest Amazon Linux release DescribeReleaseLabel lists for the cluster's release, as "If no Amazon Linux release was specified, the default Amazon Linux release is shown in the response". - RepoUpgradeOnBoot is SECURITY for a cluster with a custom AMI that names none, as "If omitted, the default is SECURITY". - Of KerberosAttributes only the Realm is kept and given back, never a password, and a cluster without them answers an empty structure, as AWS does. - A member the model requires, or a value outside its enum, is refused with the framework's ValidationException. So are two placement groups for one instance role, and one for the primary nodes of a cluster without three of them (three on-demand and no spot for a fleet), in the words AWS answers them with. - As only the primary nodes take a placement group, with SPREAD or NONE, another role or strategy is refused, in Floci's words, and a group without a strategy gets SPREAD, as the Management Guide says. - AWS::EMR::Cluster passes these properties to RunJobFlow rather than warning that they are not stored.
This commit is contained in:
1 parent
eb6998ed2e
commit
a9bea6567c
10 files changed
+415
-19
No files matched your search
@@ -220,7 +220,7 @@ cross-resource references.
|
||||
| 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` 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) 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`, `KerberosAttributes`, `OSReleaseLabel`, `EbsRootVolumeIops`, `EbsRootVolumeThroughput`, `PlacementGroupConfigs`, `LogEncryptionKmsKeyId`, `MonitoringConfiguration` 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 | `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) |
|
||||
| RDS | `DBInstance` (starts a real container), `DBCluster` (starts a real container), `DBSubnetGroup`, `DBParameterGroup`, `DBClusterParameterGroup`, `DBProxy`, `DBProxyTargetGroup` |
|
||||
|
||||
@@ -105,6 +105,26 @@ list when none was, as AWS gives them, and a request naming both is refused with
|
||||
documented, so it is Floci's. `IamInstanceProfile` is the `JobFlowRole`, "The IAM role that was specified when the
|
||||
cluster was launched", and `AdditionalMasterSecurityGroups` and `AdditionalSlaveSecurityGroups` are the ones given.
|
||||
|
||||
`DescribeCluster` also gives back the cluster's own settings as `RunJobFlow` took them: `EbsRootVolumeIops`,
|
||||
`EbsRootVolumeThroughput`, `LogEncryptionKmsKeyId`, `RepoUpgradeOnBoot`, `PlacementGroupConfigs` as its
|
||||
`PlacementGroups`, and `MonitoringConfiguration`. `RepoUpgradeOnBoot` "Applies only when CustomAmiID is used", and is
|
||||
`SECURITY` for a cluster with a custom AMI that names none, as "If omitted, the default is SECURITY".
|
||||
`OSReleaseLabel` is the one asked for, else the latest Amazon Linux release `DescribeReleaseLabel` lists for the
|
||||
cluster's release, as "If no Amazon Linux release was specified, the default Amazon Linux release is shown in the
|
||||
response". Of `KerberosAttributes` only the `Realm` is kept and given back, never a password, and a cluster without
|
||||
them answers an empty structure, as AWS does. A member the model requires (the `Realm` and `KdcAdminPassword`, a
|
||||
placement group's `InstanceRole`, a CloudWatch log configuration's `Enabled`) or a value outside its enum is refused
|
||||
with the framework's `ValidationException`. So are two placement groups for one instance role, and one for the primary
|
||||
nodes of a cluster without multiple primary nodes, in AWS's words: "Placement group supports single placement strategy
|
||||
for an instance role. Found multiple strategy for the following instance role: MASTER", and "Placement group support
|
||||
for master node is available only for multi-master cluster and not for single-master cluster." A cluster has multiple
|
||||
primary nodes with "an instance count value of 3 for the primary node instance group", or "the TargetOnDemandCapacity
|
||||
of 3, TargetSpotCapacity of 0 for the primary instance fleet". As "only primary node types are supported by the
|
||||
placement group strategy, and the SPREAD strategy is applied to those primary nodes", a placement group for another
|
||||
role, or with a strategy other than `SPREAD` or `NONE`, is refused with `ValidationException` too, in Floci's words.
|
||||
One without a strategy gets `SPREAD`, as "the MASTER instance role automatically uses SPREAD as the placement group
|
||||
strategy".
|
||||
|
||||
The limits the API reference and the Management Guide give steps are checked, in each operation's own error code, in
|
||||
Floci's words, as no source gives AWS's: a `StepConcurrencyLevel` from 1 to 256 ("You can specify a minimum of 1 step
|
||||
and a maximum of 256 steps"), which `RunJobFlow` refuses with `ValidationException` and `ModifyCluster` with
|
||||
|
||||
+3
-3
@@ -103,11 +103,11 @@ public class EmrCfnProvisioner implements CfnResourceProvisioner {
|
||||
private static final List<String> RUN_JOB_FLOW_MEMBERS = List.of("Name", "ReleaseLabel", "LogUri", "ServiceRole",
|
||||
"JobFlowRole", "AutoScalingRole", "ScaleDownBehavior", "SecurityConfiguration", "CustomAmiId",
|
||||
"VisibleToAllUsers", "StepConcurrencyLevel", "EbsRootVolumeSize", "Applications", "BootstrapActions",
|
||||
"ManagedScalingPolicy", "AutoTerminationPolicy", "SessionEnabled", "Tags");
|
||||
/** The cluster properties Floci's RunJobFlow keeps nothing of: accepted with a warning and not stored. */
|
||||
private static final List<String> CLUSTER_NOT_STORED = List.of("AdditionalInfo", "KerberosAttributes",
|
||||
"ManagedScalingPolicy", "AutoTerminationPolicy", "SessionEnabled", "Tags", "KerberosAttributes",
|
||||
"OSReleaseLabel", "EbsRootVolumeIops", "EbsRootVolumeThroughput", "PlacementGroupConfigs",
|
||||
"LogEncryptionKmsKeyId", "MonitoringConfiguration");
|
||||
/** The cluster properties Floci's RunJobFlow keeps nothing of: accepted with a warning and not stored. */
|
||||
private static final List<String> CLUSTER_NOT_STORED = List.of("AdditionalInfo");
|
||||
/** The members of {@code Instances} Floci's RunJobFlow keeps nothing of, accepted with a warning. */
|
||||
private static final List<String> INSTANCES_NOT_STORED = List.of("HadoopVersion");
|
||||
private static final String GROUPS = "groups";
|
||||
|
||||
@@ -51,6 +51,15 @@ public class EmrHandler {
|
||||
private static final Logger LOG = Logger.getLogger(EmrHandler.class);
|
||||
/** "There is a limit of 25 volumes per instance." (Amazon EMR Management Guide, Instance storage) */
|
||||
private static final int EBS_VOLUMES_PER_INSTANCE = 25;
|
||||
// The enums of RunJobFlow's RepoUpgradeOnBoot and of a PlacementGroupConfig's InstanceRole and PlacementStrategy.
|
||||
private static final List<String> REPO_UPGRADES = List.of("SECURITY", "NONE");
|
||||
private static final List<String> INSTANCE_ROLES = List.of("MASTER", "CORE", "TASK");
|
||||
private static final List<String> PLACEMENT_STRATEGIES = List.of("SPREAD", "PARTITION", "CLUSTER", "NONE");
|
||||
private static final String PRIMARY_ROLE = "MASTER";
|
||||
// The logging configurations of a cluster's MonitoringConfiguration and of a session's.
|
||||
private static final List<String> CLUSTER_LOGGING = List.of("CloudWatchLogConfiguration", "S3LoggingConfiguration");
|
||||
private static final List<String> SESSION_LOGGING = List.of("S3LoggingConfiguration",
|
||||
"CloudWatchLoggingConfiguration", "ManagedLoggingConfiguration");
|
||||
// RunJobFlow's uniform form's instance groups (see uniformInstanceGroups).
|
||||
static final String UNIFORM_MASTER_GROUP = "Master InstanceGroup";
|
||||
static final String UNIFORM_CORE_GROUP = "Core InstanceGroup";
|
||||
@@ -193,6 +202,7 @@ public class EmrHandler {
|
||||
cluster.setVisibleToAllUsers(request.path("VisibleToAllUsers").asBoolean(true));
|
||||
cluster.setStepConcurrencyLevel(request.path("StepConcurrencyLevel").asInt(1));
|
||||
cluster.setEbsRootVolumeSize(request.path("EbsRootVolumeSize").asInt(0));
|
||||
readClusterSettings(request, cluster);
|
||||
cluster.setApplications(rawArray(request.path("Applications")));
|
||||
cluster.setConfigurations(rawArray(request.path("Configurations")));
|
||||
cluster.setTags(parseTags(request.path("Tags")));
|
||||
@@ -222,10 +232,160 @@ public class EmrHandler {
|
||||
List<EmrInstanceFleet> fleets = parseInstanceFleets(instances.path("InstanceFleets"));
|
||||
cluster.setInstanceGroups(groups.isEmpty() && fleets.isEmpty() ? uniformInstanceGroups(instances) : groups);
|
||||
cluster.setInstanceFleets(fleets);
|
||||
checkPlacementGroups(request.path("PlacementGroupConfigs"), cluster);
|
||||
cluster.setSteps(parseSteps(request.path("Steps"), text(request, "StepExecutionRoleArn")));
|
||||
return cluster;
|
||||
}
|
||||
|
||||
/**
|
||||
* The settings of the cluster as a whole that DescribeCluster gives back as they were asked for: the root volume's
|
||||
* IOPS and throughput, the Amazon Linux release, the log encryption key, RepoUpgradeOnBoot, the realm of its
|
||||
* KerberosAttributes, its PlacementGroupConfigs and its MonitoringConfiguration. A member its model requires, or
|
||||
* a value outside its enum, is refused as the framework refuses one. RepoUpgradeOnBoot "Applies only when
|
||||
* CustomAmiID is used", where "If omitted, the default is SECURITY". Of the KerberosAttributes only the realm is
|
||||
* kept, its passwords never.
|
||||
*/
|
||||
private void readClusterSettings(JsonNode request, EmrCluster cluster) {
|
||||
List<String> violations = new ArrayList<>();
|
||||
cluster.setEbsRootVolumeIops(intOrNull(request.path("EbsRootVolumeIops"), "EbsRootVolumeIops"));
|
||||
cluster.setEbsRootVolumeThroughput(
|
||||
intOrNull(request.path("EbsRootVolumeThroughput"), "EbsRootVolumeThroughput"));
|
||||
cluster.setOsReleaseLabel(string(request, "OSReleaseLabel"));
|
||||
cluster.setLogEncryptionKmsKeyId(string(request, "LogEncryptionKmsKeyId"));
|
||||
String repoUpgrade = string(request, "RepoUpgradeOnBoot");
|
||||
if (repoUpgrade != null && !REPO_UPGRADES.contains(repoUpgrade)) {
|
||||
violations.add(SmithyValidationErrors.notInEnum(repoUpgrade, "repoUpgradeOnBoot", REPO_UPGRADES));
|
||||
}
|
||||
cluster.setRepoUpgradeOnBoot(repoUpgrade == null && cluster.getCustomAmiId() != null
|
||||
? "SECURITY" : repoUpgrade);
|
||||
cluster.setKerberosRealm(kerberosRealm(request.path("KerberosAttributes"), violations));
|
||||
cluster.setPlacementGroups(placementGroups(request.path("PlacementGroupConfigs"), violations));
|
||||
JsonNode monitoring = request.path("MonitoringConfiguration");
|
||||
cluster.setMonitoringConfiguration(monitoringConfiguration(monitoring, CLUSTER_LOGGING));
|
||||
JsonNode enabled = monitoring.path("CloudWatchLogConfiguration").path("Enabled");
|
||||
if (monitoring.path("CloudWatchLogConfiguration").isObject() && (enabled.isMissingNode() || enabled.isNull())) {
|
||||
violations.add(SmithyValidationErrors.notNull(
|
||||
"monitoringConfiguration.cloudWatchLogConfiguration.enabled"));
|
||||
}
|
||||
if (!violations.isEmpty()) {
|
||||
throw SmithyValidationErrors.validationException(violations);
|
||||
}
|
||||
}
|
||||
|
||||
// The realm of KerberosAttributes, whose Realm and KdcAdminPassword the model requires; null when none is given.
|
||||
private static String kerberosRealm(JsonNode kerberos, List<String> violations) {
|
||||
if (kerberos.isMissingNode() || kerberos.isNull()) {
|
||||
return null;
|
||||
}
|
||||
requireStructure(kerberos, "KerberosAttributes");
|
||||
for (String secret : List.of("CrossRealmTrustPrincipalPassword", "ADDomainJoinUser", "ADDomainJoinPassword")) {
|
||||
string(kerberos, secret);
|
||||
}
|
||||
if (string(kerberos, "KdcAdminPassword") == null) {
|
||||
violations.add(SmithyValidationErrors.notNull("kerberosAttributes.kdcAdminPassword"));
|
||||
}
|
||||
String realm = string(kerberos, "Realm");
|
||||
if (realm == null) {
|
||||
violations.add(SmithyValidationErrors.notNull("kerberosAttributes.realm"));
|
||||
}
|
||||
return realm;
|
||||
}
|
||||
|
||||
/**
|
||||
* PlacementGroupConfigs as DescribeCluster's PlacementGroups give them, null when none is given; each config's
|
||||
* InstanceRole, which the model requires, and its PlacementStrategy must be in their enums. A config for the
|
||||
* primary nodes without a strategy gets SPREAD, as "the MASTER instance role automatically uses SPREAD as the
|
||||
* placement group strategy" (Management Guide, "Amazon EMR integration with EC2 placement groups").
|
||||
*/
|
||||
private String placementGroups(JsonNode configs, List<String> violations) {
|
||||
if (configs.isMissingNode() || configs.isNull()) {
|
||||
return null;
|
||||
}
|
||||
if (!configs.isArray()) {
|
||||
throw malformed("PlacementGroupConfigs must be a list of placement group configs");
|
||||
}
|
||||
ArrayNode placements = objectMapper.createArrayNode();
|
||||
int position = 1;
|
||||
for (JsonNode config : configs) {
|
||||
if (!config.isObject()) {
|
||||
throw malformed("PlacementGroupConfigs must be a list of placement group configs");
|
||||
}
|
||||
String path = "placementGroupConfigs." + position + ".member.";
|
||||
String role = string(config, "InstanceRole");
|
||||
if (role == null) {
|
||||
violations.add(SmithyValidationErrors.notNull(path + "instanceRole"));
|
||||
} else if (!INSTANCE_ROLES.contains(role)) {
|
||||
violations.add(SmithyValidationErrors.notInEnum(role, path + "instanceRole", INSTANCE_ROLES));
|
||||
}
|
||||
String strategy = string(config, "PlacementStrategy");
|
||||
if (strategy != null && !PLACEMENT_STRATEGIES.contains(strategy)) {
|
||||
violations.add(SmithyValidationErrors.notInEnum(strategy, path + "placementStrategy",
|
||||
PLACEMENT_STRATEGIES));
|
||||
}
|
||||
ObjectNode placement = placements.addObject().put("InstanceRole", role);
|
||||
if (strategy != null || PRIMARY_ROLE.equals(role)) {
|
||||
placement.put("PlacementStrategy", strategy != null ? strategy : "SPREAD");
|
||||
}
|
||||
position++;
|
||||
}
|
||||
return placements.isEmpty() ? null : placements.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Refuses PlacementGroupConfigs AWS refuses. Two for one instance role, and one for the primary nodes of a cluster
|
||||
* without multiple primary nodes, are recorded from AWS, in its words. "Currently, only primary node types are
|
||||
* supported by the placement group strategy, and the SPREAD strategy is applied to those primary nodes", NONE
|
||||
* launching them "without placement group strategy", so another role or strategy is refused too, in Floci's words,
|
||||
* as no source gives AWS's.
|
||||
*/
|
||||
private static void checkPlacementGroups(JsonNode configs, EmrCluster cluster) {
|
||||
List<String> roles = new ArrayList<>();
|
||||
for (JsonNode config : configs) {
|
||||
String role = config.path("InstanceRole").asText();
|
||||
if (roles.contains(role)) {
|
||||
throw new AwsException("ValidationException", "Placement group supports single placement strategy "
|
||||
+ "for an instance role. Found multiple strategy for the following instance role: " + role,
|
||||
400);
|
||||
}
|
||||
roles.add(role);
|
||||
}
|
||||
for (JsonNode config : configs) {
|
||||
String role = config.path("InstanceRole").asText();
|
||||
if (!PRIMARY_ROLE.equals(role)) {
|
||||
throw new AwsException("ValidationException",
|
||||
"Placement groups are supported only for the MASTER instance role, not " + role + ".", 400);
|
||||
}
|
||||
String strategy = config.path("PlacementStrategy").asText("SPREAD");
|
||||
if (!"SPREAD".equals(strategy) && !"NONE".equals(strategy)) {
|
||||
throw new AwsException("ValidationException", "The MASTER instance role supports only the SPREAD "
|
||||
+ "or NONE placement strategy, not " + strategy + ".", 400);
|
||||
}
|
||||
}
|
||||
if (roles.contains(PRIMARY_ROLE) && !multiplePrimaryNodes(cluster)) {
|
||||
throw new AwsException("ValidationException", "Placement group support for master node is available "
|
||||
+ "only for multi-master cluster and not for single-master cluster.", 400);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the cluster has multiple primary nodes: "an instance count value of 3 for the primary node instance
|
||||
* group", or "the TargetOnDemandCapacity of 3, TargetSpotCapacity of 0 for the primary instance fleet"
|
||||
* (Management Guide, "Launch an Amazon EMR Cluster with multiple primary nodes").
|
||||
*/
|
||||
private static boolean multiplePrimaryNodes(EmrCluster cluster) {
|
||||
for (EmrInstanceGroup group : cluster.getInstanceGroups()) {
|
||||
if (PRIMARY_ROLE.equals(group.getInstanceGroupType())) {
|
||||
return group.getRequestedInstanceCount() == 3;
|
||||
}
|
||||
}
|
||||
for (EmrInstanceFleet fleet : cluster.getInstanceFleets()) {
|
||||
if (PRIMARY_ROLE.equals(fleet.getInstanceFleetType())) {
|
||||
return fleet.getTargetOnDemandCapacity() == 3 && fleet.getTargetSpotCapacity() == 0;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private Response handleDescribeCluster(JsonNode request) {
|
||||
EmrCluster cluster = service.describeCluster(text(request, "ClusterId"));
|
||||
ObjectNode response = objectMapper.createObjectNode();
|
||||
@@ -337,7 +497,8 @@ public class EmrHandler {
|
||||
private Response handleStartSession(JsonNode request) {
|
||||
EmrSessions.Request start = new EmrSessions.Request(string(request, "Name"),
|
||||
string(request, "ExecutionRoleArn"), configurationList(request.path("EngineConfigurations"),
|
||||
"EngineConfigurations"), monitoringConfiguration(request.path("MonitoringConfiguration")),
|
||||
"EngineConfigurations"),
|
||||
monitoringConfiguration(request.path("MonitoringConfiguration"), SESSION_LOGGING),
|
||||
longOrNull(request.path("SessionIdleTimeoutInMinutes"), "SessionIdleTimeoutInMinutes"),
|
||||
string(request, "ClientRequestToken"), tagList(request.path("Tags"), "Tags"));
|
||||
EmrSession session = service.startSession(string(request, "ClusterId"), start);
|
||||
@@ -452,6 +613,15 @@ public class EmrHandler {
|
||||
throw malformed("EC2InstanceIdsToTerminate must be a list of strings");
|
||||
}
|
||||
|
||||
// An Integer member, read as longOrNull reads a Long one; a number past an Integer's range is refused as well.
|
||||
private static Integer intOrNull(JsonNode value, String member) {
|
||||
Long number = longOrNull(value, member);
|
||||
if (number != null && !value.canConvertToInt()) {
|
||||
throw malformed(member + " must be an integer");
|
||||
}
|
||||
return number == null ? null : number.intValue();
|
||||
}
|
||||
|
||||
private static Long longOrNull(JsonNode value, String member) {
|
||||
if (value.isMissingNode() || value.isNull()) {
|
||||
return null;
|
||||
@@ -463,18 +633,17 @@ public class EmrHandler {
|
||||
}
|
||||
|
||||
/**
|
||||
* StartSession's SessionMonitoringConfiguration, kept as its raw JSON; null when it is not there or empty. Each of
|
||||
* its S3, CloudWatch and managed logging configurations is a structure of an {@code Enabled} boolean, strings, and
|
||||
* {@code LogTypes}, a map of lists of strings.
|
||||
* A MonitoringConfiguration, RunJobFlow's or StartSession's, kept as its raw JSON; null when it is not there or
|
||||
* empty. Each of its {@code loggings} configurations is a structure of an {@code Enabled} boolean, strings,
|
||||
* {@code LogTypes}, a map of lists of strings, and {@code LogTypeUploadPolicy}, a map of strings.
|
||||
*/
|
||||
private static String monitoringConfiguration(JsonNode value) {
|
||||
private static String monitoringConfiguration(JsonNode value, List<String> loggings) {
|
||||
String member = "MonitoringConfiguration";
|
||||
if (value.isMissingNode() || value.isNull()) {
|
||||
return null;
|
||||
}
|
||||
requireStructure(value, member);
|
||||
for (String logging : List.of("S3LoggingConfiguration", "CloudWatchLoggingConfiguration",
|
||||
"ManagedLoggingConfiguration")) {
|
||||
for (String logging : loggings) {
|
||||
JsonNode configuration = value.path(logging);
|
||||
if (configuration.isMissingNode() || configuration.isNull()) {
|
||||
continue;
|
||||
@@ -494,6 +663,8 @@ public class EmrHandler {
|
||||
} else if ("LogTypes".equals(entry.getKey())) {
|
||||
requireStructure(field, path + ".LogTypes");
|
||||
field.forEach(types -> strings(types, path + ".LogTypes"));
|
||||
} else if ("LogTypeUploadPolicy".equals(entry.getKey())) {
|
||||
stringMap(field, path + ".LogTypeUploadPolicy");
|
||||
} else if (!field.isTextual()) {
|
||||
throw malformed(path + "." + entry.getKey() + " must be a string");
|
||||
}
|
||||
@@ -1528,6 +1699,28 @@ public class EmrHandler {
|
||||
node.put("CustomAmiId", c.getCustomAmiId());
|
||||
}
|
||||
node.put("EbsRootVolumeSize", c.getEbsRootVolumeSize());
|
||||
if (c.getEbsRootVolumeIops() != null) {
|
||||
node.put("EbsRootVolumeIops", c.getEbsRootVolumeIops());
|
||||
}
|
||||
if (c.getEbsRootVolumeThroughput() != null) {
|
||||
node.put("EbsRootVolumeThroughput", c.getEbsRootVolumeThroughput());
|
||||
}
|
||||
if (c.getOsReleaseLabel() != null) {
|
||||
node.put("OSReleaseLabel", c.getOsReleaseLabel());
|
||||
}
|
||||
if (c.getLogEncryptionKmsKeyId() != null) {
|
||||
node.put("LogEncryptionKmsKeyId", c.getLogEncryptionKmsKeyId());
|
||||
}
|
||||
if (c.getRepoUpgradeOnBoot() != null) {
|
||||
node.put("RepoUpgradeOnBoot", c.getRepoUpgradeOnBoot());
|
||||
}
|
||||
// An empty structure where the cluster has none, as AWS answers one.
|
||||
ObjectNode kerberos = node.putObject("KerberosAttributes");
|
||||
if (c.getKerberosRealm() != null) {
|
||||
kerberos.put("Realm", c.getKerberosRealm());
|
||||
}
|
||||
setRawJson(node, "PlacementGroups", c.getPlacementGroups());
|
||||
setRawJson(node, "MonitoringConfiguration", c.getMonitoringConfiguration());
|
||||
node.put("StepConcurrencyLevel", c.getStepConcurrencyLevel());
|
||||
node.put("ClusterArn", c.getClusterArn());
|
||||
node.put("SessionEnabled", c.isSessionEnabled());
|
||||
|
||||
@@ -541,6 +541,13 @@ public class EmrService implements Resettable, StoredResourceArns, ContainerTear
|
||||
if (cluster.getReleaseLabel() == null) {
|
||||
cluster.setReleaseLabel(defaultReleaseLabel);
|
||||
}
|
||||
// RunJobFlow "uses the latest validated Amazon Linux release" where none is asked for, and DescribeCluster
|
||||
// shows it: the latest its release lists, or none where Floci's catalog lists none for it.
|
||||
if (cluster.getOsReleaseLabel() == null) {
|
||||
cluster.setOsReleaseLabel(EmrReleaseCatalog.release(cluster.getReleaseLabel())
|
||||
.map(EmrReleaseCatalog.Release::osReleases).filter(labels -> !labels.isEmpty())
|
||||
.map(List::getFirst).orElse(null));
|
||||
}
|
||||
cluster.setInstanceCollectionType(cluster.getInstanceFleets().isEmpty()
|
||||
? "INSTANCE_GROUP" : "INSTANCE_FLEET");
|
||||
cluster.setAutoTerminate(!cluster.isKeepJobFlowAliveWhenNoSteps());
|
||||
|
||||
@@ -47,6 +47,18 @@ public class EmrCluster {
|
||||
private int normalizedInstanceHours;
|
||||
private int stepConcurrencyLevel = 1;
|
||||
private int ebsRootVolumeSize;
|
||||
// RunJobFlow's root volume IOPS and throughput; null when not given.
|
||||
private Integer ebsRootVolumeIops;
|
||||
private Integer ebsRootVolumeThroughput;
|
||||
// The Amazon Linux release asked for, else the release's latest; null when neither is known.
|
||||
private String osReleaseLabel;
|
||||
private String logEncryptionKmsKeyId;
|
||||
private String repoUpgradeOnBoot;
|
||||
// The realm of the cluster's KerberosAttributes, and nothing else of them: their passwords are never kept.
|
||||
private String kerberosRealm;
|
||||
// Its PlacementGroupConfigs and MonitoringConfiguration as given, raw JSON; null when none.
|
||||
private String placementGroups;
|
||||
private String monitoringConfiguration;
|
||||
private String ec2Attributes;
|
||||
private String applications;
|
||||
private String configurations;
|
||||
@@ -176,6 +188,36 @@ public class EmrCluster {
|
||||
public int getEbsRootVolumeSize() { return ebsRootVolumeSize; }
|
||||
public void setEbsRootVolumeSize(int ebsRootVolumeSize) { this.ebsRootVolumeSize = ebsRootVolumeSize; }
|
||||
|
||||
public Integer getEbsRootVolumeIops() { return ebsRootVolumeIops; }
|
||||
public void setEbsRootVolumeIops(Integer ebsRootVolumeIops) { this.ebsRootVolumeIops = ebsRootVolumeIops; }
|
||||
|
||||
public Integer getEbsRootVolumeThroughput() { return ebsRootVolumeThroughput; }
|
||||
public void setEbsRootVolumeThroughput(Integer ebsRootVolumeThroughput) {
|
||||
this.ebsRootVolumeThroughput = ebsRootVolumeThroughput;
|
||||
}
|
||||
|
||||
public String getOsReleaseLabel() { return osReleaseLabel; }
|
||||
public void setOsReleaseLabel(String osReleaseLabel) { this.osReleaseLabel = osReleaseLabel; }
|
||||
|
||||
public String getLogEncryptionKmsKeyId() { return logEncryptionKmsKeyId; }
|
||||
public void setLogEncryptionKmsKeyId(String logEncryptionKmsKeyId) {
|
||||
this.logEncryptionKmsKeyId = logEncryptionKmsKeyId;
|
||||
}
|
||||
|
||||
public String getRepoUpgradeOnBoot() { return repoUpgradeOnBoot; }
|
||||
public void setRepoUpgradeOnBoot(String repoUpgradeOnBoot) { this.repoUpgradeOnBoot = repoUpgradeOnBoot; }
|
||||
|
||||
public String getKerberosRealm() { return kerberosRealm; }
|
||||
public void setKerberosRealm(String kerberosRealm) { this.kerberosRealm = kerberosRealm; }
|
||||
|
||||
public String getPlacementGroups() { return placementGroups; }
|
||||
public void setPlacementGroups(String placementGroups) { this.placementGroups = placementGroups; }
|
||||
|
||||
public String getMonitoringConfiguration() { return monitoringConfiguration; }
|
||||
public void setMonitoringConfiguration(String monitoringConfiguration) {
|
||||
this.monitoringConfiguration = monitoringConfiguration;
|
||||
}
|
||||
|
||||
public String getEc2Attributes() { return ec2Attributes; }
|
||||
public void setEc2Attributes(String ec2Attributes) { this.ec2Attributes = ec2Attributes; }
|
||||
|
||||
|
||||
+23
@@ -214,6 +214,29 @@ class EmrCfnProvisionerTest {
|
||||
assertNotNull(r.getAttributes().get(EmrCfnProvisioner.CLUSTER_SHAPE_ATTR));
|
||||
}
|
||||
|
||||
@Test
|
||||
void theClustersOwnSettingsReachRunJobFlowAsTheTemplateGivesThem() {
|
||||
when(handler.clusterFrom(any(), any())).thenReturn(new EmrCluster());
|
||||
when(emr.runJobFlow(any(), eq("us-east-1"))).thenReturn(emrCluster(CLUSTER_ID, "STARTING"));
|
||||
when(emr.describeCluster(CLUSTER_ID)).thenReturn(emrCluster(CLUSTER_ID, "WAITING"));
|
||||
String settings = """
|
||||
, "KerberosAttributes": {"Realm": "EC2.INTERNAL", "KdcAdminPassword": "kdc-secret"},
|
||||
"OSReleaseLabel": "2.0.20260727.0", "EbsRootVolumeIops": 4000, "EbsRootVolumeThroughput": 250,
|
||||
"PlacementGroupConfigs": [{"InstanceRole": "MASTER", "PlacementStrategy": "SPREAD"}],
|
||||
"LogEncryptionKmsKeyId": "key-logs",
|
||||
"MonitoringConfiguration": {"CloudWatchLogConfiguration": {"Enabled": true}}""";
|
||||
JsonNode template = json(clusterProps(2, "m5.xlarge", settings));
|
||||
provisioner.provision(cluster(null), template, ctx(null, null));
|
||||
|
||||
ArgumentCaptor<JsonNode> request = ArgumentCaptor.forClass(JsonNode.class);
|
||||
verify(handler).clusterFrom(request.capture(), eq("us-east-1"));
|
||||
for (String name : List.of("KerberosAttributes", "OSReleaseLabel", "EbsRootVolumeIops",
|
||||
"EbsRootVolumeThroughput", "PlacementGroupConfigs", "LogEncryptionKmsKeyId",
|
||||
"MonitoringConfiguration")) {
|
||||
assertEquals(template.get(name), request.getValue().get(name), name);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void aClusterThatTerminatesBeforeItIsReadyFailsTheCreateAndIsTerminatedAgain() {
|
||||
when(handler.clusterFrom(any(), any())).thenReturn(new EmrCluster());
|
||||
|
||||
@@ -17,8 +17,10 @@ import java.math.BigDecimal;
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static io.floci.aws.testing.EmrRequests.emr;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.endsWith;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.hasKey;
|
||||
@@ -735,4 +737,120 @@ class EmrIntegrationTest {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(23)
|
||||
void describeClusterGivesBackTheClustersOwnSettingsAndOnlyTheRealmOfItsKerberosAttributes() {
|
||||
String osRelease = emr("DescribeReleaseLabel", "{\"ReleaseLabel\":\"emr-7.13.0\"}").then().statusCode(200)
|
||||
.extract().path("AvailableOSReleases[0].Label");
|
||||
String masterGroups = """
|
||||
"InstanceGroups": [
|
||||
{"InstanceRole": "MASTER", "InstanceType": "m5.xlarge", "InstanceCount": 3},
|
||||
{"InstanceRole": "CORE", "InstanceType": "m5.xlarge", "InstanceCount": 1}]""";
|
||||
List<String> launched = new ArrayList<>();
|
||||
try {
|
||||
String set = emr("RunJobFlow", """
|
||||
{"Name": "settings-set", "ReleaseLabel": "emr-7.13.0", "CustomAmiId": "ami-0abc",
|
||||
"EbsRootVolumeIops": 4000, "EbsRootVolumeThroughput": 250,
|
||||
"LogEncryptionKmsKeyId": "arn:aws:kms:us-east-1:000000000000:key/logs",
|
||||
"KerberosAttributes": {"Realm": "EC2.INTERNAL", "KdcAdminPassword": "kdc-secret",
|
||||
"CrossRealmTrustPrincipalPassword": "cross-secret"},
|
||||
"PlacementGroupConfigs": [{"InstanceRole": "MASTER"}],
|
||||
"MonitoringConfiguration": {
|
||||
"CloudWatchLogConfiguration": {"Enabled": true, "LogGroupName": "/emr/logs",
|
||||
"LogTypes": {"STEP_LOGS": ["STDOUT"]}},
|
||||
"S3LoggingConfiguration": {"LogTypeUploadPolicy": {"system-logs": "emr-managed"}}},
|
||||
"Instances": {"KeepJobFlowAliveWhenNoSteps": true, %s}}
|
||||
""".formatted(masterGroups)).then().statusCode(200).extract().path("JobFlowId");
|
||||
launched.add(set);
|
||||
String unset = emr("RunJobFlow", """
|
||||
{"Name": "settings-unset", "ReleaseLabel": "emr-7.13.0", "OSReleaseLabel": "2.0.20260727.0",
|
||||
"Instances": {"KeepJobFlowAliveWhenNoSteps": true}}
|
||||
""").then().statusCode(200).extract().path("JobFlowId");
|
||||
launched.add(unset);
|
||||
|
||||
emr("DescribeCluster", "{\"ClusterId\":\"" + set + "\"}").then().statusCode(200)
|
||||
.body("Cluster.EbsRootVolumeIops", equalTo(4000))
|
||||
.body("Cluster.EbsRootVolumeThroughput", equalTo(250))
|
||||
.body("Cluster.LogEncryptionKmsKeyId", equalTo("arn:aws:kms:us-east-1:000000000000:key/logs"))
|
||||
.body("Cluster.OSReleaseLabel", equalTo(osRelease))
|
||||
.body("Cluster.RepoUpgradeOnBoot", equalTo("SECURITY"))
|
||||
.body("Cluster.KerberosAttributes", equalTo(Map.of("Realm", "EC2.INTERNAL")))
|
||||
.body("Cluster.PlacementGroups",
|
||||
equalTo(List.of(Map.of("InstanceRole", "MASTER", "PlacementStrategy", "SPREAD"))))
|
||||
.body("Cluster.MonitoringConfiguration.CloudWatchLogConfiguration.LogGroupName",
|
||||
equalTo("/emr/logs"))
|
||||
.body("Cluster.MonitoringConfiguration.S3LoggingConfiguration.LogTypeUploadPolicy",
|
||||
equalTo(Map.of("system-logs", "emr-managed")))
|
||||
.body(not(containsString("kdc-secret")))
|
||||
.body(not(containsString("cross-secret")));
|
||||
emr("DescribeCluster", "{\"ClusterId\":\"" + unset + "\"}").then().statusCode(200)
|
||||
.body("Cluster.OSReleaseLabel", equalTo("2.0.20260727.0"))
|
||||
.body("Cluster.KerberosAttributes", equalTo(Map.of()))
|
||||
.body("Cluster", not(hasKey("RepoUpgradeOnBoot")))
|
||||
.body("Cluster", not(hasKey("PlacementGroups")))
|
||||
.body("Cluster", not(hasKey("EbsRootVolumeIops")));
|
||||
} finally {
|
||||
if (!launched.isEmpty()) {
|
||||
emr("TerminateJobFlows", "{\"JobFlowIds\":[\"" + String.join("\",\"", launched) + "\"]}")
|
||||
.then().statusCode(200);
|
||||
}
|
||||
}
|
||||
|
||||
String refused = "{\"Name\": \"settings-refused\", \"Instances\": {\"KeepJobFlowAliveWhenNoSteps\": true%s}%s}";
|
||||
emr("RunJobFlow", refused.formatted("", ", \"KerberosAttributes\": {\"Realm\": \"EC2.INTERNAL\"}"))
|
||||
.then().statusCode(400)
|
||||
.body("__type", equalTo("ValidationException"))
|
||||
.body("message", containsString("'kerberosAttributes.kdcAdminPassword'"))
|
||||
.body("message", not(containsString("EC2.INTERNAL")));
|
||||
emr("RunJobFlow", refused.formatted("", ", \"RepoUpgradeOnBoot\": \"ALL\""))
|
||||
.then().statusCode(400)
|
||||
.body("__type", equalTo("ValidationException"))
|
||||
.body("message", containsString("'repoUpgradeOnBoot'"));
|
||||
emr("RunJobFlow", refused.formatted("", ", \"MonitoringConfiguration\": "
|
||||
+ "{\"CloudWatchLogConfiguration\": {\"LogGroupName\": \"/emr/logs\"}}"))
|
||||
.then().statusCode(400)
|
||||
.body("__type", equalTo("ValidationException"))
|
||||
.body("message", containsString("'monitoringConfiguration.cloudWatchLogConfiguration.enabled'"));
|
||||
emr("RunJobFlow", refused.formatted(", " + masterGroups, ", \"PlacementGroupConfigs\": ["
|
||||
+ "{\"InstanceRole\": \"MASTER\", \"PlacementStrategy\": \"SPREAD\"},"
|
||||
+ "{\"InstanceRole\": \"MASTER\", \"PlacementStrategy\": \"SPREAD\"}]"))
|
||||
.then().statusCode(400)
|
||||
.body("__type", equalTo("ValidationException"))
|
||||
.body("message", equalTo("Placement group supports single placement strategy for an instance role. "
|
||||
+ "Found multiple strategy for the following instance role: MASTER"));
|
||||
emr("RunJobFlow", refused.formatted(", " + masterGroups, ", \"PlacementGroupConfigs\": ["
|
||||
+ "{\"InstanceRole\": \"CORE\", \"PlacementStrategy\": \"SPREAD\"}]"))
|
||||
.then().statusCode(400)
|
||||
.body("__type", equalTo("ValidationException"))
|
||||
.body("message",
|
||||
equalTo("Placement groups are supported only for the MASTER instance role, not CORE."));
|
||||
emr("RunJobFlow", refused.formatted(", " + masterGroups, ", \"PlacementGroupConfigs\": ["
|
||||
+ "{\"InstanceRole\": \"MASTER\", \"PlacementStrategy\": \"PARTITION\"}]"))
|
||||
.then().statusCode(400)
|
||||
.body("__type", equalTo("ValidationException"))
|
||||
.body("message", equalTo("The MASTER instance role supports only the SPREAD or NONE placement "
|
||||
+ "strategy, not PARTITION."));
|
||||
String primaryPlacement = ", \"PlacementGroupConfigs\": [{\"InstanceRole\": \"MASTER\"}]";
|
||||
String singleMaster = "Placement group support for master node is available only for multi-master cluster "
|
||||
+ "and not for single-master cluster.";
|
||||
emr("RunJobFlow", refused.formatted("", primaryPlacement))
|
||||
.then().statusCode(400)
|
||||
.body("__type", equalTo("ValidationException"))
|
||||
.body("message", equalTo(singleMaster));
|
||||
emr("RunJobFlow", refused.formatted(", " + masterGroups.replace("\"InstanceCount\": 3", "\"InstanceCount\": 4"),
|
||||
primaryPlacement))
|
||||
.then().statusCode(400)
|
||||
.body("message", equalTo(singleMaster));
|
||||
emr("RunJobFlow", refused.formatted(", \"InstanceFleets\": [{\"InstanceFleetType\": \"MASTER\", "
|
||||
+ "\"TargetOnDemandCapacity\": 1, \"TargetSpotCapacity\": 2, "
|
||||
+ "\"InstanceTypeConfigs\": [{\"InstanceType\": \"m5.xlarge\"}]}]", primaryPlacement))
|
||||
.then().statusCode(400)
|
||||
.body("message", equalTo(singleMaster));
|
||||
emr("RunJobFlow", refused.formatted("", ", \"EbsRootVolumeIops\": \"fast\""))
|
||||
.then().statusCode(400)
|
||||
.body("__type", equalTo("SerializationException"));
|
||||
emr("ListClusters", "{}").then().statusCode(200)
|
||||
.body("Clusters.findAll { it.Name == 'settings-refused' }", hasSize(0));
|
||||
}
|
||||
}
|
||||
@@ -320,13 +320,6 @@ AWS::EKS::Nodegroup UpdateConfig accepted and ignored
|
||||
AWS::EKS::Nodegroup Version accepted and ignored
|
||||
AWS::EKS::Nodegroup WarmPoolConfig accepted and ignored
|
||||
AWS::EMR::Cluster AdditionalInfo accepted with a warning and not stored, as Floci's RunJobFlow keeps none of it
|
||||
AWS::EMR::Cluster EbsRootVolumeIops accepted with a warning and not stored, as Floci's RunJobFlow keeps none of it
|
||||
AWS::EMR::Cluster EbsRootVolumeThroughput accepted with a warning and not stored, as Floci's RunJobFlow keeps none of it
|
||||
AWS::EMR::Cluster KerberosAttributes accepted with a warning and not stored, as Floci's RunJobFlow keeps none of it
|
||||
AWS::EMR::Cluster LogEncryptionKmsKeyId accepted with a warning and not stored, as Floci's RunJobFlow keeps none of it
|
||||
AWS::EMR::Cluster MonitoringConfiguration accepted with a warning and not stored, as Floci's RunJobFlow keeps none of it
|
||||
AWS::EMR::Cluster OSReleaseLabel accepted with a warning and not stored, as Floci's RunJobFlow keeps none of it
|
||||
AWS::EMR::Cluster PlacementGroupConfigs accepted with a warning and not stored, as Floci's RunJobFlow keeps none of it
|
||||
AWS::ElastiCache::CacheCluster AZMode accepted and ignored, a warning is logged
|
||||
AWS::ElastiCache::CacheCluster AutoMinorVersionUpgrade accepted and ignored
|
||||
AWS::ElastiCache::CacheCluster LogDeliveryConfigurations accepted and ignored, a warning is logged
|
||||
|
||||
|
@@ -238,7 +238,7 @@ notes:
|
||||
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` 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) 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`, `KerberosAttributes`, `OSReleaseLabel`, `EbsRootVolumeIops`, `EbsRootVolumeThroughput`, `PlacementGroupConfigs`, `LogEncryptionKmsKeyId`, `MonitoringConfiguration` 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::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'
|
||||
AWS::EMR::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'
|
||||
AWS::EMR::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'
|
||||
|
||||
Reference in new issue
Block a user