Skip to content

Commit

Permalink
Failing when port is specified with labels
Browse files Browse the repository at this point in the history
Resolves #522
Kompose will give FATAL error if labels are given but ports are not defined
  • Loading branch information
surajnarwade committed May 15, 2017
1 parent 7ddce35 commit a825926
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/loader/compose/compose.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,10 @@ func (c *Compose) LoadFile(files []string) (kobject.KomposeObject, error) {
}
}

if len(serviceConfig.Port) == 0 && composeServiceConfig.Labels["kompose.service.type"] == "NodePort" || composeServiceConfig.Labels["kompose.service.type"] == "LoadBalancer" {
log.Fatalf("%s defined in service %s with no ports present. Issues may occur when bringing up artifacts.", composeServiceConfig.Labels["kompose.service.type"], name)
}

// convert compose labels to annotations
serviceConfig.Annotations = map[string]string(composeServiceConfig.Labels)
serviceConfig.CPUQuota = int64(composeServiceConfig.CPUQuota)
Expand Down

0 comments on commit a825926

Please sign in to comment.