-
Notifications
You must be signed in to change notification settings - Fork 919
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
Custom CRD Download Strategy Support for Karmada Operator #5185
Conversation
65656be
to
2c6835b
Compare
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #5185 +/- ##
==========================================
+ Coverage 28.29% 28.37% +0.07%
==========================================
Files 632 632
Lines 43635 43823 +188
==========================================
+ Hits 12348 12433 +85
- Misses 30386 30486 +100
- Partials 901 904 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
bc44a76
to
2a1ab1b
Compare
@chaunceyjiang would you like to take a look? to evaluate if there is any effect on your deployment. |
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.
Generally looks good to me, thanks to @jabellard.
/assign |
Signed-off-by: Joe Nathan Abellard <[email protected]> Update crds Signed-off-by: Joe Nathan Abellard <[email protected]> Remove debug logs Signed-off-by: Joe Nathan Abellard <[email protected]> Remove debug logs Signed-off-by: Joe Nathan Abellard <[email protected]> Remove debug logs Signed-off-by: Joe Nathan Abellard <[email protected]> Remove debug logs Signed-off-by: Joe Nathan Abellard <[email protected]> Fix linting errors Signed-off-by: Joe Nathan Abellard <[email protected]> Address comments Signed-off-by: Joe Nathan Abellard <[email protected]> Update api Signed-off-by: Joe Nathan Abellard <[email protected]> Update api Signed-off-by: Joe Nathan Abellard <[email protected]> Address comments Signed-off-by: Joe Nathan Abellard <[email protected]> Address comments Signed-off-by: Joe Nathan Abellard <[email protected]> Address comments Signed-off-by: Joe Nathan Abellard <[email protected]>
5a704d2
to
1ae5bd1
Compare
/retest |
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.
/lgtm
Let's wait @chaunceyjiang for a while.
klog.V(2).InfoS("[skipCrdsDownload] CrdDownloadPolicy is 'Always', skipping cache check") | ||
return false, nil | ||
} | ||
|
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.
-
This code is not compatible with the previous behavior.
-
I believe it is necessary to be compatible with the previous behavior, as this will facilitate user upgrades.
Therefore, I suggest that this code needs to check whether the path path.Join(data.DataDir(), data.KarmadaVersion())
exists. If it does, it should also skip the CRD download."
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.
As I mentioned in your proposal earlier, we have already stored the CRD files in this path in advance. We don't want the karmada-operator to download any files from the internet.
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.
I understand your concern is about changing the cache directory, before this feature, the tarball is cached at data.DataDir()/<KarmadaVersion>
, and after this feature, the path becomes data.DataDir()/cache/<hashkey>
.
Since you embed the tarball into the image, after this change you have to adopt the new path, which probably needs to make some changes to your Dockerfile. Am I right?
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.
which probably needs to make some changes to your Dockerfile
Yes, I need to modify the Dockerfile. But I am more concerned about: I am not clear about the value of hashkey
in the path data.DataDir()/cache/<hashkey>
. It seems that every Karmada version needs to guess what this value is.
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.
The approach you're using for pre-loading the CRD tarball can still work. For instance, the CRD tarball for version v1.10.3
, by default, would be downloaded via this URL: https://github.com/karmada-io/karmada/releases/download/v1.10.3/crds.tar.gz
. To preload, just store it at location data.DataDir()/cache/<cacheKey>
, where cacheKey
is simply the SHA-256 hash of that URL. It's deterministic.
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.
I think this caching strategy works just fine and follows an approach similar to how OCI images are pulled from registries.
With this feature, although the directory structure will change to accommodate the use of custom download strategies, the use case for pre-populating the CRD in the filesystem can still easily be supported.
However, given that this design is extensible, I do think we can provide a more natural solution for this use case. Today, an HTTPSource
is supported, but, for instance, it's possible to also support a LocalFileSystemSource
that may help solve this problem more naturally, but I think that's out of scope for this PR.
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.
This is the Dockerfile we are using. How do I calculate the cacheKey
? Can I use sha256sum
?
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.
Yes.
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.
@chaunceyjiang , any other comments/concerns?
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.
Thank you for your reply.
/lgtm |
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.
It seems we have reached an agreement!
Great thanks to @jabellard for the excellent job!
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: RainbowMango The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind api-change
What this PR does / why we need it:
This is an implementation of the design outlined in this proposal.
Which issue(s) this PR fixes:
Fixes #5122
Special notes for your reviewer:
Does this PR introduce a user-facing change?: