From 8ca3ad14a8bb49ea5433bf50615afc6461c078c9 Mon Sep 17 00:00:00 2001 From: ShrinidhiFCTS23 Date: Wed, 20 Dec 2023 17:23:16 +0530 Subject: [PATCH 1/3] added postgres intent --- intent_types/postgres/v1alpha1/README.md | 23 +++++++++++ .../postgres/v1alpha1/intent_type.json | 6 +++ intent_types/postgres/v1alpha1/sample.json | 29 ++++++++++++++ intent_types/postgres/v1alpha1/schema.json | 38 +++++++++++++++++++ 4 files changed, 96 insertions(+) create mode 100644 intent_types/postgres/v1alpha1/README.md create mode 100644 intent_types/postgres/v1alpha1/intent_type.json create mode 100644 intent_types/postgres/v1alpha1/sample.json create mode 100644 intent_types/postgres/v1alpha1/schema.json diff --git a/intent_types/postgres/v1alpha1/README.md b/intent_types/postgres/v1alpha1/README.md new file mode 100644 index 0000000..3fb324b --- /dev/null +++ b/intent_types/postgres/v1alpha1/README.md @@ -0,0 +1,23 @@ +# PostgreSQL Intent Type + +## Overview + +This intent type is designed to represent a Postgresql database configuration within an Infrastructure Catalog. It encapsulates the necessary information for provisioning and managing a Postgresql database instance. + +## Fields + +- `metadata`: Contains auxiliary information such as the maintainer, documentation link, labels, name, and description. +- `kind`: Specifies the kind of the resource, in this case, `postgresql`. +- `spec`: Contains detailed information about the Postgresql instance including the Postgresql version and architecture. +- `disabled`: Indicates if the resource is disabled (`true`) or enabled (`false`) by default. +- `flavor`: Specifies the default implementation details, including the version and name. + +## Specification + +In the `spec` object: +- `version`: Specifies the Postgresql version (e.g., `5.7`, `8.0`). +- `architecture`: A field for specifying Postgresql architecture (e.g., `type: "standalone"`). + +## Example + +See the `sample.json` file for an example instance of this intent type. diff --git a/intent_types/postgres/v1alpha1/intent_type.json b/intent_types/postgres/v1alpha1/intent_type.json new file mode 100644 index 0000000..95da5fd --- /dev/null +++ b/intent_types/postgres/v1alpha1/intent_type.json @@ -0,0 +1,6 @@ +{ + "name": "Postgres Database", + "api_version": "v1alpha1", + "description": "An Intent Type for deploying PostgreSql databases, following Kubernetes style version naming." + } + \ No newline at end of file diff --git a/intent_types/postgres/v1alpha1/sample.json b/intent_types/postgres/v1alpha1/sample.json new file mode 100644 index 0000000..289bf1f --- /dev/null +++ b/intent_types/postgres/v1alpha1/sample.json @@ -0,0 +1,29 @@ +{ + "api_version": "v1alpha1", + "metadata": { + "maintainer": "ishaan@example.com", + "documentation_link": "./README.md", + "labels": { + "owner": "infrastructure@example.com" + }, + "name": "postgres-instance", + "description": "A Postgres database instance." + }, + "kind": "postgres", + "spec": { + "version": "16.1", + "architecture": { + "type": "standalone", + "size": { + "cpu": "1", + "memory": "2gi" + } + } + }, + "disabled": false, + "flavor": { + "version": "1.0", + "name": "standard" + }, + "advanced": {} +} \ No newline at end of file diff --git a/intent_types/postgres/v1alpha1/schema.json b/intent_types/postgres/v1alpha1/schema.json new file mode 100644 index 0000000..15776ba --- /dev/null +++ b/intent_types/postgres/v1alpha1/schema.json @@ -0,0 +1,38 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "api_version": { "type": "string" }, + "metadata": { + "type": "object", + "properties": { + "maintainer": { "type": "string" }, + "documentation_link": { "type": "string", "format": "uri" }, + "labels": { "type": "object" }, + "name": { "type": "string" }, + "description": { "type": "string" } + }, + "required": ["maintainer", "documentation_link", "name"] + }, + "kind": { "type": "string" }, + "spec": { + "type": "object", + "properties": { + "version": { "type": "string" }, + "architecture": { "type": "string", "enum": ["standalone", "master-slave"] } + }, + "required": ["version", "architecture"] + }, + "disabled": { "type": "boolean" }, + "flavor": { + "type": "object", + "properties": { + "version": { "type": "string" }, + "name": { "type": "string" } + }, + "required": ["version", "name"] + }, + "advanced": { "type": "object" } + }, + "required": ["api_version", "metadata", "kind", "spec", "disabled", "flavor"] +} \ No newline at end of file From 35c5c0855437d30059ef0344483643e379256c35 Mon Sep 17 00:00:00 2001 From: ShrinidhiFCTS23 Date: Wed, 20 Dec 2023 18:24:12 +0530 Subject: [PATCH 2/3] updated the schema for postgresql --- intent_types/postgres/v1alpha1/README.md | 13 ++- .../postgres/v1alpha1/intent_type.json | 4 +- intent_types/postgres/v1alpha1/sample.json | 22 ++-- intent_types/postgres/v1alpha1/schema.json | 109 +++++++++++++++--- 4 files changed, 118 insertions(+), 30 deletions(-) diff --git a/intent_types/postgres/v1alpha1/README.md b/intent_types/postgres/v1alpha1/README.md index 3fb324b..7eb15f8 100644 --- a/intent_types/postgres/v1alpha1/README.md +++ b/intent_types/postgres/v1alpha1/README.md @@ -2,21 +2,24 @@ ## Overview -This intent type is designed to represent a Postgresql database configuration within an Infrastructure Catalog. It encapsulates the necessary information for provisioning and managing a Postgresql database instance. +This intent type is designed to represent a PostgreSQL database configuration within an Infrastructure Catalog. It encapsulates the necessary information for provisioning and managing a PostgreSQL database instance. ## Fields - `metadata`: Contains auxiliary information such as the maintainer, documentation link, labels, name, and description. -- `kind`: Specifies the kind of the resource, in this case, `postgresql`. -- `spec`: Contains detailed information about the Postgresql instance including the Postgresql version and architecture. +- `kind`: Specifies the kind of the resource, in this case, `PostgreSQL`. +- `spec`: Contains detailed information about the PostgreSQL instance including the PostgreSQL version and architecture. - `disabled`: Indicates if the resource is disabled (`true`) or enabled (`false`) by default. - `flavor`: Specifies the default implementation details, including the version and name. ## Specification In the `spec` object: -- `version`: Specifies the Postgresql version (e.g., `5.7`, `8.0`). -- `architecture`: A field for specifying Postgresql architecture (e.g., `type: "standalone"`). +- `version`: Specifies the PostgreSQL version (e.g., `5.7`, `8.0`). +- `configuration_parameters`: A field for specifying PostgreSQL parameters (e.g., `max_connections: "1000"`). +- `encryption`: A field to encrypt the db connection between client and server. +- `replication`: A field to define the type of replication. +- `backup`: A field to define if backup is to be taken and how frequently it is to be done. ## Example diff --git a/intent_types/postgres/v1alpha1/intent_type.json b/intent_types/postgres/v1alpha1/intent_type.json index 95da5fd..5f5a5bc 100644 --- a/intent_types/postgres/v1alpha1/intent_type.json +++ b/intent_types/postgres/v1alpha1/intent_type.json @@ -1,6 +1,6 @@ { - "name": "Postgres Database", + "name": "PostgreSQL Database", "api_version": "v1alpha1", "description": "An Intent Type for deploying PostgreSql databases, following Kubernetes style version naming." - } +} \ No newline at end of file diff --git a/intent_types/postgres/v1alpha1/sample.json b/intent_types/postgres/v1alpha1/sample.json index 289bf1f..d883cd5 100644 --- a/intent_types/postgres/v1alpha1/sample.json +++ b/intent_types/postgres/v1alpha1/sample.json @@ -9,15 +9,23 @@ "name": "postgres-instance", "description": "A Postgres database instance." }, - "kind": "postgres", + "kind": "postgreSQL", "spec": { "version": "16.1", - "architecture": { - "type": "standalone", - "size": { - "cpu": "1", - "memory": "2gi" - } + "configuration_parameters": { + "max_connections": "1000" + }, + "encryption": { + "enabled": true, + "type": "TLS" + }, + "replication": { + "enabled": true, + "type": "master" + }, + "backup": { + "enabled": true, + "frequency": "monthly" } }, "disabled": false, diff --git a/intent_types/postgres/v1alpha1/schema.json b/intent_types/postgres/v1alpha1/schema.json index 15776ba..cd77634 100644 --- a/intent_types/postgres/v1alpha1/schema.json +++ b/intent_types/postgres/v1alpha1/schema.json @@ -2,37 +2,114 @@ "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "properties": { - "api_version": { "type": "string" }, + "api_version": { + "type": "string" + }, "metadata": { "type": "object", "properties": { - "maintainer": { "type": "string" }, - "documentation_link": { "type": "string", "format": "uri" }, - "labels": { "type": "object" }, - "name": { "type": "string" }, - "description": { "type": "string" } + "maintainer": { + "type": "string", + "format": "email" + }, + "documentation_link": { + "type": "string" + }, + "labels": { + "type": "object", + "properties": { + "owner": { + "type": "string", + "format": "email" + } + }, + "required": ["owner"] + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + } }, - "required": ["maintainer", "documentation_link", "name"] + "required": ["maintainer", "documentation_link", "labels", "name", "description"] + }, + "kind": { + "type": "string" }, - "kind": { "type": "string" }, "spec": { "type": "object", "properties": { - "version": { "type": "string" }, - "architecture": { "type": "string", "enum": ["standalone", "master-slave"] } + "version": { + "type": "string" + }, + "configuration_parameters": { + "type": "object", + "properties": { + "max_connections": { + "type": "string" + } + }, + "required": ["max_connections"] + }, + "encryption": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + }, + "type": { + "type": "string" + } + }, + "required": ["enabled", "type"] + }, + "replication": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + }, + "type": { + "type": "string" + } + }, + "required": ["enabled", "type"] + }, + "backup": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + }, + "frequency": { + "type": "string" + } + }, + "required": ["enabled", "frequency"] + } }, - "required": ["version", "architecture"] + "required": ["version", "configuration_parameters", "encryption", "replication", "backup"] + }, + "disabled": { + "type": "boolean" }, - "disabled": { "type": "boolean" }, "flavor": { "type": "object", "properties": { - "version": { "type": "string" }, - "name": { "type": "string" } + "version": { + "type": "string" + }, + "name": { + "type": "string" + } }, "required": ["version", "name"] }, - "advanced": { "type": "object" } + "advanced": { + "type": "object" + } }, "required": ["api_version", "metadata", "kind", "spec", "disabled", "flavor"] -} \ No newline at end of file +} + \ No newline at end of file From 0694f636c6c06941c41d121133e1da4735885954 Mon Sep 17 00:00:00 2001 From: ShrinidhiFCTS23 Date: Wed, 20 Dec 2023 18:32:57 +0530 Subject: [PATCH 3/3] updated schema json --- intent_types/postgres/v1alpha1/schema.json | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/intent_types/postgres/v1alpha1/schema.json b/intent_types/postgres/v1alpha1/schema.json index cd77634..e439630 100644 --- a/intent_types/postgres/v1alpha1/schema.json +++ b/intent_types/postgres/v1alpha1/schema.json @@ -45,12 +45,8 @@ }, "configuration_parameters": { "type": "object", - "properties": { - "max_connections": { - "type": "string" - } - }, - "required": ["max_connections"] + "additionalProperties": {"type": "string"}, + "description": "Configuration Parameters for PostgresSQL." }, "encryption": { "type": "object", @@ -72,7 +68,8 @@ }, "type": { "type": "string" - } + }, + "replica_count": {"type": "integer"} }, "required": ["enabled", "type"] },