Skip to content
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

Cannot update workspace with custom address space #3691

Closed
jlabhard-sg opened this issue Aug 25, 2023 · 10 comments · Fixed by #3714
Closed

Cannot update workspace with custom address space #3691

jlabhard-sg opened this issue Aug 25, 2023 · 10 comments · Fixed by #3714
Assignees
Labels
bug Something isn't working

Comments

@jlabhard-sg
Copy link

jlabhard-sg commented Aug 25, 2023

Describe the bug
Creating a workspace with a custom address space and then updating it will fail with The custom 'address_space' you requested does not fit in the current network. This is because the method workspaces.validate_address_space() will check the allocated network on update, find that the network is already allocated (to the current workspace), and return the error.

The same error arises when creating a workspace and specifying a custom address space which overlaps with a workspace that has been deleted.

Steps to reproduce

  1. Create a workspace with custom address space
  2. Update it without any changes

Suggested changes

  • Custom address space should not be updateable
  • The address space should not be subject to validation on update
  • The allocated network validation should not included the deleted workspaces and the current workspace
@jlabhard-sg jlabhard-sg added the bug Something isn't working label Aug 25, 2023
@marrobi
Copy link
Member

marrobi commented Aug 25, 2023

@jlabhard-sg thanks for reporing. Not many people use custom address spaces as far as I am aware.

Updating should not be possible as you can't change the address space once it has things on it. Do you agree?

Can you try changing:

https://github.com/marrobi/AzureTRE/blob/main/templates/workspaces/base/template_schema.json#L52-L53

To false and see if that sorts things out?

@jlabhard-sg
Copy link
Author

Hi @marrobi ,
Yes I agree, my issue arises when I update the workspace without changing the address space.
I will try your suggested change to see if it fixes it and update you here.

@jlabhard-sg
Copy link
Author

@marrobi Setting the address_spaces properties to non-updateable did not solve the issue.

@marrobi
Copy link
Member

marrobi commented Aug 25, 2023

Ok, it will need further debugging/time to look for an appropriate solution.

If you can come up with a working solution, welcome a contribution, it's unlikely we will have chance to dig into it for a while. I tend to think not validating the address space if it has not changed/is and update , makes most sense.

@marrobi marrobi moved this from Backlog to Up Next in Azure TRE - Engineering Sep 20, 2023
@marrobi
Copy link
Member

marrobi commented Sep 20, 2023

@jlabhard-sg just taking a look at this, I'm trying to work out the code path that results in validate_address_space being called on an update.

It is called in get_address_space_based_on_size which is called only on create, here
-https://github.com/marrobi/AzureTRE/blob/0c5d945f84086daf479a906b2e362d2ae544702b/api_app/db/repositories/workspaces.py#L75

II will try to reproduce myself, but confused as to why this would occur.

@jlabhard-sg
Copy link
Author

@marrobi It is possible that I mixed the error message from two different issues when looking for them in the app insights. "Does not fit in the current network" probably happened when trying to create a workspace with an address space that was used by a deleted workspace. I believe this is still undesirable.

However, updating a workspace with custom address space also doesn't work. But the only error message I can find is "Unevaluated properties <address_space> is not allowed". Currently, I am able to bypass it by updating the resource in CosmosDB and using the swagger UI to update the workspace.

@marrobi
Copy link
Member

marrobi commented Sep 20, 2023

Ok, other than the excluding deleted the issue is as address_space_size is not updatable, its not passed with the patch payload. This means that validation fails as it's not expecting the actual address space size in the payload, as its only accepted if address space size is in the payload as custom.

address_space should not be updatable, but read only, this is configured here:

if is_update:
for prop in template["properties"].values():
if "updateable" not in prop.keys() or prop["updateable"] is not True:
prop["readOnly"] = True

We are only iterating through the top level properties and making fields read only, not the allOf ones, which address space is.

@marrobi
Copy link
Member

marrobi commented Sep 20, 2023

@jlabhard-sg any change you can build the image in #3714 and give it a go and see if the issue is resolved.

I've given it a go and is good for me. Thanks.

@marrobi marrobi moved this from Up Next to PR in Azure TRE - Engineering Sep 21, 2023
@marrobi marrobi moved this from PR to In Progress in Azure TRE - Engineering Sep 21, 2023
@jlabhard-sg
Copy link
Author

@marrobi Was able to test and validate the fix in #3714. Thank you!

@marrobi
Copy link
Member

marrobi commented Sep 21, 2023

Great, might take a little while to get it merged in, but good to know it works.

@github-project-automation github-project-automation bot moved this from In Progress to Done in Azure TRE - Engineering Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
2 participants