From d2b91b073ebb274a43ac5c4e741794c520059d15 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 16 Oct 2022 12:22:33 +0200 Subject: [PATCH 01/10] Bump Microsoft.EntityFrameworkCore.Relational in /src (#1350) Bumps [Microsoft.EntityFrameworkCore.Relational](https://github.com/dotnet/efcore) from 6.0.9 to 6.0.10. - [Release notes](https://github.com/dotnet/efcore/releases) - [Commits](https://github.com/dotnet/efcore/compare/v6.0.9...v6.0.10) --- updated-dependencies: - dependency-name: Microsoft.EntityFrameworkCore.Relational dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .../AzureIoTHub.Portal.Infrastructure.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AzureIoTHub.Portal.Infrastructure/AzureIoTHub.Portal.Infrastructure.csproj b/src/AzureIoTHub.Portal.Infrastructure/AzureIoTHub.Portal.Infrastructure.csproj index 0d7bd3d03..a2c4e16e3 100644 --- a/src/AzureIoTHub.Portal.Infrastructure/AzureIoTHub.Portal.Infrastructure.csproj +++ b/src/AzureIoTHub.Portal.Infrastructure/AzureIoTHub.Portal.Infrastructure.csproj @@ -15,7 +15,7 @@ - + From 742f58d44900ffe7c3af785de3e854abbb81e2c5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 16 Oct 2022 12:50:25 +0200 Subject: [PATCH 02/10] Bump Microsoft.EntityFrameworkCore.InMemory from 6.0.9 to 6.0.10 in /src (#1353) Bumps [Microsoft.EntityFrameworkCore.InMemory](https://github.com/dotnet/efcore) from 6.0.9 to 6.0.10. - [Release notes](https://github.com/dotnet/efcore/releases) - [Commits](https://github.com/dotnet/efcore/compare/v6.0.9...v6.0.10) --- updated-dependencies: - dependency-name: Microsoft.EntityFrameworkCore.InMemory dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .../AzureIoTHub.Portal.Infrastructure.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AzureIoTHub.Portal.Infrastructure/AzureIoTHub.Portal.Infrastructure.csproj b/src/AzureIoTHub.Portal.Infrastructure/AzureIoTHub.Portal.Infrastructure.csproj index a2c4e16e3..c9ac200d4 100644 --- a/src/AzureIoTHub.Portal.Infrastructure/AzureIoTHub.Portal.Infrastructure.csproj +++ b/src/AzureIoTHub.Portal.Infrastructure/AzureIoTHub.Portal.Infrastructure.csproj @@ -11,7 +11,7 @@ - + From b6bfd2d53cbbbd0635b131ed45199e9c72469e3f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 16 Oct 2022 12:53:27 +0200 Subject: [PATCH 03/10] Bump Microsoft.EntityFrameworkCore.Design from 6.0.9 to 6.0.10 in /src (#1349) Bumps [Microsoft.EntityFrameworkCore.Design](https://github.com/dotnet/efcore) from 6.0.9 to 6.0.10. - [Release notes](https://github.com/dotnet/efcore/releases) - [Commits](https://github.com/dotnet/efcore/compare/v6.0.9...v6.0.10) --- updated-dependencies: - dependency-name: Microsoft.EntityFrameworkCore.Design dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .../AzureIoTHub.Portal.Infrastructure.csproj | 2 +- src/AzureIoTHub.Portal/Server/AzureIoTHub.Portal.Server.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/AzureIoTHub.Portal.Infrastructure/AzureIoTHub.Portal.Infrastructure.csproj b/src/AzureIoTHub.Portal.Infrastructure/AzureIoTHub.Portal.Infrastructure.csproj index c9ac200d4..853418096 100644 --- a/src/AzureIoTHub.Portal.Infrastructure/AzureIoTHub.Portal.Infrastructure.csproj +++ b/src/AzureIoTHub.Portal.Infrastructure/AzureIoTHub.Portal.Infrastructure.csproj @@ -14,7 +14,7 @@ - + diff --git a/src/AzureIoTHub.Portal/Server/AzureIoTHub.Portal.Server.csproj b/src/AzureIoTHub.Portal/Server/AzureIoTHub.Portal.Server.csproj index de43bc980..cd462c41f 100644 --- a/src/AzureIoTHub.Portal/Server/AzureIoTHub.Portal.Server.csproj +++ b/src/AzureIoTHub.Portal/Server/AzureIoTHub.Portal.Server.csproj @@ -40,7 +40,7 @@ - + From 6ee6834016cdb7df89cf44e7a4d9bd54f6b0fdde Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 16 Oct 2022 14:00:54 +0200 Subject: [PATCH 04/10] Bump Microsoft.AspNetCore.Components.WebAssembly in /src (#1358) Bumps [Microsoft.AspNetCore.Components.WebAssembly](https://github.com/dotnet/aspnetcore) from 6.0.9 to 6.0.10. - [Release notes](https://github.com/dotnet/aspnetcore/releases) - [Changelog](https://github.com/dotnet/aspnetcore/blob/main/docs/ReleasePlanning.md) - [Commits](https://github.com/dotnet/aspnetcore/compare/v6.0.9...v6.0.10) --- updated-dependencies: - dependency-name: Microsoft.AspNetCore.Components.WebAssembly dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- src/AzureIoTHub.Portal/Client/AzureIoTHub.Portal.Client.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AzureIoTHub.Portal/Client/AzureIoTHub.Portal.Client.csproj b/src/AzureIoTHub.Portal/Client/AzureIoTHub.Portal.Client.csproj index 6978be07f..1e0372988 100644 --- a/src/AzureIoTHub.Portal/Client/AzureIoTHub.Portal.Client.csproj +++ b/src/AzureIoTHub.Portal/Client/AzureIoTHub.Portal.Client.csproj @@ -32,7 +32,7 @@ - + From 0ff9af081e91d80fc47cb813168e866f656c4b81 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 16 Oct 2022 14:13:11 +0200 Subject: [PATCH 05/10] Bump Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore (#1356) Bumps [Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore](https://github.com/dotnet/aspnetcore) from 6.0.9 to 6.0.10. - [Release notes](https://github.com/dotnet/aspnetcore/releases) - [Changelog](https://github.com/dotnet/aspnetcore/blob/main/docs/ReleasePlanning.md) - [Commits](https://github.com/dotnet/aspnetcore/compare/v6.0.9...v6.0.10) --- updated-dependencies: - dependency-name: Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .../AzureIoTHub.Portal.Infrastructure.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AzureIoTHub.Portal.Infrastructure/AzureIoTHub.Portal.Infrastructure.csproj b/src/AzureIoTHub.Portal.Infrastructure/AzureIoTHub.Portal.Infrastructure.csproj index 853418096..73b2b1fe4 100644 --- a/src/AzureIoTHub.Portal.Infrastructure/AzureIoTHub.Portal.Infrastructure.csproj +++ b/src/AzureIoTHub.Portal.Infrastructure/AzureIoTHub.Portal.Infrastructure.csproj @@ -13,7 +13,7 @@ - + From 18011d95e1525d2d65844f720522ffdfe9ba9258 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 16 Oct 2022 15:38:38 +0200 Subject: [PATCH 06/10] Bump Microsoft.AspNetCore.Components.WebAssembly.Authentication in /src (#1347) Bumps [Microsoft.AspNetCore.Components.WebAssembly.Authentication](https://github.com/dotnet/aspnetcore) from 6.0.9 to 6.0.10. - [Release notes](https://github.com/dotnet/aspnetcore/releases) - [Changelog](https://github.com/dotnet/aspnetcore/blob/main/docs/ReleasePlanning.md) - [Commits](https://github.com/dotnet/aspnetcore/compare/v6.0.9...v6.0.10) --- updated-dependencies: - dependency-name: Microsoft.AspNetCore.Components.WebAssembly.Authentication dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- src/AzureIoTHub.Portal/Client/AzureIoTHub.Portal.Client.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AzureIoTHub.Portal/Client/AzureIoTHub.Portal.Client.csproj b/src/AzureIoTHub.Portal/Client/AzureIoTHub.Portal.Client.csproj index 1e0372988..b3fdf00ec 100644 --- a/src/AzureIoTHub.Portal/Client/AzureIoTHub.Portal.Client.csproj +++ b/src/AzureIoTHub.Portal/Client/AzureIoTHub.Portal.Client.csproj @@ -33,7 +33,7 @@ - + all From 050751946d2ff0b7764f8ffe82c6bd5657689de8 Mon Sep 17 00:00:00 2001 From: Hocine Hacherouf Date: Sun, 16 Oct 2022 13:21:33 +0200 Subject: [PATCH 07/10] Add container create options on create/edit edge module #1170 --- .../Pages/EdgeModels/EdgeModule/ModuleDialog.razor | 13 ++++++++++--- .../Server/Helpers/ConfigHelper.cs | 4 +++- .../Shared/Models/v1.0/IoTEdgeModule.cs | 2 ++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/AzureIoTHub.Portal/Client/Pages/EdgeModels/EdgeModule/ModuleDialog.razor b/src/AzureIoTHub.Portal/Client/Pages/EdgeModels/EdgeModule/ModuleDialog.razor index 3c1675669..fdb83566c 100644 --- a/src/AzureIoTHub.Portal/Client/Pages/EdgeModels/EdgeModule/ModuleDialog.razor +++ b/src/AzureIoTHub.Portal/Client/Pages/EdgeModels/EdgeModule/ModuleDialog.razor @@ -1,8 +1,5 @@ @using AzureIoTHub.Portal.Models.v10 @using AzureIoTHub.Portal.Shared.Models.v10 -@inject HttpClient Http -@inject IJSRuntime JS -@inject ISnackbar Snackbar @@ -23,6 +20,13 @@ For="@(()=> Module.ImageURI)" Required="true" /> + + + @@ -55,6 +59,7 @@ private string currentModuleName; private string currentImageUri; + private string currentContainerCreateOptions; private List currentEnvironmentVariables = new(); private List currentModuleIdentityTwinSettings = new(); @@ -69,6 +74,7 @@ currentModuleName = Module.ModuleName; currentImageUri = Module.ImageURI; + currentContainerCreateOptions = Module.ContainerCreateOptions; currentEnvironmentVariables = new List(Module.EnvironmentVariables.ToArray()); currentModuleIdentityTwinSettings = new List(Module.ModuleIdentityTwinSettings.ToArray()); currentCommands = new List(Module.Commands.ToArray()); @@ -80,6 +86,7 @@ { Module.ModuleName = currentModuleName; Module.ImageURI = currentImageUri; + Module.ContainerCreateOptions = currentContainerCreateOptions; Module.EnvironmentVariables = new List(currentEnvironmentVariables.ToArray()); Module.ModuleIdentityTwinSettings = new List(currentModuleIdentityTwinSettings.ToArray()); Module.Commands = new List(currentCommands.ToArray()); diff --git a/src/AzureIoTHub.Portal/Server/Helpers/ConfigHelper.cs b/src/AzureIoTHub.Portal/Server/Helpers/ConfigHelper.cs index c0f4d40ea..fe505509f 100644 --- a/src/AzureIoTHub.Portal/Server/Helpers/ConfigHelper.cs +++ b/src/AzureIoTHub.Portal/Server/Helpers/ConfigHelper.cs @@ -149,6 +149,7 @@ public static IoTEdgeModule CreateGatewayModule(Configuration config, JProperty { ModuleName = module.Name, ImageURI = module.Value["settings"]["image"]?.Value(), + ContainerCreateOptions = module.Value["settings"]["createOptions"]?.Value(), Status = module.Value["status"]?.Value(), }; @@ -248,7 +249,8 @@ public static Dictionary> GenerateModulesCon Status = "running", Settings = new ModuleSettings() { - Image = module.ImageURI + Image = module.ImageURI, + CreateOptions = module.ContainerCreateOptions }, RestartPolicy = "always", EnvironmentVariables = new Dictionary() diff --git a/src/AzureIoTHub.Portal/Shared/Models/v1.0/IoTEdgeModule.cs b/src/AzureIoTHub.Portal/Shared/Models/v1.0/IoTEdgeModule.cs index 084779f93..feb6ffe30 100644 --- a/src/AzureIoTHub.Portal/Shared/Models/v1.0/IoTEdgeModule.cs +++ b/src/AzureIoTHub.Portal/Shared/Models/v1.0/IoTEdgeModule.cs @@ -24,6 +24,8 @@ public class IoTEdgeModule [Required(ErrorMessage = "The device image uri is required.")] public string ImageURI { get; set; } + public string ContainerCreateOptions { get; set; } + /// /// The module status. /// From 50ed0ca257df959f0a4300a8f15d59b8429712de Mon Sep 17 00:00:00 2001 From: Hocine Hacherouf Date: Sun, 16 Oct 2022 17:29:23 +0200 Subject: [PATCH 08/10] Add info link on how to configure a container create options --- .../Client/Pages/EdgeModels/EdgeModule/ModuleDialog.razor | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/AzureIoTHub.Portal/Client/Pages/EdgeModels/EdgeModule/ModuleDialog.razor b/src/AzureIoTHub.Portal/Client/Pages/EdgeModels/EdgeModule/ModuleDialog.razor index fdb83566c..418c68431 100644 --- a/src/AzureIoTHub.Portal/Client/Pages/EdgeModels/EdgeModule/ModuleDialog.razor +++ b/src/AzureIoTHub.Portal/Client/Pages/EdgeModels/EdgeModule/ModuleDialog.razor @@ -27,6 +27,9 @@ Variant="Variant.Outlined" For="@(()=> Module.ContainerCreateOptions)" /> + + How to configure container create options for IoT Edge modules + From d60edfa8066fade36d4472321eae11d5fa34e80c Mon Sep 17 00:00:00 2001 From: Hocine Hacherouf Date: Sun, 16 Oct 2022 17:46:21 +0200 Subject: [PATCH 09/10] Update unit tests on ConfigHelper --- .../Server/Helpers/ConfigHelperTest.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/AzureIoTHub.Portal.Tests.Unit/Server/Helpers/ConfigHelperTest.cs b/src/AzureIoTHub.Portal.Tests.Unit/Server/Helpers/ConfigHelperTest.cs index b2e7041cd..54772d62e 100644 --- a/src/AzureIoTHub.Portal.Tests.Unit/Server/Helpers/ConfigHelperTest.cs +++ b/src/AzureIoTHub.Portal.Tests.Unit/Server/Helpers/ConfigHelperTest.cs @@ -88,13 +88,16 @@ public void CreateGatewayModuleShouldReturnValue() // Arrange var config = new Configuration("config_test"); + var expectedContainerCreateOptions = /*lang=json,strict*/ "{\"HostConfig\":{\"PortBindings\":{\"5671/tcp\":[{\"HostPort\":\"5671\"}],\"8883/tcp\":[{\"HostPort\":\"8883\"}],\"443/tcp\":[{\"HostPort\":\"443\"}]}}}"; + var jPropModule = new Dictionary() { { "status", "running" }, { "version", "1.0" }, { "settings", new Dictionary() { - { "image", "image_test" } + { "image", "image_test" }, + { "createOptions", expectedContainerCreateOptions } } }, { "env", new Dictionary() @@ -118,6 +121,7 @@ public void CreateGatewayModuleShouldReturnValue() Assert.IsNotNull(result); Assert.AreEqual("running", result.Status); Assert.AreEqual("image_test", result.ImageURI); + Assert.AreEqual(expectedContainerCreateOptions, result.ContainerCreateOptions); Assert.AreEqual(1, result.EnvironmentVariables.Count); } @@ -158,11 +162,12 @@ public void GenerateModulesContentShouldReturnValue() Description = "Description Test", EdgeModules = new List() { - new IoTEdgeModule() + new() { ModuleName = "ModuleTest", Status = "running", ImageURI = "image", + ContainerCreateOptions = /*lang=json,strict*/ "{\"HostConfig\":{\"PortBindings\":{\"5671/tcp\":[{\"HostPort\":\"5671\"}],\"8883/tcp\":[{\"HostPort\":\"8883\"}],\"443/tcp\":[{\"HostPort\":\"443\"}]}}}", EnvironmentVariables = new List() { new IoTEdgeModuleEnvironmentVariable(){ Name = "envTest01", Value = "test" } From 5262566390318fe873b1bceba9755da00677e378 Mon Sep 17 00:00:00 2001 From: Hocine Hacherouf Date: Sun, 16 Oct 2022 18:08:16 +0200 Subject: [PATCH 10/10] Update unit test GenerateModulesContentShouldReturnValue --- .../Server/Helpers/ConfigHelperTest.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/AzureIoTHub.Portal.Tests.Unit/Server/Helpers/ConfigHelperTest.cs b/src/AzureIoTHub.Portal.Tests.Unit/Server/Helpers/ConfigHelperTest.cs index 54772d62e..c19c7592b 100644 --- a/src/AzureIoTHub.Portal.Tests.Unit/Server/Helpers/ConfigHelperTest.cs +++ b/src/AzureIoTHub.Portal.Tests.Unit/Server/Helpers/ConfigHelperTest.cs @@ -155,6 +155,10 @@ public void CreateGatewayModuleWithNullModuleShouldThrowException() public void GenerateModulesContentShouldReturnValue() { // Arrange + var expectedModuleName = "ModuleTest"; + var expectedContainerCreateOptions = /*lang=json,strict*/ + "{\"HostConfig\":{\"PortBindings\":{\"5671/tcp\":[{\"HostPort\":\"5671\"}],\"8883/tcp\":[{\"HostPort\":\"8883\"}],\"443/tcp\":[{\"HostPort\":\"443\"}]}}}"; + var edgeModel = new IoTEdgeModel() { ModelId = Guid.NewGuid().ToString(), @@ -164,13 +168,13 @@ public void GenerateModulesContentShouldReturnValue() { new() { - ModuleName = "ModuleTest", + ModuleName = expectedModuleName, Status = "running", ImageURI = "image", - ContainerCreateOptions = /*lang=json,strict*/ "{\"HostConfig\":{\"PortBindings\":{\"5671/tcp\":[{\"HostPort\":\"5671\"}],\"8883/tcp\":[{\"HostPort\":\"8883\"}],\"443/tcp\":[{\"HostPort\":\"443\"}]}}}", + ContainerCreateOptions = expectedContainerCreateOptions, EnvironmentVariables = new List() { - new IoTEdgeModuleEnvironmentVariable(){ Name = "envTest01", Value = "test" } + new() { Name = "envTest01", Value = "test" } }, ModuleIdentityTwinSettings = new List() } @@ -184,6 +188,9 @@ public void GenerateModulesContentShouldReturnValue() Assert.IsNotNull(result); Assert.IsAssignableFrom>>(result); Assert.AreEqual(2, result.Count); + var edgeHubPropertiesDesired = (EdgeAgentPropertiesDesired)result["$edgeAgent"]["properties.desired"]; + _ = edgeHubPropertiesDesired.Modules[expectedModuleName].Settings.CreateOptions.Should() + .Be(expectedContainerCreateOptions); } [Test]