f-m-p question: multiple containers in deployment.yml

61 views
Skip to first unread message

Роман Рыбалкин

unread,
Aug 1, 2017, 11:29:25 AM8/1/17
to fabric8
Hi,

Is it possible to configure a such case:
Create a pod with 2 containers, when both of them use the project's image with only different set of env variables?

I've tried just to add an additional container to the existed one inside fabric8/deployment.yml resource and it's failed with a build error:
[ERROR] Failed to execute goal io.fabric8:fabric8-maven-plugin:3.2.26:resource (fmp) on project my-project: Execution fmp of goal io.fabric8:fabric8-maven-plugin:3.2.26:resource failed: Container my-project-second has no Docker image configured. Please check your Docker image configuration (including the generators which are supposed to run)
I expected fabric8 puts the project's image name like it does for the project (first) container.

If put "image" property manually it works fine, but it's not desired case.

The version of f-m-p: 3.2.26

Thanks in advance!

James Strachan

unread,
Aug 1, 2017, 11:36:05 AM8/1/17
to Роман Рыбалкин, fabric8
On 1 August 2017 at 16:29, Роман Рыбалкин <roman.ry...@gmail.com> wrote:
Hi,

Is it possible to configure a such case:
Create a pod with 2 containers, when both of them use the project's image with only different set of env variables?

not OOTB no but you should be able to just create additional containers with the ${project.artifactId} image name etc.

Though it does sound kinda wacky - are you sure you want to do that?  e.g. Why not just create 2 pods?

 
I've tried just to add an additional container to the existed one inside fabric8/deployment.yml resource and it's failed with a build error:
[ERROR] Failed to execute goal io.fabric8:fabric8-maven-plugin:3.2.26:resource (fmp) on project my-project: Execution fmp of goal io.fabric8:fabric8-maven-plugin:3.2.26:resource failed: Container my-project-second has no Docker image configured. Please check your Docker image configuration (including the generators which are supposed to run)
I expected fabric8 puts the project's image name like it does for the project (first) container.

If put "image" property manually it works fine, but it's not desired case.

The version of f-m-p: 3.2.26

btw 3.2 is quite old you may wanna try a newer version. You may need to explicitly list 2 containers in the deployment.yml to avoid fmp getting confused?
--
James
-------
Red Hat

Twitter: @jstrachan
Email: james.s...@gmail.com
Blog: https://medium.com/@jstrachan/

open source development platform

open source event based lambda programming

Роман Рыбалкин

unread,
Aug 1, 2017, 11:55:26 AM8/1/17
to fabric8, roman.ry...@gmail.com
Thanks for a quick response, James!

The initial case is to run 2 instances of the service (project itself represents the service) with 2 different sets of env variables. We use fmp to buil the docker image and generate kubernetes deployment configuration.
So that I've asked about deployment.yml resource for fabric8.

I'm not familiar with all fmp features, is it possible to generate 2 different k8s deployments for one project and then deploy them as 2 different pods?

James Strachan

unread,
Aug 1, 2017, 12:00:19 PM8/1/17
to Роман Рыбалкин, fabric8
yeah, I'd be tempted to create 1 maven module and 1 app with one set of env vars then create another maven module which depends on the former and overrides some values but reuses the same docker image; then you've 2 separate services you can deploy independently and scale separately

--
You received this message because you are subscribed to the Google Groups "fabric8" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fabric8+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages