question

gopimails avatar image
0 Votes"
gopimails asked VictorVelghe-6569 edited

iotedge deployment set module environment value per device for multidevice deployment

Looking for workarounds here

I am creating a single edge deployment with target condition tags.environment = 'pilot'. This target condition results to multiple edge devices.

Requirement: I need to have unique module environment value per device.
Problem : I only have one deployment.json in this case and can only set environment value once that will apply for all devices->modules.

Straight alternative : I can use individual deployments targeting individual devices. Allowing me to have separate deployment jsons which can have unique module environment value per device. This alternative is doable; but preferring a deployment targeting multiple edge devices.

azure-iot-edge
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

asergaz avatar image
1 Vote"
asergaz answered gopimails commented

Hello @GopikrishnanBahuleyan-2250 ,
Want to be sure that you have looked at the following doc?:

Specifically the section Layered deployment may be the solution for your scenario.

"Layered deployments are automatic deployments that can be combined together to reduce the number of unique deployments that need to be created. Layered deployments are useful in scenarios where the same modules are reused in different combinations in many automatic deployments."

50012-image.png


Thank you.

Remember:
- Please accept an answer if correct. Original posters help the community find answers faster by identifying the correct answer. Here is how.
- Want a reminder to come back and check responses? Here is how to subscribe to a notification.




image.png (108.4 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @asergaz

Thank you for this. But I dont think layered deployment will solve my need.
I want to provide different values to an environment variable (of a module) per device and layered deployment will not offer that option. Infact layer deployment is not meant to cater that kind of a need.

0 Votes 0 ·
gopimails avatar image
0 Votes"
gopimails answered asergaz commented

For this odd need, I think Docker CMD could be choice. And I am trying to use it. This would give an option to set a new value to an environment variable and module instance could use it.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@GopikrishnanBahuleyan-2250 do you mean you want to use createOptions parameter ?

https://docs.microsoft.com/en-us/azure/iot-edge/how-to-use-create-options?view=iotedge-2018-06

This still needs to be configured in the deployment manifest of each module...

Thanks!

0 Votes 0 ·
VictorVelghe-6569 avatar image
0 Votes"
VictorVelghe-6569 answered VictorVelghe-6569 edited

Hi,

I'm hurting the same issue. I'm using layered deployment for multi-devices.

I need my deployment to use device specific values.

I cannot use the createOptions from the deployment since it's not device specific.

Is there a way to inject ENV variables in a device? In the /etc/iotedge/config.yaml?

Where come from those ENV variables?
IOTEDGE_DEVICEID
IOTEDGE_GATEWAYHOSTNAME
IOTEDGE_IOTHUBHOSTNAME
...

Can I add one?

Or Is it possible to use device's tags in a module?

Thanks for you help!

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.