From cc6b0bdd79f5f9484b32e9612a56901497013df4 Mon Sep 17 00:00:00 2001 From: kartik-579 Date: Tue, 21 Nov 2023 19:40:27 +0530 Subject: [PATCH 1/7] added updated schema --- .../sql/191_alter_resource_schema.down.sql | 0 scripts/sql/191_alter_resource_schema.up.sql | 777 ++++++++++++++++++ 2 files changed, 777 insertions(+) create mode 100644 scripts/sql/191_alter_resource_schema.down.sql create mode 100644 scripts/sql/191_alter_resource_schema.up.sql diff --git a/scripts/sql/191_alter_resource_schema.down.sql b/scripts/sql/191_alter_resource_schema.down.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/scripts/sql/191_alter_resource_schema.up.sql b/scripts/sql/191_alter_resource_schema.up.sql new file mode 100644 index 0000000000..cf986eddaa --- /dev/null +++ b/scripts/sql/191_alter_resource_schema.up.sql @@ -0,0 +1,777 @@ +update devtron_resource_schema +set schema='{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "Cluster Schema", + "type": "object", + "properties": + { + "version": + { + "type": "string" + }, + "kind": + { + "type": "string" + }, + "overview": + { + "type": "object", + "properties": + { + "id": + { + "type": "number" + }, + "name": + { + "type": "string" + }, + "icon": + { + "type": "string", + "contentEncoding": "base64" + }, + "description": + { + "type": "string" + }, + "createdOn": + { + "type": "string", + "format": "date-time" + }, + "createdBy": + { + "type": "object", + "refType": "#/references/users" + }, + "tags": + { + "additionalProperties": + { + "type": "string" + } + }, + "metadata": + { + "type": "object", + "properties": + { + "Contacts": + { + "type": "object", + "properties": + { + "Owner": + { + "type": "object", + "refType": "#/references/users" + }, + "On pager duty": + { + "type": "array", + "items": + { + "type": "object", + "refType": "#/references/users" + } + }, + "Team": + { + "type": "string", + "enum": + [ + "Growth team", + "Support team", + "Platform team", + "Operations team" + ] + }, + "3rd party contacts": + { + "type": "array", + "items": + { + "type": "string" + } + } + }, + "required": + [ + "Owner" + ] + }, + "Networking & Others": + { + "type": "object", + "properties": + { + "Cluster type": + { + "type": "string", + "enum": + [ + "Production", + "Non production" + ] + }, + "Exposed to": + { + "type": "string", + "enum": + [ + "Public", + "Private" + ] + }, + "VPC peered": + { + "type": "array", + "items": + { + "type": "string" + } + }, + "Documentation": + { + "type": "string", + "format": "uri" + } + } + }, + "Backup": + { + "type": "object", + "properties": + { + "Backup strategy": + { + "type": "string", + "enum": + [ + "Full backup", + "Incremental", + "Snapshot" + ] + }, + "Backup retention policy (days)": + { + "type": "integer" + } + } + } + }, + "required": + [ + "Contacts" + ] + } + }, + "required": + [ + "id", + "metadata" + ] + }, + "actions": + { + "type": "object" + }, + "dependencies": + { + "type": "object" + } + }, + "required": + [ + "version", + "kind", + "overview" + ] +}' +where devtron_resource_id = (select id from devtron_resource where kind = 'cluster') + and version = 'v1'; + +update devtron_resource_schema +set schema='{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "Job Schema", + "type": "object", + "properties": + { + "version": + { + "type": "string" + }, + "kind": + { + "type": "string" + }, + "overview": + { + "type": "object", + "properties": + { + "id": + { + "type": "number" + }, + "name": + { + "type": "string" + }, + "icon": + { + "type": "string", + "contentEncoding": "base64" + }, + "description": + { + "type": "string" + }, + "createdOn": + { + "type": "string", + "format": "date-time" + }, + "createdBy": + { + "type": "object", + "refType": "#/references/users" + }, + "tags": + { + "additionalProperties": + { + "type": "string" + } + }, + "metadata": + { + "type": "object", + "properties": + { + "Contacts": + { + "type": "object", + "properties": + { + "Owner": + { + "type": "object", + "refType": "#/references/users" + }, + "POCs": + { + "type": "array", + "items": + { + "type": "object", + "refType": "#/references/users" + } + }, + "Team": + { + "type": "string", + "enum": + [ + "Growth team", + "Support team", + "Platform team", + "Operations team" + ] + }, + "Access manager": + { + "type": "array", + "items": + { + "type": "object", + "refType": "#/references/users" + } + } + }, + "required": + [ + "Owner" + ] + }, + "About job": + { + "type": "object", + "properties": + { + "Type of job": + { + "type": "string", + "enum": + [ + "Deployment", + "Migration", + "Backup", + "Others" + ] + }, + "For environment": + { + "type": "string", + "enum": + [ + "Production", + "Dev", + "Staging", + "QA", + "UAT" + ] + }, + "Documentation": + { + "type": "string", + "format": "uri" + } + } + }, + "Operational schedule": + { + "type": "object", + "properties": + { + "Preferred run": + { + "type": "string", + "format": "date-time" + }, + "Maintenance time": + { + "type": "string", + "format": "date-time" + } + } + } + }, + "required": + [ + "Contacts" + ] + } + }, + "required": + [ + "id", + "metadata" + ] + }, + "actions": + { + "type": "object" + }, + "dependencies": + { + "type": "object" + } + }, + "required": + [ + "version", + "kind", + "overview" + ] +}' +where devtron_resource_id = (select id from devtron_resource where kind = 'job') + and version = 'v1'; + +update devtron_resource_schema +set schema='{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "Devtron Application Schema", + "type": "object", + "properties": + { + "version": + { + "type": "string" + }, + "kind": + { + "type": "string" + }, + "overview": + { + "type": "object", + "properties": + { + "id": + { + "type": "number" + }, + "name": + { + "type": "string" + }, + "icon": + { + "type": "string", + "contentEncoding": "base64" + }, + "description": + { + "type": "string" + }, + "createdOn": + { + "type": "string", + "format": "date-time" + }, + "createdBy": + { + "type": "object", + "refType": "#/references/users" + }, + "tags": + { + "additionalProperties": + { + "type": "string" + } + }, + "metadata": + { + "type": "object", + "properties": + { + "Owners & Pager Duty": + { + "type": "object", + "properties": + { + "Code owners": + { + "type": "array", + "items": + { + "type": "object", + "refType": "#/references/users" + } + }, + "On pager duty": + { + "type": "object", + "refType": "#/references/users" + } + }, + "required": + [ + "Code owners" + ] + }, + "Service details": + { + "type": "object", + "properties": + { + "Framework": + { + "type": "array", + "items": + { + "type": "string", + "enum": + [ + "Django", + "Ruby on Rails", + "Laravel", + "Angular", + "React", + "jQuery", + "ASP.NET Core", + "Bootstrap" + ] + } + }, + "Language": + { + "type": "array", + "items": + { + "type": "string", + "enum": + [ + "Java", + "Python", + "PHP", + "Go", + "Ruby", + "Node" + ] + } + }, + "Communication method": + { + "type": "string", + "enum": + [ + "GraphQL", + "gRPC", + "Message Queue", + "NATS", + "REST API", + "WebSocket" + ] + }, + "Internet facing": + { + "type": "boolean" + } + } + }, + "Documentation": + { + "type": "object", + "properties": + { + "Service Documentation": + { + "type": "string", + "format": "uri" + }, + "API Contract": + { + "type": "string", + "format": "uri" + }, + "Runbook": + { + "type": "string", + "format": "uri" + } + } + } + }, + "required": + [ + "Owners & Pager Duty" + ] + } + }, + "required": + [ + "id", + "metadata" + ] + }, + "actions": + { + "type": "object" + }, + "dependencies": + { + "type": "object" + } + }, + "required": + [ + "version", + "kind", + "overview" + ] +}' +where devtron_resource_id = (select id from devtron_resource where kind = 'devtron-application') + and version = 'v1'; + +update devtron_resource_schema +set schema='{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "Helm Application Schema", + "type": "object", + "properties": + { + "version": + { + "type": "string" + }, + "kind": + { + "type": "string" + }, + "overview": + { + "type": "object", + "properties": + { + "id": + { + "type": "number" + }, + "name": + { + "type": "string" + }, + "icon": + { + "type": "string", + "contentEncoding": "base64" + }, + "description": + { + "type": "string" + }, + "createdOn": + { + "type": "string", + "format": "date-time" + }, + "createdBy": + { + "type": "object", + "refType": "#/references/users" + }, + "tags": + { + "additionalProperties": + { + "type": "string" + } + }, + "metadata": + { + "type": "object", + "properties": + { + "Owners & Pager Duty": + { + "type": "object", + "properties": + { + "Code owners": + { + "type": "array", + "items": + { + "type": "object", + "refType": "#/references/users" + } + }, + "On pager duty": + { + "type": "object", + "refType": "#/references/users" + } + }, + "required": + [ + "Code owners" + ] + }, + "Service details": + { + "type": "object", + "properties": + { + "Framework": + { + "type": "array", + "items": + { + "type": "string", + "enum": + [ + "Django", + "Ruby on Rails", + "Laravel", + "Angular", + "React", + "jQuery", + "ASP.NET Core", + "Bootstrap" + ] + } + }, + "Language": + { + "type": "array", + "items": + { + "type": "string", + "enum": + [ + "Java", + "Python", + "PHP", + "Go", + "Ruby", + "Node" + ] + } + }, + "Communication method": + { + "type": "string", + "enum": + [ + "GraphQL", + "gRPC", + "Message Queue", + "NATS", + "REST API", + "WebSocket" + ] + }, + "Internet facing": + { + "type": "boolean" + } + } + }, + "Documentation": + { + "type": "object", + "properties": + { + "Service Documentation": + { + "type": "string", + "format": "uri" + }, + "API Contract": + { + "type": "string", + "format": "uri" + }, + "Runbook": + { + "type": "string", + "format": "uri" + } + } + } + }, + "required": + [ + "Owners & Pager Duty" + ] + } + }, + "required": + [ + "id", + "metadata" + ] + }, + "actions": + { + "type": "object" + }, + "dependencies": + { + "type": "object" + } + }, + "required": + [ + "version", + "kind", + "overview" + ] +}' +where devtron_resource_id = (select id from devtron_resource where kind = 'helm-application') + and version = 'v1'; \ No newline at end of file From 8c7338666999d66ea5a19ae4289c14c826d5b5b5 Mon Sep 17 00:00:00 2001 From: kartik-579 Date: Wed, 22 Nov 2023 16:17:11 +0530 Subject: [PATCH 2/7] updated schema --- scripts/sql/191_alter_resource_schema.up.sql | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/scripts/sql/191_alter_resource_schema.up.sql b/scripts/sql/191_alter_resource_schema.up.sql index cf986eddaa..e4488bdd51 100644 --- a/scripts/sql/191_alter_resource_schema.up.sql +++ b/scripts/sql/191_alter_resource_schema.up.sql @@ -37,8 +37,7 @@ set schema='{ }, "createdOn": { - "type": "string", - "format": "date-time" + "type": "string" }, "createdBy": { @@ -231,8 +230,7 @@ set schema='{ }, "createdOn": { - "type": "string", - "format": "date-time" + "type": "string" }, "createdBy": { @@ -338,13 +336,11 @@ set schema='{ { "Preferred run": { - "type": "string", - "format": "date-time" + "type": "string" }, "Maintenance time": { - "type": "string", - "format": "date-time" + "type": "string" } } } @@ -419,8 +415,7 @@ set schema='{ }, "createdOn": { - "type": "string", - "format": "date-time" + "type": "string" }, "createdBy": { @@ -617,8 +612,7 @@ set schema='{ }, "createdOn": { - "type": "string", - "format": "date-time" + "type": "string" }, "createdBy": { From 08859a729a2444ffefd86ff893602027cbdab708 Mon Sep 17 00:00:00 2001 From: kartik-579 Date: Wed, 22 Nov 2023 18:34:33 +0530 Subject: [PATCH 3/7] updated sql script no. --- ...esource_schema.down.sql => 192_alter_resource_schema.down.sql} | 0 ...er_resource_schema.up.sql => 192_alter_resource_schema.up.sql} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename scripts/sql/{191_alter_resource_schema.down.sql => 192_alter_resource_schema.down.sql} (100%) rename scripts/sql/{191_alter_resource_schema.up.sql => 192_alter_resource_schema.up.sql} (100%) diff --git a/scripts/sql/191_alter_resource_schema.down.sql b/scripts/sql/192_alter_resource_schema.down.sql similarity index 100% rename from scripts/sql/191_alter_resource_schema.down.sql rename to scripts/sql/192_alter_resource_schema.down.sql diff --git a/scripts/sql/191_alter_resource_schema.up.sql b/scripts/sql/192_alter_resource_schema.up.sql similarity index 100% rename from scripts/sql/191_alter_resource_schema.up.sql rename to scripts/sql/192_alter_resource_schema.up.sql From 44cccd7a49f5c692ff80df690246ec4146fbaf58 Mon Sep 17 00:00:00 2001 From: kartik-579 Date: Thu, 23 Nov 2023 15:10:38 +0530 Subject: [PATCH 4/7] updated sql script no --- ...esource_schema.down.sql => 194_alter_resource_schema.down.sql} | 0 ...er_resource_schema.up.sql => 194_alter_resource_schema.up.sql} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename scripts/sql/{192_alter_resource_schema.down.sql => 194_alter_resource_schema.down.sql} (100%) rename scripts/sql/{192_alter_resource_schema.up.sql => 194_alter_resource_schema.up.sql} (100%) diff --git a/scripts/sql/192_alter_resource_schema.down.sql b/scripts/sql/194_alter_resource_schema.down.sql similarity index 100% rename from scripts/sql/192_alter_resource_schema.down.sql rename to scripts/sql/194_alter_resource_schema.down.sql diff --git a/scripts/sql/192_alter_resource_schema.up.sql b/scripts/sql/194_alter_resource_schema.up.sql similarity index 100% rename from scripts/sql/192_alter_resource_schema.up.sql rename to scripts/sql/194_alter_resource_schema.up.sql From 15340c581058a3758af74883de77b44fe9999fc9 Mon Sep 17 00:00:00 2001 From: kartik-579 Date: Thu, 23 Nov 2023 16:25:14 +0530 Subject: [PATCH 5/7] updated schema --- scripts/sql/194_alter_resource_schema.up.sql | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scripts/sql/194_alter_resource_schema.up.sql b/scripts/sql/194_alter_resource_schema.up.sql index e4488bdd51..cfce7eac6b 100644 --- a/scripts/sql/194_alter_resource_schema.up.sql +++ b/scripts/sql/194_alter_resource_schema.up.sql @@ -69,6 +69,7 @@ set schema='{ "On pager duty": { "type": "array", + "uniqueItems": true, "items": { "type": "object", @@ -89,6 +90,7 @@ set schema='{ "3rd party contacts": { "type": "array", + "uniqueItems": true, "items": { "type": "string" @@ -262,6 +264,7 @@ set schema='{ "POCs": { "type": "array", + "uniqueItems": true, "items": { "type": "object", @@ -282,6 +285,7 @@ set schema='{ "Access manager": { "type": "array", + "uniqueItems": true, "items": { "type": "object", @@ -442,6 +446,7 @@ set schema='{ "Code owners": { "type": "array", + "uniqueItems": true, "items": { "type": "object", @@ -467,6 +472,7 @@ set schema='{ "Framework": { "type": "array", + "uniqueItems": true, "items": { "type": "string", @@ -486,6 +492,7 @@ set schema='{ "Language": { "type": "array", + "uniqueItems": true, "items": { "type": "string", @@ -639,6 +646,7 @@ set schema='{ "Code owners": { "type": "array", + "uniqueItems": true, "items": { "type": "object", @@ -664,6 +672,7 @@ set schema='{ "Framework": { "type": "array", + "uniqueItems": true, "items": { "type": "string", @@ -683,6 +692,7 @@ set schema='{ "Language": { "type": "array", + "uniqueItems": true, "items": { "type": "string", From 8801780a1eb302d2409818397b224f54253fd1b2 Mon Sep 17 00:00:00 2001 From: kartik-579 Date: Thu, 30 Nov 2023 12:35:51 +0530 Subject: [PATCH 6/7] added min length for code owners --- scripts/sql/194_alter_resource_schema.up.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/sql/194_alter_resource_schema.up.sql b/scripts/sql/194_alter_resource_schema.up.sql index cfce7eac6b..8af2f22abf 100644 --- a/scripts/sql/194_alter_resource_schema.up.sql +++ b/scripts/sql/194_alter_resource_schema.up.sql @@ -447,6 +447,7 @@ set schema='{ { "type": "array", "uniqueItems": true, + "minItems": 1, "items": { "type": "object", @@ -647,6 +648,7 @@ set schema='{ { "type": "array", "uniqueItems": true, + "minItems": 1, "items": { "type": "object", From ff80e9d8aa70bea3fa269afe61ca49877f011990 Mon Sep 17 00:00:00 2001 From: kartik-579 Date: Tue, 5 Dec 2023 09:50:57 +0530 Subject: [PATCH 7/7] updated sql script no --- ...esource_schema.down.sql => 196_alter_resource_schema.down.sql} | 0 ...er_resource_schema.up.sql => 196_alter_resource_schema.up.sql} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename scripts/sql/{194_alter_resource_schema.down.sql => 196_alter_resource_schema.down.sql} (100%) rename scripts/sql/{194_alter_resource_schema.up.sql => 196_alter_resource_schema.up.sql} (100%) diff --git a/scripts/sql/194_alter_resource_schema.down.sql b/scripts/sql/196_alter_resource_schema.down.sql similarity index 100% rename from scripts/sql/194_alter_resource_schema.down.sql rename to scripts/sql/196_alter_resource_schema.down.sql diff --git a/scripts/sql/194_alter_resource_schema.up.sql b/scripts/sql/196_alter_resource_schema.up.sql similarity index 100% rename from scripts/sql/194_alter_resource_schema.up.sql rename to scripts/sql/196_alter_resource_schema.up.sql