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

Add recursive-related-bundles endpoint #422

Merged
merged 1 commit into from
Sep 14, 2022
Merged

Conversation

yashvardhannanavati
Copy link
Collaborator

Refers to CLOUDDST-14678

@yashvardhannanavati
Copy link
Collaborator Author

@release-engineering/exd-guild-hello-operator Can I please request a review on the approach being used to get recursive-related-bundles?

Tests and documentation changes are coming up..

@yashvardhannanavati yashvardhannanavati force-pushed the recursive_regenerate_bundle branch 4 times, most recently from b5c7698 to 6dbe8b2 Compare September 1, 2022 13:20
docker-compose.yml Outdated Show resolved Hide resolved
iib/web/api_v1.py Outdated Show resolved Hide resolved
iib/web/config.py Outdated Show resolved Hide resolved
iib/workers/config.py Show resolved Hide resolved
@yashvardhannanavati yashvardhannanavati force-pushed the recursive_regenerate_bundle branch 3 times, most recently from d9a194a to 1abe1ef Compare September 3, 2022 00:00
iib/web/api_v1.py Outdated Show resolved Hide resolved
@yashvardhannanavati yashvardhannanavati force-pushed the recursive_regenerate_bundle branch from 1abe1ef to 6d22f29 Compare September 8, 2022 04:21
@@ -87,6 +87,7 @@ services:
- ./docker/message_broker/certs:/broker-certs:ro,z
- request-logs-volume:/var/log/iib/requests:z
- request-related-bundles-volume:/var/lib/requests/related_bundles:z
- request-recursive-related-bundles-volume:/var/lib/requests/recursive_related_bundles:z
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you planning on getting this merged before or after #421? The latter one will need to be updated after merging the former.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes, I am since this one is a bigger change

@login_required
def recursive_related_bundles():
"""
Submit a request to get nested related bundles of an operator bundle image in a DFS manner.
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we note here that it is a post-order traversal? Somewhere else? We don't want in-order or pre-order traversals as either of these can have the parent before the children.

Copy link
Collaborator Author

@yashvardhannanavati yashvardhannanavati Sep 12, 2022

Choose a reason for hiding this comment

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

hm, actually I implemented a level order traversal. So all child nodes will appear first in the list . And, I agree we should mention it here and somewhere in the docs. On it.

Copy link
Contributor

Choose a reason for hiding this comment

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

a reversed level-order traversal? I get lost in all of the possible variants... especially when you diverge from the "named ones" . If you write it, I am sure that it will be sufficient.

metadata_path = os.path.join(temp_dir, 'metadata')
_copy_files_from_image(bundle_image_resolved, '/metadata', metadata_path)
if organization:
_adjust_operator_bundle(manifests_path, metadata_path, request_id, organization)
Copy link
Contributor

Choose a reason for hiding this comment

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

I assume that you want to do this so that you can modify any pullspecs to ensure that they are actually pullable so that you can then get_related_bundle_images later.

This will process all operations requested for the organization. If an organization has multiple registry_replacements customizations specified, however, intermediate actions to make images pullable might be overruled by later operations to change the registry to a final (and not yet valid) pullspec.

Assuming that the organizations are properly configured, they can specify the related_bundles type at a location where the images can be pulled. We should have that process cache off the related bundles so that we can then read from that cache when we call it again lower.

Copy link
Contributor

Choose a reason for hiding this comment

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

Out of band, you commented that we don't need the pullspecs to be resolvable, but we do. As part of the later function call get_related_bundle_images(bundle_metadata), we need to be able to get the image labels to determine whether the related image is a bundle or not:

    for related_pullspec_obj in bundle_metadata['found_pullspecs']:
        related_pullspec = related_pullspec_obj.to_str()
        if yaml.load(
            get_image_label(related_pullspec, 'com.redhat.delivery.operator.bundle') or 'false'
        ):
            related_bundle_images.append(related_pullspec)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

As discussed on the call, I have made the changes to terminate adjusting the opertor bundle when related_bundles customization is reached.

@yashvardhannanavati yashvardhannanavati force-pushed the recursive_regenerate_bundle branch 2 times, most recently from 1fc564e to 6ead456 Compare September 13, 2022 00:23
@lipoja lipoja self-requested a review September 13, 2022 14:21
@lipoja
Copy link
Contributor

lipoja commented Sep 13, 2022

The code looks good to me. Do we want to release it since you are saying "Tests and documentation changes are coming up.." ... are these unit tests enough or do we want to have iib-api-tests before release?

@yashvardhannanavati
Copy link
Collaborator Author

@lipoja I have now added tests and doc changes too. I think this is good to go

lipoja
lipoja previously approved these changes Sep 13, 2022
iib/workers/tasks/build_recursive_related_bundles.py Outdated Show resolved Hide resolved
iib/workers/tasks/build_regenerate_bundle.py Outdated Show resolved Hide resolved
iib/workers/tasks/build_regenerate_bundle.py Outdated Show resolved Hide resolved
iib/workers/tasks/build_regenerate_bundle.py Show resolved Hide resolved
@yashvardhannanavati
Copy link
Collaborator Author

@lipoja I had a chat with @arewm and he has given a +1 to go ahead with the merge. I made the changes he requested. Could you please re-approve and merge this when you come online?

Refers to CLOUDDST-14678
@yashvardhannanavati yashvardhannanavati force-pushed the recursive_regenerate_bundle branch from 5d931f2 to ad2b3fb Compare September 14, 2022 04:25
@lipoja lipoja merged commit 34042fb into master Sep 14, 2022
@lipoja lipoja deleted the recursive_regenerate_bundle branch September 14, 2022 08:02
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.

4 participants