Skip to content

Read component descriptor from oci registry #2601

@ruanxin

Description

@ruanxin

Description

With #2634 and #2597 finished, KLM is able to construct ocm remote address without depending on ModuleTemplate, and fetch component descriptor remotely.

Going forward, we will get:

DEV Note

  • right now we are taking the descriptor directly from the template:
    func (c *CachedDescriptorProvider) GetDescriptor(template *v1beta2.ModuleTemplate) (*types.Descriptor, error) {
    if template == nil {
    return nil, ErrTemplateNil
    }
    if template.Spec.Descriptor.Object != nil {
    desc, ok := template.Spec.Descriptor.Object.(*types.Descriptor)
    if !ok {
    return nil, ErrTypeAssert
    }
    if desc == nil {
    return nil, ErrDescriptorNil
    }
    return desc, nil
    }
    key := cache.GenerateDescriptorKey(template)
    descriptor := c.DescriptorCache.Get(key)
    if descriptor != nil {
    return descriptor, nil
    }
    ocmDesc, err := compdesc.Decode(
    template.Spec.Descriptor.Raw, []compdesc.DecodeOption{compdesc.DisableValidation(true)}...,
    )
    if err != nil {
    return nil, errors.Join(ErrDecode, err)
    }
    template.Spec.Descriptor.Object = &types.Descriptor{ComponentDescriptor: ocmDesc}
    descriptor, ok := template.Spec.Descriptor.Object.(*types.Descriptor)
    if !ok {
    return nil, ErrTypeAssert
    }
    return descriptor, nil
    }
    • this needs to be refactored to look it up from the registry with the information described above
  • GetDescriptor is used by regular Kyma reconciler + mandatory installation and deletion reconcilers already
    • the signature will need to be changed as it currently accepts a ModuleTemplate

Reasons

unblock deprecating component descriptor from ModuleTemplate.

Acceptance Criteria

  • Refactor CachedDescriptorProvider, make sure it fetches and caches component descriptor from remote oci registry instead of from ModuleTemplate.

Feature Testing

No response

Testing approach

No response

Attachments

No response

Metadata

Metadata

Labels

kind/featureCategorizes issue or PR as related to a new feature.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions