forked from LaconicNetwork/kompose
Ignore links attribute and print warning message
Signed-off-by: xianlubird@gmail.com
This commit is contained in:
@@ -73,6 +73,7 @@ func checkUnsupportedKey(composeProject *project.Project) []string {
|
|||||||
"Net": false,
|
"Net": false,
|
||||||
"Sysctls": false,
|
"Sysctls": false,
|
||||||
"Networks": false, // there are special checks for Network in checkUnsupportedKey function
|
"Networks": false, // there are special checks for Network in checkUnsupportedKey function
|
||||||
|
"Links": false,
|
||||||
}
|
}
|
||||||
|
|
||||||
// collect all keys found in project
|
// collect all keys found in project
|
||||||
@@ -120,6 +121,26 @@ func checkUnsupportedKey(composeProject *project.Project) []string {
|
|||||||
yamlTagName = "networks"
|
yamlTagName = "networks"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if linksArray := val.FieldByName(f.Name()); f.Name() == "Links" && linksArray.Kind() == reflect.Slice {
|
||||||
|
//Links has "SERVICE:ALIAS" style, we don't support SERVICE != ALIAS
|
||||||
|
findUnsupportedLinksFlag := false
|
||||||
|
for i := 0; i < linksArray.Len(); i++ {
|
||||||
|
if tmpLink := linksArray.Index(i); tmpLink.Kind() == reflect.String {
|
||||||
|
tmpLinkStr := tmpLink.String()
|
||||||
|
tmpLinkStrSplit := strings.Split(tmpLinkStr, ":")
|
||||||
|
if len(tmpLinkStrSplit) == 2 && tmpLinkStrSplit[0] != tmpLinkStrSplit[1] {
|
||||||
|
findUnsupportedLinksFlag = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !findUnsupportedLinksFlag {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
keysFound = append(keysFound, yamlTagName)
|
keysFound = append(keysFound, yamlTagName)
|
||||||
unsupportedKey[f.Name()] = true
|
unsupportedKey[f.Name()] = true
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user