Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OCPBUGS-18986: Tag aws instance profiles. #7510

Merged
merged 1 commit into from Sep 26, 2023

Conversation

barbacbd
Copy link
Contributor

** Instance profiles are not always cleaned up correctly. Tags are available for these resources. Tag the resources and let the destroy functions find the resources by tag to be removed.

@openshift-ci-robot openshift-ci-robot added jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Sep 20, 2023
@openshift-ci-robot
Copy link
Contributor

@barbacbd: This pull request references Jira Issue OCPBUGS-18986, which is invalid:

  • expected the bug to target the "4.15.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

In response to this:

** Instance profiles are not always cleaned up correctly. Tags are available for these resources. Tag the resources and let the destroy functions find the resources by tag to be removed.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@barbacbd
Copy link
Contributor Author

/jira refresh

@openshift-ci-robot openshift-ci-robot added the jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. label Sep 20, 2023
@openshift-ci-robot
Copy link
Contributor

@barbacbd: This pull request references Jira Issue OCPBUGS-18986, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.15.0) matches configured target version for branch (4.15.0)
  • bug is in the state New, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @gpei

In response to this:

/jira refresh

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci-robot openshift-ci-robot removed the jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. label Sep 20, 2023
@r4f4
Copy link
Contributor

r4f4 commented Sep 21, 2023

e2e-aws-ovn:
on cluster create:

time="2023-09-20T21:22:14Z" level=debug msg="  + resource \"aws_iam_instance_profile\" \"worker\" {"
time="2023-09-20T21:22:14Z" level=debug msg="      + arn         = (known after apply)"
time="2023-09-20T21:22:14Z" level=debug msg="      + create_date = (known after apply)"
time="2023-09-20T21:22:14Z" level=debug msg="      + id          = (known after apply)"
time="2023-09-20T21:22:14Z" level=debug msg="      + name        = \"ci-op-q9vf6jjl-3266f-stcgj-worker-profile\""
time="2023-09-20T21:22:14Z" level=debug msg="      + name_prefix = (known after apply)"
time="2023-09-20T21:22:14Z" level=debug msg="      + path        = \"/\""
time="2023-09-20T21:22:14Z" level=debug msg="      + role        = \"ci-op-q9vf6jjl-3266f-stcgj-worker-role\""
time="2023-09-20T21:22:14Z" level=debug msg="      + tags        = {"
time="2023-09-20T21:22:14Z" level=debug msg="          + \"Name\"                                             = \"ci-op-q9vf6jjl-3266f-stcgj-worker-profile\""
time="2023-09-20T21:22:14Z" level=debug msg="          + \"expirationDate\"                                   = \"2023-09-21T05:20+0000\""
time="2023-09-20T21:22:14Z" level=debug msg="          + \"keyA\"                                             = \"valueA\""
time="2023-09-20T21:22:14Z" level=debug msg="          + \"keyB\"                                             = \"valueB\""
time="2023-09-20T21:22:14Z" level=debug msg="          + \"keyC\"                                             = \"valueC\""
time="2023-09-20T21:22:14Z" level=debug msg="          + \"kubernetes.io/cluster/ci-op-q9vf6jjl-3266f-stcgj\" = \"owned\""
time="2023-09-20T21:22:14Z" level=debug msg="        }"
time="2023-09-20T21:22:14Z" level=debug msg="      + tags_all    = {"
time="2023-09-20T21:22:14Z" level=debug msg="          + \"Name\"                                             = \"ci-op-q9vf6jjl-3266f-stcgj-worker-profile\""
time="2023-09-20T21:22:14Z" level=debug msg="          + \"expirationDate\"                                   = \"2023-09-21T05:20+0000\""
time="2023-09-20T21:22:14Z" level=debug msg="          + \"keyA\"                                             = \"valueA\""
time="2023-09-20T21:22:14Z" level=debug msg="          + \"keyB\"                                             = \"valueB\""
time="2023-09-20T21:22:14Z" level=debug msg="          + \"keyC\"                                             = \"valueC\""
time="2023-09-20T21:22:14Z" level=debug msg="          + \"kubernetes.io/cluster/ci-op-q9vf6jjl-3266f-stcgj\" = \"owned\""
time="2023-09-20T21:22:14Z" level=debug msg="        }"
time="2023-09-20T21:22:14Z" level=debug msg="      + unique_id   = (known after apply)"
time="2023-09-20T21:22:14Z" level=debug msg="    }"

