Skip to content

Commit

Permalink
Adding an API to enable the drain mode (Azure#6330)
Browse files Browse the repository at this point in the history
Adding admin API to enable the drain mode
  • Loading branch information
soninaren authored Jul 9, 2020
1 parent 5b01c18 commit 7a6910a
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 3 deletions.
1 change: 1 addition & 0 deletions release_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

- Update Python Worker to 1.1.3([Release Note](https://github.com/Azure/azure-functions-python-worker/releases/tag/1.1.3))
- Update Python Library to 1.3.0([Release Note](https://github.com/Azure/azure-functions-python-library/releases/tag/1.3.0))
- Added an admin API to enable drain mode

**Release sprint:** Sprint 79
[ [bugs](https://github.com/Azure/azure-functions-host/issues?q=is%3Aissue+milestone%3A%22Functions+Sprint+79%22+label%3Abug+is%3Aclosed) | [features](https://github.com/Azure/azure-functions-host/issues?q=is%3Aissue+milestone%3A%22Functions+Sprint+79%22+label%3Afeature+is%3Aclosed) ]
13 changes: 13 additions & 0 deletions src/WebJobs.Script.WebHost/Controllers/HostController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,19 @@ public async Task<IActionResult> GetHostStatus([FromServices] IScriptHostManager
return Ok(status);
}

[HttpGet]
[HttpPost]
[Route("admin/host/drain")]
[Authorize(Policy = PolicyNames.AdminAuthLevelOrInternal)]
public IActionResult Drain([FromServices] IDrainModeManager drainModeManager)
{
_logger.LogDebug("Received request for draining host");

// Stop call to some listeners get stuck, Not waiting for the stop call to complete
drainModeManager.EnableDrainModeAsync(CancellationToken.None).ConfigureAwait(false);
return Ok();
}

[HttpGet]
[HttpPost]
[Route("admin/host/ping")]
Expand Down
2 changes: 1 addition & 1 deletion src/WebJobs.Script.WebHost/WebJobs.Script.WebHost.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
<PackageReference Include="Microsoft.Azure.Services.AppAuthentication" Version="1.0.3" />
<PackageReference Include="Microsoft.Azure.Storage.File" Version="11.1.0" />
<PackageReference Include="Microsoft.Azure.WebJobs.Host.Storage" Version="4.0.1" />
<PackageReference Include="Microsoft.Azure.WebJobs" Version="3.0.18" />
<PackageReference Include="Microsoft.Azure.WebJobs" Version="3.0.19" />
<PackageReference Include="Microsoft.Azure.KeyVault" Version="3.0.3" />
<PackageReference Include="Microsoft.Azure.WebJobs.Logging" Version="4.0.1" />
<PackageReference Include="Microsoft.Azure.WebSites.DataProtection" Version="2.1.91-alpha" />
Expand Down
2 changes: 1 addition & 1 deletion src/WebJobs.Script/WebJobs.Script.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<PackageReference Include="Microsoft.Azure.Functions.NodeJsWorker" Version="2.0.4" />
<PackageReference Include="Microsoft.Azure.Functions.PowerShellWorker.PS6" Version="3.0.291" />
<PackageReference Include="Microsoft.Azure.Functions.PowerShellWorker.PS7" Version="3.0.293" />
<PackageReference Include="Microsoft.Azure.WebJobs" Version="3.0.18" />
<PackageReference Include="Microsoft.Azure.WebJobs" Version="3.0.19" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions" Version="4.0.1" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Http" Version="3.0.7" />
<PackageReference Include="Microsoft.Azure.WebJobs.Logging.ApplicationInsights" Version="3.0.18" />
Expand Down
2 changes: 1 addition & 1 deletion test/WebJobsStartupTests/WebJobsStartupTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Azure.WebJobs" Version="3.0.18" />
<PackageReference Include="Microsoft.Azure.WebJobs" Version="3.0.19" />
<PackageReference Include="Microsoft.Net.Sdk.Functions" Version="3.0.*" />
</ItemGroup>

Expand Down

0 comments on commit 7a6910a

Please sign in to comment.