This repository was archived by the owner on May 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 75
This repository was archived by the owner on May 7, 2021. It is now read-only.
aws: kola iam role can get into weird state if user doesn't have passrole perms #1047
Copy link
Copy link
Open
Labels
Description
If I initially run kola without the iam passrole permissions then I end up with a instance profile that doesn't have a role associated with it.
In this case I run kola on a fresh account (no CreatedBy=mantle resources) and it fails because I didn't have passrole permissions:
[coreos-assembler]$ kola -p aws --aws-ami ami-0e884738127697eb9 --aws-region us-east-1 -b fcos run coreos.ignition.resource.s3
=== RUN coreos.ignition.resource.s3
--- FAIL: coreos.ignition.resource.s3 (0.32s)
harness.go:507: Cluster failed starting machines: error verifying IAM instance profile: adding role "kola" to instance profile "kola": AccessDenied: User: arn:aws:iam::013116697141:user/dusty-fcos is not authorized to perform: iam:PassRole on resource: role kola
status code: 403, request id: 08080270-c449-11e9-a7a4-a589214ff8db
FAIL, output in _kola_temp/aws-2019-08-21-1922-321
harness: test suite failed
Subsequent runs of kola won't re-attempt to fix the error (i.e. a kola role exists so continue on):
[coreos-assembler]$
[coreos-assembler]$ kola -p aws --aws-ami ami-0e884738127697eb9 --aws-region us-east-1 -b fcos run coreos.ignition.resource.s3
=== RUN coreos.ignition.resource.s3
--- FAIL: coreos.ignition.resource.s3 (351.12s)
harness.go:507: Cluster failed starting machines: machine "i-0d3611d49fc18f878" failed to start: ssh journalctl failed: dial tcp 52.201.248.149:22: connect: connection refused
) on machine i-0d3611d49fc18f878 consolening (fs/kernfs/dir.c:1503 kernfs_remove_by_name_ns+0x83/0x90
FAIL, output in _kola_temp/aws-2019-08-21-1925-336
harness: test suite failed
This test eventually fails because the there is no role in the instance profile:
$ curl http://169.254.169.254/latest/meta-data/iam/info
{
"Code" : "Success",
"Message" : "Instance Profile does not contain a role. Please see documentation at http://docs.amazonwebservices.com/IAM/latest/UserGuide/RolesTroubleshooting.html.",
"LastUpdated" : "2019-08-21T18:43:09Z",
"InstanceProfileArn" : "arn:aws:iam::00000000000:instance-profile/kola",
"InstanceProfileId" : "AIPARGFOZ5J262XIR3ZOJ"
}
I'm guessing we should either do a check for passrole early and fail before we even try to create the kola role, or we should check the instance profile later to make sure it contains a role before continuing. We could do both :)