Backend: Add logic for saving agent configuration in DB

MR: Save default and max workspace resources on age... (!138732 - merged)

Description

As a user, I want to be able to specify the default and max cpu/memory to be used for all workspaces provisioned through an agent.

remote_development:
    default_resources_per_workspace_container:
        limits:
            cpu: 1
            memory: 500m
        requests:
            cpu: 500m
            memory: 500Mi
    max_resources_per_workspace:
        limits:
            cpu: 1
            memory: 500Mi
        requests:
            cpu: 500m
            memory: 500Mi

Acceptance Criteria

  • All field for default_resources_per_workspace_container and max_resources_per_workspace are required.
  • The json structures should be validated with a new JSON schema as part of activerecord validation for the RemoteDevelopmentAgentConfig validation
  • Acceptable values for cpu/memory respect the format mentioned in https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/quantity/ . The acceptable values would only be in string format as mentioned in #427142 (comment 1685995949)
  • Any changes to default_resources_per_workspace_container and max_resources_per_workspace are reflected in the DB if there are no validation errors.
  • If there are any validations errors, DB values will not get updated.
  • All non-terminated workspaces associated with the agent have force_include_all_resources set to true.
Edited by Vishal Tak