bernardodemarco commented on code in PR #9102:
URL: https://github.com/apache/cloudstack/pull/9102#discussion_r2152108804


##########
engine/schema/src/main/resources/META-INF/db/schema-42010to42100.sql:
##########
@@ -34,10 +34,47 @@ INSERT INTO `cloud`.`role_permissions` (uuid, role_id, 
rule, permission, sort_or
 SELECT uuid(), role_id, 'quotaCreditsList', permission, sort_order
 FROM `cloud`.`role_permissions` rp
 WHERE rp.rule = 'quotaStatement'
-AND NOT EXISTS(SELECT 1 FROM cloud.role_permissions rp_ WHERE rp.role_id = 
rp_.role_id AND rp_.rule = 'quotaCreditsList');
+  AND NOT EXISTS(SELECT 1 FROM cloud.role_permissions rp_ WHERE rp.role_id = 
rp_.role_id AND rp_.rule = 'quotaCreditsList');
 
 CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.host', 'last_mgmt_server_id', 
'bigint unsigned DEFAULT NULL COMMENT "last management server this host is 
connected to" AFTER `mgmt_server_id`');
 
+-----------------------------------------------------------
+-- CKS Enhancements:
+-----------------------------------------------------------
+-- Add for_cks column to the vm_template table
+CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.vm_template','for_cks', 'int(1) 
unsigned DEFAULT "0" COMMENT "if true, the template can be used for CKS cluster 
deployment"');
+
+-- Add support for different node types service offerings on CKS clusters
+CALL 
`cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.kubernetes_cluster','control_node_service_offering_id',
 'bigint unsigned COMMENT "service offering ID for Control Node(s)"');
+CALL 
`cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.kubernetes_cluster','worker_node_service_offering_id',
 'bigint unsigned COMMENT "service offering ID for Worker Node(s)"');
+CALL 
`cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.kubernetes_cluster','etcd_node_service_offering_id',
 'bigint unsigned COMMENT "service offering ID for etcd Nodes"');
+CALL 
`cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.kubernetes_cluster','etcd_node_count', 
'bigint unsigned COMMENT "number of etcd nodes to be deployed for the 
Kubernetes cluster"');
+CALL 
`cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.kubernetes_cluster','control_node_template_id',
 'bigint unsigned COMMENT "template id to be used for Control Node(s)"');
+CALL 
`cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.kubernetes_cluster','worker_node_template_id',
 'bigint unsigned COMMENT "template id to be used for Worker Node(s)"');
+CALL 
`cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.kubernetes_cluster','etcd_node_template_id',
 'bigint unsigned COMMENT "template id to be used for etcd Nodes"');
+CALL 
`cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.kubernetes_cluster','cni_config_id', 
'bigint unsigned COMMENT "user data id representing the associated cni 
configuration"');
+CALL 
`cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.kubernetes_cluster','cni_config_details',
 'varchar(4096) DEFAULT NULL COMMENT "user data details representing the values 
required for the cni configuration associated"');
+CALL 
`cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.kubernetes_cluster_vm_map','etcd_node', 
'tinyint(1) unsigned NOT NULL DEFAULT 0 COMMENT "indicates if the VM is an etcd 
node"');
+CALL 
`cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.kubernetes_cluster_vm_map','external_node',
 'tinyint(1) unsigned NOT NULL DEFAULT 0 COMMENT "indicates if the node was 
imported into the Kubernetes cluster"');
+CALL 
`cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.kubernetes_cluster_vm_map','manual_upgrade',
 'tinyint(1) unsigned NOT NULL DEFAULT 0 COMMENT "indicates if the node is 
marked for manual upgrade and excluded from the Kubernetes cluster upgrade 
operation"');
+CALL 
`cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.kubernetes_cluster_vm_map','kubernetes_node_version',
 'varchar(40) COMMENT "version of k8s the cluster node is on"');
+
+ALTER TABLE `cloud`.`kubernetes_cluster` ADD CONSTRAINT 
`fk_cluster__control_node_service_offering_id` FOREIGN KEY 
`fk_cluster__control_node_service_offering_id`(`control_node_service_offering_id`)
 REFERENCES `service_offering`(`id`) ON DELETE CASCADE;
+ALTER TABLE `cloud`.`kubernetes_cluster` ADD CONSTRAINT 
`fk_cluster__worker_node_service_offering_id` FOREIGN KEY 
`fk_cluster__worker_node_service_offering_id`(`worker_node_service_offering_id`)
 REFERENCES `service_offering`(`id`) ON DELETE CASCADE;
+ALTER TABLE `cloud`.`kubernetes_cluster` ADD CONSTRAINT 
`fk_cluster__etcd_node_service_offering_id` FOREIGN KEY 
`fk_cluster__etcd_node_service_offering_id`(`etcd_node_service_offering_id`) 
REFERENCES `service_offering`(`id`) ON DELETE CASCADE;
+ALTER TABLE `cloud`.`kubernetes_cluster` ADD CONSTRAINT 
`fk_cluster__control_node_template_id` FOREIGN KEY 
`fk_cluster__control_node_template_id`(`control_node_template_id`) REFERENCES 
`vm_template`(`id`) ON DELETE CASCADE;
+ALTER TABLE `cloud`.`kubernetes_cluster` ADD CONSTRAINT 
`fk_cluster__worker_node_template_id` FOREIGN KEY 
`fk_cluster__worker_node_template_id`(`worker_node_template_id`) REFERENCES 
`vm_template`(`id`) ON DELETE CASCADE;
+ALTER TABLE `cloud`.`kubernetes_cluster` ADD CONSTRAINT 
`fk_cluster__etcd_node_template_id` FOREIGN KEY 
`fk_cluster__etcd_node_template_id`(`etcd_node_template_id`) REFERENCES 
`vm_template`(`id`) ON DELETE CASCADE;

Review Comment:
   Should we have the `ON DELETE CASCADE` here?
   
   When deleting a service offering, for instance, the kubernetes cluster will 
be deleted from the DB, right?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to