-
Notifications
You must be signed in to change notification settings - Fork 139
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
[YUNIKORN-2287] Decompress function doesn't need to decode base64 #752
Conversation
f04525e
to
65fea0d
Compare
65fea0d
to
24c699f
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #752 +/- ##
==========================================
+ Coverage 71.30% 71.32% +0.02%
==========================================
Files 43 43
Lines 7600 7592 -8
==========================================
- Hits 5419 5415 -4
+ Misses 1979 1976 -3
+ Partials 202 201 -1 ☔ View full report in Codecov by Sentry. |
60037a6
to
04a43c3
Compare
@FrankYang0529 I have another idea before reviewing. If this function is never in production, can we just get rid of it to simplify our code base? @wilfred-s @craigcondit WDYT? |
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.
minor tweaks, see comment in the jira would be nice to document why the decode is removed
@@ -0,0 +1,33 @@ | |||
#Licensed to the Apache Software Foundation (ASF) under one |
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.
space between # and the wording on all lines
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.
Other test data also need to add space to it. Do we want to fix this together in this PR?
https://github.com/apache/yunikorn-k8shim/blob/master/test/e2e/testdata/sleeppod_template.yaml
metadata: | ||
name: yunikorn-configs | ||
binaryData: | ||
# echo " |
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.
Explain what this commented info is about
@wilfred-s did you feel that decode is a kind of behavior change of k8s? This yunikorn feature is already existent for a period of time. We have to keep compatibility for previous k8s if previous k8s does not do base64 decoding. If the base64 decoding happens way down in the k8s always, it seems we have not got binarydata work in yunikorn. That is to say, that yunikorn feature is nonexistent actually :) In short, removing this feature seems to be acceptable. The benefit includes
|
Oh, the PR #675 got merged into 1.4.0 on 2023.09.19 My compatibility concern was redundant as the target k8s is almost equal to current version. It seems there is no +1 on removing this feature, and maintaining this feature is ok to me. @FrankYang0529 please address the comments and I will take a look later also. |
I don't have a good reference to show why the configmap in Golang object is already decoded, but I may be able to proof that if object from our utility function GetConfigMapObj is decoded, then object from CoreV1().ConfigMaps(namespace).Get is decoded too. The reason is that both functions use same serializers. GetConfigMapObj
CoreV1().ConfigMaps(namespace).Get
If we can proof the
Finally, |
I think there's more than enough comments in the JIRA relating to why this is not needed. Removing an unnecessary line of code from the PR doesn't warrant a comment either. What would it mean to a reader a year from now? (probably nothing at all). |
@FrankYang0529 could you please fix the conflicts? |
04a43c3
to
1b11082
Compare
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.
@FrankYang0529 thanks for this fix. please take a look at following comments.
1b11082
to
091069d
Compare
@FrankYang0529 please rebase PR as #761 is already merged. |
091069d
to
ab813b6
Compare
The e2e failed case 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.
@FrankYang0529 thanks for updating patch. a couple of comments below.
test/e2e/configmap/configmap_test.go
Outdated
Ω(oldConfigMap).NotTo(BeNil()) | ||
}) | ||
|
||
It("Verify_Compressed_ConfigMap", func() { |
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 to me this e2e should focus on the way that YuniKorn loads the config file. Hence, loading the file is more suitable for this e2e rather than creating a compressed file directly. WDYT?
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.
Do you mean that we just use Verify_Compressed_ConfigMap_From_File
and remove Verify_Compressed_ConfigMap
?
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.
yep, it seems we should remove Verify_Compressed_ConfigMap
and then add a new e2e to load non-compressed config file.
@FrankYang0529 please fix conflicts and rebase code |
ab813b6
to
5a11535
Compare
pkg/conf/schedulerconf.go
Outdated
splitKey := strings.Split(key, ".") | ||
compressionAlgo := splitKey[len(splitKey)-1] | ||
if strings.EqualFold(compressionAlgo, constants.GzipSuffix) { | ||
reader := bytes.NewReader(decodedValue) | ||
reader := bytes.NewReader(value) | ||
gzReader, err := gzip.NewReader(reader) |
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.
How about gzReader, err := gzip.NewReader(bytes.NewReader(value))
?
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, updated it. Thank you.
Signed-off-by: PoAn Yang <[email protected]>
5a11535
to
7a21656
Compare
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
What is this PR for?
Fix
Decompress
function and check the following case can run:queues.yaml.gz
inbinaryData
field.What type of PR is it?
What is the Jira issue?
https://issues.apache.org/jira/browse/YUNIKORN-2287
How should this be tested?
Covered by e2e test.