forked from LaconicNetwork/kompose
Use service name when image name is empty when build (#1213)
This commit is contained in:
@@ -74,6 +74,9 @@ var unsupportedKey = map[string]bool{}
|
||||
|
||||
// initImageStream initializes ImageStream object
|
||||
func (o *OpenShift) initImageStream(name string, service kobject.ServiceConfig, opt kobject.ConvertOptions) *imageapi.ImageStream {
|
||||
if service.Image == "" {
|
||||
service.Image = name
|
||||
}
|
||||
|
||||
// Retrieve tags and image name for mapping
|
||||
tag := GetImageTag(service.Image)
|
||||
@@ -309,6 +312,11 @@ func (o *OpenShift) Transform(komposeObject kobject.KomposeObject, opt kobject.C
|
||||
// Lastly, we must have an Image name to continue
|
||||
if opt.Build == "local" && opt.InputFiles != nil && service.Build != "" {
|
||||
|
||||
// If there's no "image" key, use the name of the container that's built
|
||||
if service.Image == "" {
|
||||
service.Image = name
|
||||
}
|
||||
|
||||
if service.Image == "" {
|
||||
return nil, fmt.Errorf("image key required within build parameters in order to build and push service '%s'", name)
|
||||
}
|
||||
@@ -329,11 +337,6 @@ func (o *OpenShift) Transform(komposeObject kobject.KomposeObject, opt kobject.C
|
||||
|
||||
}
|
||||
|
||||
// If there's no "image" key, use the name of the container that's built
|
||||
if service.Image == "" {
|
||||
service.Image = name
|
||||
}
|
||||
|
||||
// Generate pod only and nothing more
|
||||
if service.Restart == "no" || service.Restart == "on-failure" {
|
||||
// Error out if Controller Object is specified with restart: 'on-failure'
|
||||
|
||||
Reference in New Issue
Block a user