-
Notifications
You must be signed in to change notification settings - Fork 467
Add support for host specialization with unencrypted payload #11302
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a new host API endpoint for assigning without encrypted payload to improve memory efficiency. The change introduces a new unencrypted assignment endpoint alongside the existing encrypted one, which will be useful for ATOL scenarios.
Key Changes
- Added a new assignment endpoint that accepts unencrypted payload
- Refactored existing assignment logic into a shared private method
- Created a new model to wrap the unencrypted assignment context
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
StartupContextProvider.cs | Added new overload method to handle unencrypted HostAssignmentContext |
FunctionsWorkerContainerAssignmentContext.cs | New model class to wrap assignment context for the new API |
InstanceController.cs | Added new assignment endpoint and refactored shared logic into private method |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
src/WebJobs.Script.WebHost/Models/FunctionsWorkerContainerAssignmentContext.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of adding a new endpoint entirely, can we update EncryptedHostAssignmentContext
as follows:
- rename to
HostAssignmentRequest
- add properties as follows:
public class HostAssignmentRequest
{
[JsonProperty("encryptedContext")]
public string EncryptedContext { get; set; }
[JsonProperty("context")]
public HostAssignmentContext Context { get; set; }
}
Now callers can choose to supply encrypted or not based on what JSON payload they send. The implementation will then check which of the two properties is not-null and use that.
Hi, Thats a valid suggestion. But, that will break backward compatibility and makes it very difficult to deploy. We would need to change current flow of assignment in Antares outside ATOL. We would have to check which hostversion is supporting which endpoint and send object accordingly. With new endpoint, we can remove old endpoint once we move to endpoint entirely. In legion as well, we have seperate endppints for encrypted and unencypted payload to make it easier for maintenance |
@manikantanallagatla can you expand more on how my proposal limits maintenance? I am not quite understanding your point.
How so? One API will serve both formats of JSON. The existing encrypted, or the new unencrypted. The caller can send either of the two formats. {
"encryptedContext": "< some encrypted string >"
} or {
"context": {
"siteName": "MySiteName", // and the rest of the object
}
}
And with my proposal we can remove the support for What this boils down to, is ATOL can call |
Oh got it. There is a HostAssignmentContext inside HostAssignmentRequest. I missed that. Apologies. We can make it a single request with this. I will give it a try. Thanks @jviau |
4aeaa40
to
9e46fdd
Compare
@manikantanallagatla I see you re-requested my review, but I don't see the changes we discussed. There are still 2 separate APIs and encrypted/unencrypted models are not combined into the same top-level type. Are these changes still coming? |
@jviau just for my curiosity, why do we want to hack into existing api and break the request model object structure from current flow and combining multiple properties where only one is used at any given time, instead of keeping the cleaner segregation with different APIs and their models, and not breaking/modifying the current API on the way. @manikantanallagatla let's ensure any changes here are aligned by everyone and thought through, because I think we might be making some changes on Legion Platform side or Go Server code to call these APIs while maintaining backward compatibility. Might have to change all those if we have to retrofit new behavior into existing API without breaking the current flows. |
@jviau , I merged the APIs into 1 API and requested review. Then when I discussed with Bala, we wanted two separate APIs so that it is cleaner. So, I again reverted that commit of merging into 1 API. Anyways I will start a thread in teams to have a conclusion on 1 API vs 2 APIs. |
I don't see this as a hack at all. It doesn't break anything. We are effectively turning the existing JSON payload into a "One-Of" structure. It is either the encrypted payload or the unencrypted payload, and the existing API will determine what assign flow to use based on the shape of the JSON input. We can add validation in the API handler to assert only one can be set at a time. I do not think having an Existing callers. This is the same as today, and it will be the same after my suggested changes. There is no change for these callers. POST "admin/instance/assign"
{
"encryptedContext": "< encrypted context >"
} NEW callers wanting unencrypted assign: POST "admin/instance/assign"
{
"context": {
// unencrypted host assignment context
}
} Additional scenario which will result in an HTTP 400. Callers will not be allowed to provide both encrypted and unencrypted context. POST "admin/instance/assign"
{
"encryptedContext": "< encrypted context >",
"context": {
// unencrypted host assignment context
}
} |
src/WebJobs.Script.WebHost/Models/FunctionsWorkerContainerAssignmentContext.cs
Outdated
Show resolved
Hide resolved
src/WebJobs.Script.WebHost/Models/FunctionsWorkerContainerAssignmentContext.cs
Outdated
Show resolved
Hide resolved
9e46fdd
to
4c83a23
Compare
Issue describing the changes in this PR
Current assign endpoint takes a encrypted payload for specializing. This is not memory efficient. Adding new API for taking the specialization unencrypted. This will be usedul in ATOL as well
Pull request checklist
IMPORTANT: Currently, changes must be backported to the
in-proc
branch to be included in Core Tools and non-Flex deployments.in-proc
branch is not requiredrelease_notes.md