-
Notifications
You must be signed in to change notification settings - Fork 22
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
Resource resolution on CD set #865
Conversation
Please confirm if I understand this correctly. Given a component version and a resolver that is configured with all the component descriptors from a references of the component version ( plus any references that have been references by the references ) we can now get a Resource and a descriptor using this single resolver? |
So the current method of recursive lookup for a Resource is simply doing this: identities = append(identities, resource.ReferencePath...)
res, _, err := utils.ResolveResourceReference(
cva,
ocmmetav1.NewNestedResourceRef(ocmmetav1.NewIdentity(resource.Name), identities),
cva.Repository(),
)
if err != nil {
return nil, "", -1, fmt.Errorf(
"failed to resolve reference path to resource: %s %w",
resource.Name,
err,
)
} Given an identity with the referencePath and the root component that function just simply figured out where the resource is given the path. With this approach, and please correct me if I'm wrong, we have to construct a Set ( which needs all of the component descriptors from all the nested references), then a resolver for that set then call ResolveResourcePath and get our resource. Is that correct? If yes, then it looks like we already done the work of gathering the component descriptors and at that point we would just fetch the resource ourselves. |
Yes, there is basically just a second resolution environment for component descriptors similar to the already existing one working on This environment is in package
These elements are 1:1 mappings of the current ones (in Both environments work on the standard Example:
So, if the K8s Component resource provides the serialized set of CDs along the ref hierarchy, May be, we have to provide a dedicated verification method, which takes the given artifact normalization into account for verifying the digest. I think, so far this is hard wired in the signature validation. I'll check tomorrow... |
083055f
to
e426c72
Compare
I added a new function |
Okay, sure, however, my question was, that we already have a utils method that resolves and finds the right resource given an extra identity component path and the root component without the need for the resolvers and the set and the extra implementation of finding all of the component versions and putting them into the set. So I was wondering what is the benefit of this implementation over the simple Is it that if we parse all of the |
@Skarlso , exactly, if the k8s resource |
Gotcha, that makes sense. Thanks for the clarification. |
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.
A few remarks and a question regarding the new store.
c68cd81
to
b5b0743
Compare
What this PR does / why we need it:
Introduction resolution of relative resource references of the level of component descriptors.
So far, this the resolution was only possible on the level of the complete component version access abstraction.
This PR adds such a functionality on the level of plain component descriptors.
Therefore, it provides a
ComponentVersionResolver
abstraction for component descriptors, with twoimplementations: a set of component descriptors and a compound resolver similar to the one for component version accesses.
To align the element names in package
compdesc
, theComponentReference
ans been renamed toReference
(likeResource
andSource
). The old type has been deprecated.This functionality is required for the OCM controllers working an deep resources for a component version.
To verify the digest of the retrieved content of a resource, a new function
signing.VerifyResourceDigest(cv, index, content)
is provided. it uses the digesting type described by the component version to recalculate the digest of the retrieved resource and verify it against the digest described by the component version.