on cluster destroy:

time="2023-09-20T22:54:14Z" level=info msg=Deleted InstanceProfileName=ci-op-q9vf6jjl-3266f-stcgj-worker-profile arn="arn:aws:iam::460538899914:instance-profile/ci-op-q9vf6jjl-3266f-stcgj-worker-profile" id=i-00aa34b45ed683e2c resourceType=instance`

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Sep 21, 2023
@r4f4
Copy link
Contributor

r4f4 commented Sep 21, 2023

@barbacbd do you know in which version of the provider the instance profile tagging capability was added? We probably want to backport this fix to all supported OCP versions.

@barbacbd
Copy link
Contributor Author

@barbacbd do you know in which version of the provider the instance profile tagging capability was added? We probably want to backport this fix to all supported OCP versions.

I don't but I will try to find this out so we can backport

Copy link
Contributor Author

@barbacbd barbacbd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The installer v4.11 uses the provider v4.5.0. This well beyond the minimum supported version for instance profile tags in the provider. We can backport to 4.11 if we want to. @r4f4 @sadasu

@r4f4
Copy link
Contributor

r4f4 commented Sep 25, 2023

The installer v4.11 uses the provider v4.5.0. This well beyond the minimum supported version for instance profile tags in the provider. We can backport to 4.11 if we want to. @r4f4 @sadasu

Then I think we should do it.

@sadasu
Copy link
Contributor

sadasu commented Sep 25, 2023

Do we want to rename "findUntaggableResources" to "findInstanceProfiles" after this fix?

@r4f4
Copy link
Contributor

r4f4 commented Sep 25, 2023

Do we want to rename "findUntaggableResources" to "findInstanceProfiles" after this fix?

I'd say "no". findUntaggableResources is for resources that cannot be tagged, which in this case happened to be instance profiles but could include other types in the future.

@r4f4
Copy link
Contributor

r4f4 commented Sep 25, 2023

That being said, we could probably remove the profile retrieval from findUntaggableResources if we also include tagging for the bootstrap profile. That would result in an empty findUntaggableResources which we could consider deleting and re-adding once we bump into another untaggable resource. Or we could just leave it as-is and the profiles will be deleted either by the tag or by their name.

@sadasu
Copy link
Contributor

sadasu commented Sep 25, 2023

@r4f4
Copy link
Contributor

r4f4 commented Sep 25, 2023

Should we add the same tag here https://github.com/openshift/installer/blob/master/data/data/aws/bootstrap/main.tf#L83?

Yeah I think so. WDYT @barbacbd ?

** Instance profiles are not always cleaned up correctly. Tags are available for these resources. Tag the resources and let the
destroy functions find the resources by tag to be removed.
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Sep 25, 2023
Copy link
Contributor

@r4f4 r4f4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Sep 25, 2023
@sadasu
Copy link
Contributor

sadasu commented Sep 26, 2023

/approve

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Sep 26, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sadasu

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 26, 2023
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Sep 26, 2023

@barbacbd: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-aws-ovn-shared-vpc 9b83b98 link false /test e2e-aws-ovn-shared-vpc
ci/prow/e2e-aws-ovn-shared-vpc-localzones 9b83b98 link false /test e2e-aws-ovn-shared-vpc-localzones
ci/prow/e2e-aws-ovn-localzones 9b83b98 link false /test e2e-aws-ovn-localzones
ci/prow/okd-e2e-aws-ovn 9b83b98 link false /test okd-e2e-aws-ovn
ci/prow/okd-scos-e2e-aws-ovn 9b83b98 link false /test okd-scos-e2e-aws-ovn

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@openshift-merge-robot openshift-merge-robot merged commit 4ce62d1 into openshift:master Sep 26, 2023
24 of 29 checks passed
@openshift-ci-robot
Copy link
Contributor

@barbacbd: Jira Issue OCPBUGS-18986: All pull requests linked via external trackers have merged:

Jira Issue OCPBUGS-18986 has been moved to the MODIFIED state.

In response to this:

** Instance profiles are not always cleaned up correctly. Tags are available for these resources. Tag the resources and let the destroy functions find the resources by tag to be removed.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-merge-robot
Copy link
Contributor

Fix included in accepted release 4.15.0-0.nightly-2023-09-27-073353

barbacbd added a commit to barbacbd/installer that referenced this pull request Sep 28, 2023
** Partially overrides openshift#7510 to ensure that instance profiles that are
tagged as shared do not get deleted. This fix will be combined with openshift#7510 to
ensure that the solution can be backported.
barbacbd added a commit to barbacbd/installer that referenced this pull request Sep 29, 2023
** Partially overrides openshift#7510 to ensure that instance profiles that are
tagged as shared do not get deleted. This fix will be combined with openshift#7510 to
ensure that the solution can be backported.
barbacbd added a commit to barbacbd/installer that referenced this pull request Oct 18, 2023
** Partially overrides openshift#7510 to ensure that instance profiles that are
tagged as shared do not get deleted. This fix will be combined with openshift#7510 to
ensure that the solution can be backported.
barbacbd added a commit to barbacbd/installer that referenced this pull request Oct 24, 2023
** Partially overrides openshift#7510 to ensure that instance profiles that are
tagged as shared do not get deleted. This fix will be combined with openshift#7510 to
ensure that the solution can be backported.
barbacbd added a commit to barbacbd/installer that referenced this pull request Oct 24, 2023
** Partially overrides openshift#7510 to ensure that instance profiles that are
tagged as shared do not get deleted. This fix will be combined with openshift#7510 to
ensure that the solution can be backported.
barbacbd added a commit to barbacbd/installer that referenced this pull request Oct 24, 2023
** Partially overrides openshift#7510 to ensure that instance profiles that are
tagged as shared do not get deleted. This fix will be combined with openshift#7510 to
ensure that the solution can be backported.
@openshift-merge-robot
Copy link
Contributor

Fix included in accepted release 4.15.0-0.nightly-2023-10-31-054858

r4f4 added a commit to r4f4/installer that referenced this pull request Dec 15, 2023
requirement

Since openshift#7510, IPI installs
fail if the permission is missing:
```
level=error msg=Error: creating IAM Instance Profile (ci-op-4hw2rz1v-49c30-zt9vx-worker-profile): AccessDenied: User: arn:aws:iam::301721915996:user/ci-op-4hw2rz1v-49c30-minimal-perm is not authorized to perform: iam:TagInstanceProfile on resource: arn:aws:iam::301721915996:instance-profile/ci-op-4hw2rz1v-49c30-zt9vx-worker-profile because no identity-based policy allows the iam:TagInstanceProfile action
```
r4f4 added a commit to r4f4/installer that referenced this pull request Dec 15, 2023
requirement

Since openshift#7510, IPI installs
fail if the permission is missing:
```
level=error msg=Error: creating IAM Instance Profile (ci-op-4hw2rz1v-49c30-zt9vx-worker-profile): AccessDenied: User: arn:aws:iam::301721915996:user/ci-op-4hw2rz1v-49c30-minimal-perm is not authorized to perform: iam:TagInstanceProfile on resource: arn:aws:iam::301721915996:instance-profile/ci-op-4hw2rz1v-49c30-zt9vx-worker-profile because no identity-based policy allows the iam:TagInstanceProfile action
```
openshift-cherrypick-robot pushed a commit to openshift-cherrypick-robot/installer that referenced this pull request Jan 4, 2024
…ment

Since openshift#7510, IPI installs
fail if the permission is missing:
```
level=error msg=Error: creating IAM Instance Profile (ci-op-4hw2rz1v-49c30-zt9vx-worker-profile): AccessDenied: User: arn:aws:iam::301721915996:user/ci-op-4hw2rz1v-49c30-minimal-perm is not authorized to perform: iam:TagInstanceProfile on resource: arn:aws:iam::301721915996:instance-profile/ci-op-4hw2rz1v-49c30-zt9vx-worker-profile because no identity-based policy allows the iam:TagInstanceProfile action
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants