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

Sync each app when fetched rather than waiting. #6825

Merged
merged 5 commits into from Sep 19, 2023

Conversation

absoludity
Copy link
Contributor

@absoludity absoludity commented Sep 15, 2023

Description of the change

Follows on from #6804, this PR updates so that the actual Syncing happens per chart+versions, rather than at the end of the process. Much of the change is refactoring functions that worked with slices of charts to work with a chart instead. The complexity is the actual refactoring of the sync, requiring channels to iterate on the results etc.

Benefits

We'll be able no have results in the UX much more quickly (important with OCI imports, which take longer without a big index.yaml to simply parse).

Possible drawbacks

Currently this will not work as expected, as two more changes are required:

  1. Need to update the existing chart versions for a chart, rather than re-writing them (with only the chart versions that were synced, as it will do now). DONE
  2. Need to collect the charts to be deleted and pass those explicitly, rather than deleting all charts that are not in the current set being synced (which it currently does - as this worked when syncing everything). DONE

Applicable issues

Additional information

Last PR to follow.

Base automatically changed from 6706-sync-public-oci-repo-3 to main September 19, 2023 04:33
Signed-off-by: Michael Nelson <minelson@vmware.com>
Signed-off-by: Michael Nelson <minelson@vmware.com>
@netlify
Copy link

netlify bot commented Sep 19, 2023

Deploy Preview for kubeapps-dev canceled.

Name Link
🔨 Latest commit 98a60ab
🔍 Latest deploy log https://app.netlify.com/sites/kubeapps-dev/deploys/65093b4e7225870009cd5ac2

### Description of the change

Currently ensures that the existing (already synced) chart versions are
included when syncing new chart versions, so that the full set of data
is retained in the DB (since the chart versions aren't actually rows in
the db, but rather within a json blob of the chart).

This PR refactored the way the syncing happens, specifically ensuring
that data is synced to the db as each chart is processed, rather than
when all charts are synced (so that we get better feedback in the UI
when syincing OCI repos).


### Benefits

Before the change:
- a shallow + deep sync of the non-OCI Helm repo takes around 7s
- a shallow sync of the Bitnami OCI repo would see us hitting the rate
limit and getting 429s.

With the changes,
- a shallow + deep sync of a non-OCI Helm repo takes around 10s (extra
overhead of sycing to the DB for each chart)
- a shallow sync of the Bitnami OCI repo takes 2 minutes and a syncing
the next 5 versions for each chart takes a further 2 minutes (and does
not excessively hammer the dockerhub distribution spec API to get
banned). (should remove the shallow and just always do 5, also should
test 10).

### Possible drawbacks

Currently:
- ~~Something not correct with the db info being synced as getting
`Unable to get the available package detail for the package
"testoci2/airflow" using the plugin "helm.packages": internal: Unable to
retrieve chart files: sql: no rows in result set`~~ Fixed - it was a
synchronization issue that left the sync process finishing after charts
were synced but before files were synced.
- ~~OCI catalog is taking a *long* time to display (shouldn't be
affected, getting info from the DB).~~ This was a resource issue
locally.

~~So still more investigation here needed.~~

### Applicable issues

<!-- Enter any applicable Issues here (You can reference an issue using
#) -->

- fixes #6706 

### Additional information

<!-- If there's anything else that's important and relevant to your pull
request, mention that information here.-->

---------

Signed-off-by: Michael Nelson <minelson@vmware.com>
Signed-off-by: Michael Nelson <minelson@vmware.com>
Signed-off-by: Michael Nelson <minelson@vmware.com>
@absoludity absoludity merged commit 2c8176d into main Sep 19, 2023
42 checks passed
@absoludity absoludity deleted the 6706-sync-public-oci-repo-4 branch September 19, 2023 06:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants