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

RFC-0005: introduction of Digest and change of Revision format #1001

Merged
merged 17 commits into from
Feb 14, 2023

Conversation

hiddeco
Copy link
Member

@hiddeco hiddeco commented Jan 18, 2023

This PR introduces the changes described in RFC-0005, effectively deprecating the Checksum field of the Artifact in favor of the newly introduced Digest. While also changing the format of the Revision field for values containing a named-pointer and/or checksum.

  • API: Introduce Digest field in Artifact
  • API: Introduce TransformLegacyRevision to help (consumers) transitioning to the new revision format
  • Calculate Digest for Artifact when stored in Storage
  • Include Digest from Artifact in event metadata
  • Change Revision format for GitRepository
  • Change Revision format for Bucket
  • Change Revision format for OCIRepository
  • Change Revision format for HelmRepository
  • Allow configuration of digest algorithm using flag
  • Document specs

@hiddeco hiddeco added enhancement New feature or request area/storage Storage related issues and pull requests labels Jan 18, 2023
@hiddeco hiddeco force-pushed the artifact-digest branch 3 times, most recently from 583a3ff to bdd0717 Compare January 18, 2023 12:00
@hiddeco hiddeco force-pushed the artifact-digest branch 4 times, most recently from 9a6d422 to 460ed45 Compare February 8, 2023 13:50
@hiddeco hiddeco force-pushed the artifact-digest branch 5 times, most recently from 4e43e5e to 8252ce1 Compare February 9, 2023 16:54
@hiddeco hiddeco marked this pull request as ready for review February 9, 2023 17:00
api/v1beta2/artifact_types.go Outdated Show resolved Hide resolved
controllers/helmrepository_controller.go Outdated Show resolved Hide resolved
As discussed in RFC-0005, this introduces a `Digest` field to the
`Artifact` in favor of the now deprecated `Checksum`.

Signed-off-by: Hidde Beydals <hello@hidde.co>
Copy link
Member

@stefanprodan stefanprodan left a comment

Choose a reason for hiding this comment

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

LGTM

Thanks @hiddeco 🏅

Signed-off-by: Hidde Beydals <hello@hidde.co>
Signed-off-by: Hidde Beydals <hello@hidde.co>
This algorithm is used by Git commit SHAs, and opens up the digest API
to work with these references.

Signed-off-by: Hidde Beydals <hello@hidde.co>
Signed-off-by: Hidde Beydals <hello@hidde.co>
Signed-off-by: Hidde Beydals <hello@hidde.co>
This ensures the revision is correctly parsed for `Bucket` and
`GitRepository` sources from which a chart is built, either in the
legacy or new RFC-0005 format.

Signed-off-by: Hidde Beydals <hello@hidde.co>
Signed-off-by: Hidde Beydals <hello@hidde.co>
Signed-off-by: Hidde Beydals <hello@hidde.co>
This allows consumers to better handle the transition to the new
RFC-0005 format ("/" -> "@" separation).

Signed-off-by: Hidde Beydals <hello@hidde.co>
Signed-off-by: Hidde Beydals <hello@hidde.co>
This includes changes to the `ChartRepository`, to allow calculating
the revision and digest and tidy things.

In addition, the responsibility of caching the `IndexFile` has been
moved to the reconcilers. As this allowed to remove a lot of
complexities within the `ChartRepository`, and prevented passing on
the cache in general.

Change `HelmRepository`'s Revision to digest

Signed-off-by: Hidde Beydals <hello@hidde.co>
Signed-off-by: Hidde Beydals <hello@hidde.co>
Signed-off-by: Hidde Beydals <hello@hidde.co>
Signed-off-by: Hidde Beydals <hello@hidde.co>
Resolving it to a local path does not make it more unique, while
resulting in longer keys and a lot of safejoin calls.

Signed-off-by: Hidde Beydals <hello@hidde.co>
Signed-off-by: Hidde Beydals <hello@hidde.co>
Copy link
Contributor

@darkowlzz darkowlzz left a comment

Choose a reason for hiding this comment

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

LGTM!

@hiddeco hiddeco merged commit e24ce86 into main Feb 14, 2023
@hiddeco hiddeco deleted the artifact-digest branch February 14, 2023 13:42
hiddeco added a commit that referenced this pull request Feb 22, 2023
In #1001 bits around the Helm repository reconciliation logic were
rewritten, mostly based on the documented behavior instead of the
actual code. This resulted in the reintroduction of a YAML marshal of
the (sorted) index YAML instead of reliance of just the checksum of the
file.

This to take situations into account in which a repository would e.g.
provide a new random order on every generation. However, this approach
is (extremely) expensive as the marshal goes through a JSON -> YAML
loop, eating lots of RAM in the process.

As the further (silently) introduced behavior has not resulted in any
reported issues, I deem this approach safe and better than e.g.
encoding to just JSON which would still require a substantial amount of
memory.

Signed-off-by: Hidde Beydals <hello@hidde.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/storage Storage related issues and pull requests enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants