Uploaded image for project: 'OpenShift Bugs'
  1. OpenShift Bugs
  2. OCPBUGS-18986

AWS IAM Instance Profiles sometimes not cleant up

XMLWordPrintable

    • No
    • 2
    • Sprint 242, Sprint 243, Sprint 244, Sprint 246, Sprint 247, Sprint 248, Sprint 249, Sprint 250
    • 8
    • False
    • Hide

      None

      Show
      None
    • Hide
      The fix includes tagging all Instance Profiles, and deleting by finding the Instance profiles with the tags. The fix leaves a call to specifically look for instance profiles with names including bootstrap, master, and worker to ensure the solution can work in previous versions.
      Show
      The fix includes tagging all Instance Profiles, and deleting by finding the Instance profiles with the tags. The fix leaves a call to specifically look for instance profiles with names including bootstrap, master, and worker to ensure the solution can work in previous versions.
    • Bug Fix
    • Done

      Description of problem:

      We have observed that when creating clusters through OCM using the Hive provisioner, which uses OpenShift installer, sometimes some of the AWS IAM Instance Profiles are not cleant up when their corresponding cluster.

      Version-Release number of selected component (if applicable):

      "time=\"2023-09-11T10:37:10Z\" level=debug msg=\"OpenShift Installer v4.12.0\""
      

      How reproducible:

      At the moment we have not found a way to reproduce it consistently, but what we observe is that it does not seem to be an isolated case due to we ended up accumulating AWS IAM Instance Profiles in the AWS account that we are making use for our tests.

      Actual results:

      Sometimes some of the AWS IAM instance profiles associated to the cluster that has been deleted are also cleant up

      Expected results:

      The AWS IAM instance profiles associated to the cluster that has been deleted are also deleted.

      Additional info:

      In https://issues.redhat.com/browse/OCM-2748 we have been doing an investigation of accumulated AWS IAM Instance Profiles in one of our AWS accounts. If you are interested in full details of the investigation please take a look at the issue and its comments.

      Focusing on the instance profiles associated to clusters that we create as part of our test suite we see that the majority of them are worker instance profiles. We also see some occurrences of master and bootstrap instance profiles but for the purposes of the investigation we focused on worker profile because they are the vast majority of the accumulated ones.

      For the purposes of the investigation we focused on a specific cluster 'cs-ci-2lmxd' and we have seen that the worker iam instance profile was created by the openshift installer:

      time="2023-09-11T10:37:43Z" level=debug msg="module.iam.aws_iam_instance_profile.worker: Creation complete after 0s [id=cs-ci-2lmxd-9qtk4-worker-profile]"
      

      But we found that when the cluster was deleted the openshift installer didn't delete it.
      However, we could see that the master profile was created:

      time="2023-09-11T10:37:43Z" level=debug msg="module.masters.aws_iam_instance_profile.master: Creation complete after 0s [id=cs-ci-2lmxd-9qtk4-master-profile]" 
      

      but in this case openshift installer deleted it properly when the cluster was deleted:

      time="2023-09-11T10:49:58Z" level=info msg=Deleted InstanceProfileName=cs-ci-2lmxd-9qtk4-master-profile arn="arn:aws:iam::765374464689:instance-profile/cs-ci-2lmxd-9qtk4-master-profile" id=i-079f2d1580240e3cb resourceType=instance
      

      As additional information, I can see that the worker profile has no tags:

      msoriano@localhost:~/go/src/gitlab.cee.redhat.com/service/uhc-clusters-service (master)(ocm:S)$ aws iam list-instance-profile-tags --instance-profile-name=cs-ci-2lmxd-9qtk4-worker-profile
      {
          "Tags": []
      }
      

      I attach the install and uninstall logs in this issue too.

            rh-ee-bbarbach Brent Barbachem
            msorianod Miguel Soriano
            Yunfei Jiang Yunfei Jiang
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: