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 10, 2017
1 parent b3570e0 commit 9ff231c
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 with no ports present. Issues may occur when bringing up artifacts.", composeServiceConfig.Labels["kompose.service.type"])
}

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

0 comments on commit 9ff231c

Please sign in to comment.