Skip to content

improve handling of Helm index with broken helm chart versions #13176

@bb-Ricardo

Description

@bb-Ricardo

While trying to figure out the issue fluxcd/source-controller#1515 in the flux source controller of filtering chart versions from a Helm index with broken dependencies we stumbled over this issue #12748 where it has already been fixed in Helm.

On further investigation it appeared that the exclusion of invalid versions in

func loadIndex(data []byte, source string) (*IndexFile, error) {
was not ideal.

even though the copied slice cvs was adjusted to the correct size, the original slice i.Entries still remained the original size. It just contained copies of references of valid versions.

example of i.Entries before filtering:

[0xc000130f30 0xc0001315f0  0xc000131a70 0xc00021f710]

assuming chart versions at location 0xc0001315f0 and 0xc000131a70 are invalid. The content of cvs after validating the versions looked like this (which is correct):

[0xc000130f30 0xc00021f710]

But i.Entries still remains the original size:

[0xc000130f30 0xc00021f710 0xc00021f710 0xc00021f710]

Technically it does not contain any invalid version. But later on the index gets further sorted and filtered which unnecessarily contains duplicate versions.

a simple reassignment of cvs to i.Entries[name] solves this issue.

Additionally:

If the last chart in the index is malformed, it will not be removed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions