-
Notifications
You must be signed in to change notification settings - Fork 1
Conversation
Mend Scan Summary: ❌Repository: open-component-model/replication-controller
|
c4c6166
to
48056c0
Compare
48056c0
to
0d0d8c3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good so far. Will we add the product validation in a letter changeset?
df42142
to
e8228a0
Compare
} | ||
|
||
func (r *ComponentSubscriptionReconciler) checkComponentIsMPASEnabled(cv ocm2.ComponentVersionAccess) error { | ||
resources, err := cv.GetResourcesByResourceSelectors(compdesc.ResourceSelectorFunc(func(obj compdesc.ResourceSelectionContext) (bool, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice 👍🏻
return fmt.Errorf("failed to verify component validity: %w", err) | ||
} | ||
|
||
pub, err := r.OCMClient.SignDestinationComponent(ctx, sourceComponentVersion) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's not the component that we need to sign. it's the digest of the spec of the subscription. otherwise what's the point in having the digest?
}, | ||
} | ||
|
||
hash, err := hashstructure.Hash(obj.Spec, hashstructure.FormatV2, nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is what we should be signing
if err := r.OCMClient.TransferComponent(ctx, octx, obj, sourceComponentVersion, latestSourceComponentVersion.Original()); err != nil { | ||
err := fmt.Errorf("failed to transfer components: %w", err) | ||
status.MarkNotReady(r.EventRecorder, obj, v1alpha1.TransferFailedReason, err.Error()) | ||
if r.MpasEnabled { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need if/else here? could we not just do the validation and signature calculation if mpas is enabled and then use the same reconcile logic from that point onwards.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I'll try to simplify this a bit. Let me see what I can cook up. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah thanks. Turns out I overcomplicated it a bit... If it's an mpas component we already check if destination is there. So the code below didn't need change at all anyways. It's a lot nicer now.
6b47b78
to
564e893
Compare
564e893
to
36b5e42
Compare
Description
Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change.
What type of PR is this? (check all applicable)
Related Tickets & Documents
Screenshots
Added tests?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Added to documentation?
Checklist: