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

Wif creation improvements, including logic to grant support access as part of wif creation. #666

Merged
merged 5 commits into from
Sep 17, 2024

Conversation

renan-campos
Copy link
Collaborator

@renan-campos renan-campos commented Sep 16, 2024

These changes were pushed last week as part of #663, but needed to be reverted due to a timing-related issue on the GCP side.

The issue was investigated and determined to be as follows. The service account is created with an iam api call, but the binding of roles to the service account is made with a cloudresourcemanager api call. It was found that there is a window of time in which the service account created is not yet visible to cloudresourcemanager, resulting in sporadic BadRequest errors. This PR reintroduces the functionality with an additional mechanism to make wif creation robust to these out-of-sync issues.

Additionally there is an improvement to the logic used to determine if a custom role should be updated. I was finding that the osd_deployer_v4.17 role was getting updated every time I called wif create. This was caused by the list of permissions not being in alphabetical order. The new logic will only update the role if the existing and proposed permissions do not have the same elements, regardless of order.

To test this, the following bash command was run. After the changes, the BadRequest errors previously received were not experienced.

for id in $(awk 'BEGIN{for (i=1;i<10;i++) print "rc-"i}') ; do ./ocm gcp create wif-config --name $id --project $project_id; done

@renan-campos renan-campos self-assigned this Sep 16, 2024
Copy link
Contributor

@JakobGray JakobGray left a comment

Choose a reason for hiding this comment

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

lgtm. In the future I think we could improve the helper to only retry based on the type of GCP error we get

The prior check was lead to custom roles being updated during every wif
creation call if the permission set provided was not in the exact order
that is returned by GCP- emperically found to be alphabetical. With this
change, this assumption is no longer necassary.
…figuration

It was discovered through testing that service accounts created on GCP
need a duration of time between creation and being referenced, otherwise
a BadRequest error occurs. A delayed retry logic is introduced to ensure
the service account is available before making additional configuration
calls.
@renan-campos renan-campos merged commit 7cddc94 into openshift-online:main Sep 17, 2024
4 checks passed
ckandag added a commit that referenced this pull request Oct 15, 2024
-e034b6b Update Konflux references to 2418e94
-5066ea0 Filter wif configs in interactive mode (#660)
-878f5e3 Initial refactor to prepare to move the connection builder and config packages to ocm-common
-1ea2e05 lint
-2c66dc0 removes redundant api url
-65bf8cf Add role prefix flag on create wif-config (#662)
-a39ce2e Grant access to support group during WifConfig creation (#663)
-0275d67 Revert "Grant access to support group during WifConfig creation (#663)" (#664)
-7cddc94 Wif creation improvements, including logic to grant support access as part of wif creation. (#666)
-7f41626 Update Konflux references
-b9a750c UpdatesToKonflux (#668)
-e4aa770 OCM-10615 | Implement 'gcp wif-config update' command (#667)
-cf6e500 Dry-run wif config delete before tearing down cloud resources (#670)
-e18ea10 OCM-11842 | feat: Updates to support GCP-PSC clusters (#672)
-893acd5 wif-enable gcp-inquiries (#673)
-664b2c4 Replace wif dry-run flag with mode (#671)
-df87894 Update Konflux references (#669)
@ckandag ckandag mentioned this pull request Oct 15, 2024
renan-campos pushed a commit that referenced this pull request Oct 15, 2024
-e034b6b Update Konflux references to 2418e94
-5066ea0 Filter wif configs in interactive mode (#660)
-878f5e3 Initial refactor to prepare to move the connection builder and config packages to ocm-common
-1ea2e05 lint
-2c66dc0 removes redundant api url
-65bf8cf Add role prefix flag on create wif-config (#662)
-a39ce2e Grant access to support group during WifConfig creation (#663)
-0275d67 Revert "Grant access to support group during WifConfig creation (#663)" (#664)
-7cddc94 Wif creation improvements, including logic to grant support access as part of wif creation. (#666)
-7f41626 Update Konflux references
-b9a750c UpdatesToKonflux (#668)
-e4aa770 OCM-10615 | Implement 'gcp wif-config update' command (#667)
-cf6e500 Dry-run wif config delete before tearing down cloud resources (#670)
-e18ea10 OCM-11842 | feat: Updates to support GCP-PSC clusters (#672)
-893acd5 wif-enable gcp-inquiries (#673)
-664b2c4 Replace wif dry-run flag with mode (#671)
-df87894 Update Konflux references (#669)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants