Skip to content

Commit

Permalink
Ignore links attribute and print warning message
Browse files Browse the repository at this point in the history
Signed-off-by: xianlubird@gmail.com
  • Loading branch information
xianlubird authored and xianlu committed Nov 7, 2017
1 parent c7964e7 commit fe2b02f
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions pkg/loader/compose/compose.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ func checkUnsupportedKey(composeProject *project.Project) []string {
"Net": false,
"Sysctls": false,
"Networks": false, // there are special checks for Network in checkUnsupportedKey function
"Links": false,
}

// collect all keys found in project
Expand Down Expand Up @@ -120,6 +121,28 @@ func checkUnsupportedKey(composeProject *project.Project) []string {
yamlTagName = "networks"
}
}

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 {
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)
unsupportedKey[f.Name()] = true
}
Expand Down

0 comments on commit fe2b02f

Please sign in to comment.