early-musician-41645
02/01/2019, 10:37 PMgentle-diamond-70147
02/01/2019, 11:11 PMearly-musician-41645
02/01/2019, 11:20 PMpulumi stack select
to choose our dedicated CD testing stack
- pulumi up
to create an EKS cluster
- run various tests against the new cluster
- pulumi destroy
to destroy all created resources in the stack
It's a test that runs every 3 hours to validate our eks cluster creation. It was passing consistently until the bug in the eks and/or kubernetes packages from 1-2 days ago. After resolving those it start passing again until a few hours ago.
No code changes on our end between the successful runs and the failuresgentle-diamond-70147
02/01/2019, 11:26 PMearly-musician-41645
02/01/2019, 11:32 PMcat package.json
{
"name": "eks-cluster",
"devDependencies": {
"@types/node": "10.12.19"
},
"dependencies": {
"@pulumi/aws": "0.16.7",
"@pulumi/eks": "0.16.6",
"@pulumi/kubernetes": "0.19.0",
"@pulumi/pulumi": "0.16.12"
}
}
white-balloon-205
early-musician-41645
02/04/2019, 7:55 PMwhite-balloon-205
early-musician-41645
02/04/2019, 7:59 PMwhite-balloon-205
console.log
of mappings
and insanceMapping
right before the return in the copy of that code in your node_modules
to find out what values are failing to serialize.roleMappings
(if any) are you passing to your eks.Cluster
?early-musician-41645
02/04/2019, 8:22 PMroleMappings : [
// This role mapping provides full administrator cluster access to the k8s cluster
{
groups : ["system:masters"],
roleArn : clusterAdminRoleArn,
username : "system-admin",
},
// This role mapping provides automation access to the k8s cluster, e.g. gitlab CI
{
groups : ["system:masters"],
roleArn : clusterAutomationAccessRoleArn,
username : "svc-automation",
},
// This role mapping provides devs that have assumed into the mustang cluster role
// access to the k8s cluster
{
groups : ["system:masters"],
roleArn : clusterAccessRoleArn,
username : "dev",
},
],
mappings: [{"groups":["system:masters"],"username":"system-admin"},{"groups":["system:masters"],"roleArn":"arn:aws:iam::009348887430:role/mustang-sandbox-automation-role-f39b756","username":"svc-automation"},{"groups":["system:masters"],"roleArn":"arn:aws:iam::009348887430:role/mustang-sandbox-k8s-cluster-role-30d65f2","username":"dev"}]
instanceMapping: {"roleArn":"arn:aws:iam::009348887430:role/eks-cluster-cd-test-eks-cluster-instanceRole-role-45e8a8d","username":"system:node:{{EC2PrivateDNSName}}","groups":["system:bootstrappers","system:nodes"]}
white-balloon-205
console.log
you see the failure?early-musician-41645
02/04/2019, 8:48 PMconst roleMappings = pulumi.all([pulumi.output(args.roleMappings || []), instanceRoleMapping])
.apply(([mappings, instanceMapping]) => {
console.log("\n");
console.log("mappings: "+JSON.stringify(mappings));
console.log("\n");
console.log("instanceMapping: "+JSON.stringify(instanceMapping));
console.log("\n");
let temp = jsyaml.safeDump([...mappings, instanceMapping].map(m => ({
rolearn: m.roleArn,
username: m.username,
groups: m.groups,
})));
console.log("\nTEST-A\n");
return temp;
});
mappings: [{"groups":["system:masters"],"username":"system-admin"},{"groups":["system:masters"],"roleArn":"arn:aws:iam::009348887430:role/mustang-sandbox-automation-role-f39b756","username":"svc-automation"},{"groups":["system:masters"],"roleArn":"arn:aws:iam::009348887430:role/mustang-sandbox-k8s-cluster-role-30d65f2","username":"dev"}]
instanceMapping: {"roleArn":"arn:aws:iam::009348887430:role/eks-cluster-cd-test-eks-cluster-instanceRole-role-45e8a8d","username":"system:node:{{EC2PrivateDNSName}}","groups":["system:bootstrappers","system:nodes"]}
@pulumi/eks
white-balloon-205
return jsyaml.safeDump([...mappings, instanceMapping].map(m => ({
rolearn: m.roleArn,
username: m.username,
groups: m.groups,
})));
To this:
let arr = [...mappings, instanceMapping].map(m => ({
rolearn: m.roleArn,
username: m.username,
groups: m.groups,
}));
console.log(arr);
return jsyaml.safeDump(arr);
Leaving off the JSON.stringify
is intentional - that will hide where the `undefined`s are.early-musician-41645
02/04/2019, 9:08 PM[ { rolearn: undefined,
username: 'system-admin',
groups: [ 'system:masters' ] },
{ rolearn:
'arn:aws:iam::009348887430:role/mustang-sandbox-automation-role-f39b756',
username: 'svc-automation',
groups: [ 'system:masters' ] },
{ rolearn:
'arn:aws:iam::009348887430:role/mustang-sandbox-k8s-cluster-role-30d65f2',
username: 'dev',
groups: [ 'system:masters' ] },
{ rolearn:
'arn:aws:iam::009348887430:role/eks-cluster-cd-test-eks-cluster-instanceRole-role-45e8a8d',
username: 'system:node:{{EC2PrivateDNSName}}',
groups: [ 'system:bootstrappers', 'system:nodes' ] } ]
white-balloon-205
early-musician-41645
02/04/2019, 9:14 PMundefined
values and add logging on themwhite-balloon-205
early-musician-41645
02/04/2019, 9:16 PMwhite-balloon-205