mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
fix(cloudformation): make EKS Nodegroup Ref the composite cluster/nodegroup id (#4136)
AWS::EKS::Nodegroup Ref returned the bare nodegroup name, but AWS returns the composite "<clusterName>/<nodegroupName>" id. Publish that as the physical id (Ref) and the readOnly Id attribute, and drive delete from the stored ClusterName and NodegroupName attributes rather than parsing the physical id. Removes the EKS Nodegroup Id gap row now that the attribute is set.
This commit is contained in:
1 parent
9e1e974712
commit
69e371721b
3 files changed
+21
-12
No files matched your search
+8
-4
@@ -85,7 +85,7 @@ class EksCfnProvisionerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void nodegroupRefIsItsNameAndItStoresTheClusterNameForDelete() throws Exception {
|
||||
void nodegroupRefIsTheCompositeIdAndItStoresNamesForDelete() throws Exception {
|
||||
Nodegroup created = new Nodegroup();
|
||||
created.setNodegroupName("workers");
|
||||
created.setClusterName("prod");
|
||||
@@ -98,8 +98,11 @@ class EksCfnProvisionerTest {
|
||||
"NodeRole": "arn:aws:iam::000000000000:role/nodes", "Subnets": ["subnet-1", "subnet-2"]}
|
||||
"""), ctx());
|
||||
|
||||
assertEquals("workers", r.getPhysicalId());
|
||||
// Ref and Id are the composite clusterName/nodegroupName, matching AWS.
|
||||
assertEquals("prod/workers", r.getPhysicalId());
|
||||
assertEquals("prod/workers", r.getAttributes().get("Id"));
|
||||
assertEquals("prod", r.getAttributes().get("ClusterName"));
|
||||
assertEquals("workers", r.getAttributes().get("NodegroupName"));
|
||||
assertEquals("arn:aws:eks:us-east-1:000000000000:nodegroup/prod/workers/uuid",
|
||||
r.getAttributes().get("Arn"));
|
||||
ArgumentCaptor<Nodegroup> request = ArgumentCaptor.forClass(Nodegroup.class);
|
||||
@@ -118,10 +121,11 @@ class EksCfnProvisionerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void deleteRemovesTheNodegroupUsingTheStoredClusterName() {
|
||||
void deleteRemovesTheNodegroupUsingTheStoredNames() {
|
||||
StackResource r = resource("AWS::EKS::Nodegroup", "Workers");
|
||||
r.setPhysicalId("workers");
|
||||
r.setPhysicalId("prod/workers");
|
||||
r.getAttributes().put("ClusterName", "prod");
|
||||
r.getAttributes().put("NodegroupName", "workers");
|
||||
|
||||
provisioner.delete(r, "us-east-1");
|
||||
|
||||
|
||||
Reference in new issue
Block a user