From 52af480c4aa95dfc31ab0f5c8da692a73bb03e66 Mon Sep 17 00:00:00 2001 From: "SANDHYA.JS" Date: Thu, 22 May 2025 17:00:15 +0530 Subject: [PATCH] Advacned Cluster Management Enhancements - Added force dleete support in KSU, OKA, Profile and cluster - Integrated upgrade api in cluster Change-Id: Iaa0b342ce5e33b239e2f76622f3f837961e1cd8c Signed-off-by: SANDHYA.JS --- .../k8s/k8s-action/K8sActionComponent.html | 20 ++++------ src/app/k8s/k8s-action/K8sActionComponent.ts | 7 +++- .../K8sAddClusterComponent.html | 22 +---------- .../k8s-add-cluster/K8sAddClusterComponent.ts | 38 ++----------------- src/app/utilities/delete/DeleteComponent.ts | 12 ++++++ .../OkaPackagesActionComponent.html | 24 +++++++----- .../OkaPackagesActionComponent.ts | 5 ++- 7 files changed, 47 insertions(+), 81 deletions(-) diff --git a/src/app/k8s/k8s-action/K8sActionComponent.html b/src/app/k8s/k8s-action/K8sActionComponent.html index 28c3fd8..f545606 100644 --- a/src/app/k8s/k8s-action/K8sActionComponent.html +++ b/src/app/k8s/k8s-action/K8sActionComponent.html @@ -24,21 +24,25 @@ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.i placement="top" container="body" ngbTooltip="{{'INFO' | translate}}"> - - - +
@@ -80,14 +84,6 @@ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.i (click)="editCluster('upgrade')" container="body" ngbTooltip="{{'PAGE.K8S.UPGRADECLUSTER' | translate}}"> {{'PAGE.K8S.UPGRADECLUSTER' | translate}} - -
-
-
- -
- -
-
-
- -
- -
-
@@ -189,7 +169,7 @@ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.i -
diff --git a/src/app/k8s/k8s-add-cluster/K8sAddClusterComponent.ts b/src/app/k8s/k8s-add-cluster/K8sAddClusterComponent.ts index 37ddc13..34ceeab 100644 --- a/src/app/k8s/k8s-add-cluster/K8sAddClusterComponent.ts +++ b/src/app/k8s/k8s-add-cluster/K8sAddClusterComponent.ts @@ -67,7 +67,7 @@ export class K8sAddClusterComponent implements OnInit { public selectedDeploymentMethods: string[] = ['helm-chart-v3', 'juju-bundle']; /** Contains all action types */ - public actionTypes: string[] = ['update', 'upgrade', 'horizontal', 'vertical']; + public actionTypes: string[] = ['update', 'upgrade']; /** Instance for active modal service @public */ public activeModal: NgbActiveModal; @@ -175,8 +175,6 @@ export class K8sAddClusterComponent implements OnInit { node_size: ['', [Validators.required]], bootstrap: [true], k8sVersion: ['', [Validators.required]], - nodeCount: ['', [Validators.required]], - nodeSize: ['', [Validators.required]], update: [''] }); } @@ -204,10 +202,6 @@ export class K8sAddClusterComponent implements OnInit { this.k8sclusterForm.patchValue({ update: k8sData.name, description: !isNullOrUndefined(k8sData.description) ? k8sData.description : '' }); } else if (this.profileType === 'upgrade') { this.k8sclusterForm.patchValue({ k8sVersion: !isNullOrUndefined(k8sData.k8s_version) ? k8sData.k8s_version : '' }); - } else if (this.profileType === 'horizontal') { - this.k8sclusterForm.patchValue({ nodeCount: !isNullOrUndefined(k8sData.node_count) ? k8sData.node_count : '' }); - } else if (this.profileType === 'vertical') { - this.k8sclusterForm.patchValue({ nodeSize: !isNullOrUndefined(k8sData.node_size) ? k8sData.node_size : '' }); } this.isLoadingResults = false; }, (error: ERRORDATA) => { @@ -234,8 +228,6 @@ export class K8sAddClusterComponent implements OnInit { this.getFormControl('credentials').disable(); this.getFormControl('deployment_methods').disable(); this.getFormControl('k8sVersion').disable(); - this.getFormControl('nodeSize').disable(); - this.getFormControl('nodeCount').disable(); this.getFormControl('update').disable(); this.manageCluster(); } else if (this.profileType === 'Register' && this.isChecked === true) { @@ -248,8 +240,6 @@ export class K8sAddClusterComponent implements OnInit { this.getFormControl('nets').disable(); this.getFormControl('deployment_methods').disable(); this.getFormControl('k8sVersion').disable(); - this.getFormControl('nodeSize').disable(); - this.getFormControl('nodeCount').disable(); this.getFormControl('update').disable(); this.registerCluster(); } if (this.isChecked === false && this.profileType === 'Register') { @@ -260,12 +250,10 @@ export class K8sAddClusterComponent implements OnInit { this.getFormControl('node_count').disable(); this.getFormControl('node_size').disable(); this.getFormControl('k8sVersion').disable(); - this.getFormControl('nodeSize').disable(); - this.getFormControl('nodeCount').disable(); this.getFormControl('update').disable(); this.oldregisterCluster(); - } else if (this.profileType === 'upgrade' || this.profileType === 'horizontal' || this.profileType === 'vertical') { - this.clusterUrl = environment.K8SCREATECLUSTER_URL + '/' + this.profileID + '/' + 'update'; + } else if (this.profileType === 'upgrade') { + this.clusterUrl = environment.K8SCREATECLUSTER_URL + '/' + this.profileID + '/' + 'upgrade'; this.getFormControl('region_name').disable(); this.getFormControl('resource_group').disable(); this.getFormControl('nets').disable(); @@ -279,16 +267,6 @@ export class K8sAddClusterComponent implements OnInit { this.getFormControl('node_size').disable(); this.getFormControl('k8s_version').disable(); this.getFormControl('update').disable(); - if (this.profileType === 'upgrade') { - this.getFormControl('nodeCount').disable(); - this.getFormControl('nodeSize').disable(); - } else if (this.profileType === 'vertical') { - this.getFormControl('nodeCount').disable(); - this.getFormControl('k8sVersion').disable(); - } else if (this.profileType === 'horizontal') { - this.getFormControl('nodeSize').disable(); - this.getFormControl('k8sVersion').disable(); - } this.updateCluster(); } else if (this.profileType === 'update') { this.clusterUrl = environment.K8SCREATECLUSTER_URL + '/' + this.profileID; @@ -302,9 +280,7 @@ export class K8sAddClusterComponent implements OnInit { this.getFormControl('node_count').disable(); this.getFormControl('node_size').disable(); this.getFormControl('k8s_version').disable(); - this.getFormControl('nodeCount').disable(); this.getFormControl('k8sVersion').disable(); - this.getFormControl('nodeSize').disable(); this.getFormControl('name').disable(); this.editCluster(); @@ -486,14 +462,6 @@ export class K8sAddClusterComponent implements OnInit { this.payload = { k8s_version: this.k8sclusterForm.value.k8sVersion }; - } else if (this.profileType === 'vertical') { - this.payload = { - node_size: (this.k8sclusterForm.value.nodeSize) - }; - } else if (this.profileType === 'horizontal') { - this.payload = { - node_count: Number(this.k8sclusterForm.value.nodeCount) - }; } this.isLoadingResults = true; this.restService.postResource(apiURLHeader, this.payload).subscribe((result: {}) => { diff --git a/src/app/utilities/delete/DeleteComponent.ts b/src/app/utilities/delete/DeleteComponent.ts index 9a8a0d8..f65712d 100644 --- a/src/app/utilities/delete/DeleteComponent.ts +++ b/src/app/utilities/delete/DeleteComponent.ts @@ -229,18 +229,25 @@ export class DeleteComponent { this.deleteURL = environment.NSCONFIGTEMPLATE_URL; this.notifyMessage = 'DELETEDSUCCESSFULLY'; } else if (data.page === 'k8-infra-profile') { + this.forceDelete = this.params.forceDeleteType; this.deleteURL = environment.K8SINFRACONFIGPROFILE_URL; } else if (data.page === 'k8-infra-controller') { + this.forceDelete = this.params.forceDeleteType; this.deleteURL = environment.K8SINFRACONTROLLERPROFILE_URL; } else if (data.page === 'k8-app-profile') { + this.forceDelete = this.params.forceDeleteType; this.deleteURL = environment.K8SAPPPROFILE_URL; } else if (data.page === 'k8-resource-profile') { + this.forceDelete = this.params.forceDeleteType; this.deleteURL = environment.K8SRESOURCEPROFILE_URL; } else if (data.page === 'oka-packages') { + this.forceDelete = this.params.forceDeleteType; this.deleteURL = environment.OKAPACKAGES_URL; } else if (data.page === 'k8-ksu') { + this.forceDelete = this.params.forceDeleteType; this.deleteURL = environment.KSU_URL; } else if (data.page === 'k8-cluster') { + this.forceDelete = this.params.forceDeleteType; this.page = data.page; } } @@ -252,6 +259,11 @@ export class DeleteComponent { }; let deletingURl: string = ''; if (this.forceDelete) { + if (this.page === 'k8-cluster') { + if (this.createdbyosm === 'true') { + this.deleteURL = environment.K8SCREATECLUSTER_URL; + } + } deletingURl = this.deleteURL + '/' + this.id + '?FORCE=true'; this.notifyMessage = 'DELETEDSUCCESSFULLY'; } else if (this.page === 'k8-cluster') { diff --git a/src/app/utilities/oka-packages-action/OkaPackagesActionComponent.html b/src/app/utilities/oka-packages-action/OkaPackagesActionComponent.html index ca48eb6..c7627d8 100644 --- a/src/app/utilities/oka-packages-action/OkaPackagesActionComponent.html +++ b/src/app/utilities/oka-packages-action/OkaPackagesActionComponent.html @@ -16,13 +16,17 @@ limitations under the License. Author: SANDHYA JS (sandhya.j@tataelxsi.co.in) -->
- - -
- \ No newline at end of file + + + +
+ \ No newline at end of file diff --git a/src/app/utilities/oka-packages-action/OkaPackagesActionComponent.ts b/src/app/utilities/oka-packages-action/OkaPackagesActionComponent.ts index 6fdbd1b..37ae771 100644 --- a/src/app/utilities/oka-packages-action/OkaPackagesActionComponent.ts +++ b/src/app/utilities/oka-packages-action/OkaPackagesActionComponent.ts @@ -75,9 +75,12 @@ export class OkaPackagesActionComponent { } /** Delete NS Config oka @public */ - public deleteoka(): void { + public deleteoka(forceAction: boolean): void { // eslint-disable-next-line security/detect-non-literal-fs-filename const modalRef: NgbModalRef = this.modalService.open(DeleteComponent, { backdrop: 'static' }); + modalRef.componentInstance.params = { + forceDeleteType: forceAction + }; modalRef.result.then((result: MODALCLOSERESPONSEDATA) => { if (result) { this.sharedService.callData(); -- 2.25.1