-
Notifications
You must be signed in to change notification settings - Fork 771
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
Ignore links attribute and print warning message #862
Conversation
Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please follow instructions at https://github.com/kubernetes/kubernetes/wiki/CLA-FAQ to sign the CLA. It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
CNCF-CLA Done. |
@xianlubird , please fix functional test examples accordingly |
8a1b5e9
to
fe2b02f
Compare
@surajnarwade Done, pls review, thanks. |
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.
Thanks for the awesome contribution! :) Left my review!
pkg/loader/compose/compose.go
Outdated
|
||
if f.Name() == "Links" { | ||
//Links has "SERVICE:ALIAS" style, we don't support SERVICE != ALIAS | ||
if linksArray := val.FieldByName(f.Name()); linksArray.Kind() == reflect.Slice { |
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.
nested if, may be better to do if f.Name() == "Links" && if linksArray := val.FieldByName(f.Name()); linksArray.Kind() == reflect.Slice {
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.
Done
pkg/loader/compose/compose.go
Outdated
} | ||
} | ||
} | ||
if !findUnsupportedLinksFlag { |
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.
Looking at the code, I don't think this is doing anything? Since findUnsupportedLinksFlag
is outside the for i := 0; i < linksArray.Len(); i++ {
loop. I could be wrong!
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.
Thanks for your review @cdrage .
This flag findUnsupportedLinksFlag
is for the above code for _, f := range s.Fields() {
at about 100 lines this file.The flag's goal is to find compose links like
links:
- 'db:mysql'
which service name is different from alias name. If we find links like this, this flag is set to true
and code will process, keysFound = append(keysFound, yamlTagName)
this code will append links
to keysFound
and print warning messsage. But if we have links like this
links: links:
- redis - 'mysql:mysql'
There are many compose like this in our examples and test case folder. For this kind of compose ,we can convert it and shouldn't print any warning message. So in this situation, findUnsupportedLinksFlag
will set to false
, and links
will not be append to keysFound
. This code keysFound = append(keysFound, yamlTagName)
won't run because we have continue, and code will process next filed.
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.
Ah, that makes sense. LGTM.
Signed-off-by: xianlubird@gmail.com
fe2b02f
to
9b66188
Compare
LGTM |
Thanks for @cdrage @surajnarwade review. So when will this PR be merged ? |
LGTM! was just checking that this works locally on my machine. Mergin' |
Related to issue #859
Signed-off-by: xianlubird@gmail.com