Replies: 2 comments 1 reply
-
Enabling Onyxia instance owners to overwrite the default schema is a brilliant idea that I'm looking forward to implementing in Onyxia! However I have reservations regarding the I would personally prefer an approach where an Onyxia instance administrator could configure in his region the specific field definitions he wished to override. It would look something like:
onyxia:
ingress:
enabled: true
hosts:
- host: datalab.$DOMAIN
web:
env:
# ...
api:
catalogs:
[
{
id: "ide",
location: "https://inseefrlab.github.io/helm-charts-interactive-services"
},
{
id: "databases",
location: "https://inseefrlab.github.io/helm-charts-databases"
}
]
regions: [
{
id: "my-region",
services: {
type: "KUBERNETES",
singleNamespace: true,
authenticationMode: "serviceAccount",
expose: {
domain: "lab.$DOMAIN"
}
},
+ valuesSchemaOverride: [
+ {
+ targets: {
+ path: "nodeSelector"
+ },
+ schema: {
+ properties: {
+ zone: {
+ type: "string",
+ enum: ["east", "west"],
+ description: "Specifies the zone of the node which must be either 'east' or 'west'."
+ },
+ diskType: {
+ type: "string",
+ enum: ["ssd", "hdd"],
+ description: "Type of disk, which must be either 'ssd' or 'hdd'."
+ },
+ cpuClass: {
+ type: "string",
+ enum: ["high", "medium", "low"],
+ description: "Class of CPU power, which must be either 'high', 'medium', or 'low'."
+ }
+ },
+ additionalProperties: "unset"
+ }
+ },
+ {
+ targets: {
+ catalogId: "ide",
+ chartName: "jupyter-*",
+ path: "service.image.version"
+ },
+ schema: {
+ enum: [
+ "inseefrlab/onyxia-jupyter-python:py3.11.6",
+ "inseefrlab/onyxia-jupyter-python:py3.10.13",
+ "inseefrlab/onyxia-jupyter-python:py4.0.0-beta.0"
+ ],
+ default: "inseefrlab/onyxia-jupyter-python:py4.0.0-beta.0"
+ }
+ }
+ ]
+ }
] Let's break down how this would be applied. The following would mean that the schema override would apply to every chart of every catalog which has a targets: {
path: "nodeSelector"
} If this is the relevant part of the schema in the {
"nodeSelector": {
"type": "object",
"title": "Node Selector",
"description": "A nodeSelector is an object with arbitrary string key-value pairs, used to select specific nodes.",
"additionalProperties": {
"type": "string",
"description": "The value for the node label, which must be a string."
}
}
} The following schema overrides will be applied to it: {
properties: {
zone: {
type: "string",
enum: ["east", "west"],
description: "Specifies the zone of the node which must be either 'east' or 'west'."
},
diskType: {
type: "string",
enum: ["ssd", "hdd"],
description: "Type of disk, which must be either 'ssd' or 'hdd'."
},
cpuClass: {
type: "string",
enum: ["high", "medium", "low"],
description: "Class of CPU power, which must be either 'high', 'medium', or 'low'."
}
},
additionalProperties: "unset"
} Which would result, after merge into this specification being used for nodeSelector value: {
"nodeSelector": {
"type": "object",
"title": "Node Selector",
"description": "A nodeSelector is an object with arbitrary string key-value pairs, used to select specific nodes.",
"properties": {
"zone": {
"type": "string",
"enum": ["east", "west"],
"description": "Specifies the zone of the node which must be either 'east' or 'west'."
},
"diskType": {
"type": "string",
"enum": ["ssd", "hdd"],
"description": "Type of disk, which must be either 'ssd' or 'hdd'."
},
"cpuClass": {
"type": "string",
"enum": ["high", "medium", "low"],
"description": "Class of CPU power, which must be either 'high', 'medium', or 'low'."
}
}
}
} We could discuss of the format and specific specification of the Advantages of the proposed approach:
Drawback of this approach:
Here are the measures that could be taken to mitigate these drawbacks:
This would be very empowering for Onyxia instance maintainers, significantly improving the ease of crafting custom configurations. Regardless of the option we land on, I think this will be a big leap forward for Onyxia. 🚀 |
Beta Was this translation helpful? Give feedback.
-
Hi! As discussed on the community call Both proposal have their pros and cons. My suggestion is to implement the proposal by @garronej first and see how this fit the need of the users, as this is simpler to implement and does not block the proposal by @fcomte if we see that the solution is not a good fit. |
Beta Was this translation helpful? Give feedback.
-
Onyxia utilizes a JSON schema located within each chart to dynamically create forms as users initiate services. This schema fulfills two main functions:
This validation process isn't widely implemented because we aim for any instance to utilize our open-source chart as a subchart. For instance, we have introduced a specific field called 'listEnum' instead of the standard 'enum' for Docker images.
Description of the problems
Handling a nodeSelector object in a dynamic form schema like Onyxia's is particularly challenging due to its dependency on specific contexts. Here's a generic pattern that could be incorporated into an opensource Helm chart.
However, for a specific instance (maybe region in fact), it would be crucial to use this particular pattern instead to create a practical and effective chart.
Idea and proposal
In JSON Schema,
$ref
is a keyword used to reference a definition or a schema fragment from elsewhere within the same document or from an external document. This allows you to reuse pieces of a schema without having to duplicate code, which can make your schemas more manageable and easier to maintain.For example, if you have a common structure that is used in multiple places within a schema, you can define it once and then reference it wherever needed using
$ref
. This is particularly useful for large schemas or schemas that share common data structures across various parts of an application.We recommend configuring the values.schema.json in this way.
The base ID will be determined by the specific instance URL for all subsequent schemas.
Onyxia-api or any similar schema management module could by default provide the following standard object.
But instance (or region) may overwrite this schema and provide instead the following schema
In summary, we aim to include a collection of standard schemas within Onyxia, allowing administrators the ability to override them. This approach will offer a highly versatile solution applicable across all instances.
Additionally, it will be possible to introduce new schemas
Beta Was this translation helpful? Give feedback.
All reactions