Skip to content

Commit 8f7d114

Browse files
authored
feat: kubecon 2025 feature release (#6884)
1 parent 6f2f325 commit 8f7d114

12 files changed

Lines changed: 939 additions & 0 deletions
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*
2+
* Copyright (c) 2024. Devtron Inc.
3+
*/
4+
5+
-- Drop indexes and constraints first
6+
DROP INDEX IF EXISTS "public"."idx_cost_custom_view_name";
7+
DROP INDEX IF EXISTS "public"."idx_cost_custom_view_name_cluster_unique";
8+
DROP INDEX IF EXISTS "public"."idx_cost_custom_view_identifier_unique";
9+
10+
-- Drop table
11+
DROP TABLE IF EXISTS "public"."cost_custom_view" CASCADE;
12+
13+
-- Drop sequences
14+
DROP SEQUENCE IF EXISTS id_seq_cost_custom_view;
15+
16+
-- Drop column from cluster table
17+
ALTER TABLE "public"."cluster" DROP COLUMN IF EXISTS "cost_module_enabled";
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* Copyright (c) 2024. Devtron Inc.
3+
*/
4+
5+
-- Create new cost_module_enabled column in cluster table
6+
ALTER TABLE "public"."cluster" ADD COLUMN IF NOT EXISTS "cost_module_enabled" bool NOT NULL DEFAULT false;
7+
8+
-- Create sequence for cost_custom_view
9+
CREATE SEQUENCE IF NOT EXISTS id_seq_cost_custom_view;
10+
11+
-- Create cost_custom_view table
12+
CREATE TABLE IF NOT EXISTS "public"."cost_custom_view" (
13+
"id" int4 NOT NULL DEFAULT nextval('id_seq_cost_custom_view'::regclass),
14+
"name" varchar(255) NOT NULL,
15+
"identifier" varchar(255) NOT NULL,
16+
"description" text,
17+
"filters" text NOT NULL,
18+
"active" bool NOT NULL DEFAULT true,
19+
"cluster_id" int4 NOT NULL,
20+
"created_on" timestamptz DEFAULT NOW(),
21+
"created_by" int4,
22+
"updated_on" timestamptz,
23+
"updated_by" int4,
24+
PRIMARY KEY ("id")
25+
);
26+
27+
-- Indexes for cost_custom_view
28+
CREATE INDEX IF NOT EXISTS idx_cost_custom_view_name ON "public"."cost_custom_view"("name") WHERE "active" = true;
29+
30+
-- Unique constraints to ensure name uniqueness within cluster and identifier uniqueness globally
31+
CREATE UNIQUE INDEX IF NOT EXISTS idx_cost_custom_view_name_cluster_unique
32+
ON "public"."cost_custom_view"("name", "cluster_id")
33+
WHERE "active" = true;
34+
35+
CREATE UNIQUE INDEX IF NOT EXISTS idx_cost_custom_view_identifier_unique
36+
ON "public"."cost_custom_view"("identifier")
37+
WHERE "active" = true;
38+
39+
-- Add comments for documentation
40+
COMMENT ON TABLE "public"."cost_custom_view" IS 'User-defined custom views for cost analysis and filtering';
41+
COMMENT ON COLUMN "public"."cost_custom_view"."filters" IS 'JSON string containing filter criteria for the custom view';
42+
43+
INSERT INTO "public"."chart_repo" ( "name", "url", "is_default", "active", "created_on", "created_by", "updated_on", "updated_by", "external","auth_mode","deleted","allow_insecure_connection")
44+
SELECT 'opencost', 'https://opencost.github.io/opencost-helm-chart', 'f', 't', now(), 1, now(), 1, 't','ANONYMOUS','f','t'
45+
WHERE NOT EXISTS (
46+
SELECT 1 FROM "public"."chart_repo" WHERE "name" = 'opencost' and "active"=true and "deleted"=false
47+
);
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
* Copyright (c) 2024. Devtron Inc.
3+
*/
4+
5+
-- Remove cost module installation fields from cluster table
6+
ALTER TABLE "public"."cluster" DROP COLUMN IF EXISTS "cost_module_installation_status";
7+
ALTER TABLE "public"."cluster" DROP COLUMN IF EXISTS "cost_module_installation_error";
8+
ALTER TABLE "public"."cluster" DROP COLUMN IF EXISTS "cost_config";
9+
10+
11+
-- Drop default currency setting
12+
DELETE FROM "public"."attributes" WHERE key = 'defaultCurrency';
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright (c) 2024. Devtron Inc.
3+
*/
4+
5+
-- Add cost module installation status and configuration fields to cluster table
6+
ALTER TABLE "public"."cluster" ADD COLUMN IF NOT EXISTS "cost_module_installation_status" varchar(50);
7+
ALTER TABLE "public"."cluster" ADD COLUMN IF NOT EXISTS "cost_module_installation_error" text;
8+
9+
ALTER TABLE "public"."cluster" ADD COLUMN IF NOT EXISTS "gpu_installation_status" varchar(50);
10+
ALTER TABLE "public"."cluster" ADD COLUMN IF NOT EXISTS "gpu_installation_error" text;
11+
12+
ALTER TABLE "public"."cluster" ADD COLUMN IF NOT EXISTS "cost_config" jsonb;
13+
14+
-- Add default currency setting (only if it doesn't already exist)
15+
INSERT INTO "public"."attributes"(key, value, active, created_on, created_by, updated_on, updated_by)
16+
SELECT 'defaultCurrency', 'USD', 't', NOW(), 1, NOW(), 1
17+
WHERE NOT EXISTS (
18+
SELECT 1 FROM "public"."attributes"
19+
WHERE key = 'defaultCurrency'
20+
);
21+
22+
INSERT INTO "public"."chart_repo" ( "name", "url", "is_default", "active", "created_on", "created_by", "updated_on", "updated_by", "external","auth_mode","deleted","allow_insecure_connection")
23+
SELECT 'gpu-helm-charts', 'https://nvidia.github.io/dcgm-exporter/helm-charts', 'f', 't', now(), 1, now(), 1, 't','ANONYMOUS','f','t'
24+
WHERE NOT EXISTS (
25+
SELECT 1 FROM "public"."chart_repo" WHERE "name" = 'gpu-helm-charts' and "active"=true and "deleted"=false
26+
);
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
/*
2+
*
3+
* * Copyright (c) 2020-2024. Devtron Inc.
4+
*
5+
*/
6+
7+
-- revision: 1_initial_db_schema_up.sql
8+
-- description: Initial database schema creation
9+
-- created: 2025-10-25 12:00:00
10+
11+
DROP TABLE public.checkpoint_blobs CASCADE;
12+
13+
DROP TABLE public.checkpoint_migrations CASCADE;
14+
15+
DROP TABLE public.checkpoint_writes CASCADE;
16+
17+
DROP TABLE public.checkpoints CASCADE;
18+
19+
20+
21+
DROP TABLE public.chat_graph_data CASCADE;
22+
23+
DROP TABLE public.chat_message_parts CASCADE;
24+
25+
DROP TABLE public.chat_messages CASCADE;
26+
27+
DROP TABLE public.chat_threads CASCADE;
28+
29+
DROP TABLE public.master_audit_logs CASCADE;
30+
31+
DROP TABLE public.recommendation_feeds CASCADE;
32+
33+
DROP TABLE public.runbook CASCADE;
34+
35+
DROP TABLE public.runbook_approval_status CASCADE;
36+
37+
DROP TABLE public.user_recommendation_feed_interactions CASCADE;
38+
39+
DROP TABLE public.wrk_eng_activity_trail CASCADE;
40+
41+
DROP TABLE public.wrk_eng_resource_discovery CASCADE;
42+
43+
DROP TABLE public.wrk_eng_resource_recommendation_bucket CASCADE;
44+
45+
DROP TABLE public.wrk_eng_runbook_transition_log CASCADE;
46+
47+
DROP TABLE public.wrk_eng_thought_process CASCADE;
48+
49+
50+
51+
DROP TYPE public.approvalstatus;
52+
53+
DROP TYPE public.messagestatusenum;
54+
55+
DROP TYPE public.recipienttypeenum;
56+
57+
DROP TYPE public.recommendationfeedpriority;
58+
59+
DROP TYPE public.recommendationfeedstatus;
60+
61+
DROP TYPE public.runbookstatus;
62+
63+
DROP TYPE public.sendertypeenum;
64+
65+
DROP TYPE public.threadstatusenum;
66+
67+
DROP TYPE public.userrecommendationfeedinteractionstatus;
68+
69+
DROP TYPE public.windowtype;
70+
71+
DROP TYPE public.windowunit;
72+

0 commit comments

Comments
 (0)