Advacned Cluster Management Enhancements 03/15203/3
authorSANDHYA.JS <sandhya.j@tataelxsi.co.in>
Thu, 22 May 2025 11:30:15 +0000 (17:00 +0530)
committerjssan <sandhya.j@tataelxsi.co.in>
Mon, 23 Jun 2025 06:49:13 +0000 (08:49 +0200)
- Added force dleete support in KSU, OKA, Profile and cluster
- Integrated upgrade api in cluster

Change-Id: Iaa0b342ce5e33b239e2f76622f3f837961e1cd8c
Signed-off-by: SANDHYA.JS <sandhya.j@tataelxsi.co.in>
src/app/k8s/k8s-action/K8sActionComponent.html
src/app/k8s/k8s-action/K8sActionComponent.ts
src/app/k8s/k8s-add-cluster/K8sAddClusterComponent.html
src/app/k8s/k8s-add-cluster/K8sAddClusterComponent.ts
src/app/utilities/delete/DeleteComponent.ts
src/app/utilities/oka-packages-action/OkaPackagesActionComponent.html
src/app/utilities/oka-packages-action/OkaPackagesActionComponent.ts

index 28c3fd8..f545606 100644 (file)
@@ -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}}">
     <i class="fas fa-info icons list" title="info"></i>
   </button>
-  <button *ngIf="(isCluster  || isProfile || isKSU)" type="button" class="btn btn-primary" (click)="deleteK8s()"
+  <button *ngIf="(isCluster  || isProfile || isKSU)" type="button" class="btn btn-primary" (click)="deleteK8s(false)"
     placement="top" container="body" ngbTooltip="{{'DELETE' | translate}}">
     <i class="far fa-trash-alt icons" title="delete"></i>
   </button>
-  <button *ngIf="getK8sType === 'repo'" type="button" class="btn btn-primary" (click)="deleteK8s()" placement="top"
+  <button *ngIf="getK8sType === 'repo'" type="button" class="btn btn-primary" (click)="deleteK8s(false)" placement="top"
     container="body" ngbTooltip="{{'DELETE' | translate}}">
     <i class="far fa-trash-alt icons" title="delete"></i>
   </button>
-  <button *ngIf="!isCluster && !isKSU && !isProfile && getK8sType !== 'repo' " type="button" class="btn btn-primary" (click)="deleteK8s()" placement="top"
+  <button *ngIf="!isCluster && !isKSU && !isProfile && getK8sType !== 'repo' " type="button" class="btn btn-primary" (click)="deleteK8s(false)" placement="top"
     container="body" ngbTooltip="{{'DEREGISTER' | translate}}">
     <i class="fas fa-window-close icons" title="deregister"></i>
   </button>
   <button *ngIf="isProfile" type="button" class="btn btn-primary" placement="top" container="body"
     (click)="editProfile(getK8sType)" ngbTooltip="{{'PAGE.K8S.EDITPROFILE' | translate}}">
     <i class="fa fa-edit icons"></i>
+  </button>
+   <button *ngIf="(isCluster  || isProfile || isKSU || !isCluster && getK8sType !== 'repo')" type="button" class="btn btn-primary" (click)="deleteK8s(true)"
+    placement="top" container="body" [disabled]="!isCluster && !isProfile && !isKSU" ngbTooltip="{{'FORCEDELETE' | translate}}">
+    <i class="fas fa-trash-alt icons text-danger" title="delete"></i>
   </button>
   <div *ngIf="isCluster || !isCluster && !isKSU && !isProfile && getK8sType !== 'repo' " class="btn-group" placement="bottom-right" ngbDropdown
     display="dynamic" container="body">
@@ -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}}">
         <i class="fa fa-arrow-up"></i> {{'PAGE.K8S.UPGRADECLUSTER' | translate}}
       </button>
-      <button *ngIf="isCluster" type="button" class="btn btn-primary dropdown-item" placement="left"
-        (click)="editCluster('horizontal')" container="body" ngbTooltip="{{'PAGE.K8S.HORIZONTALSCALING' | translate}}">
-        <i class="fas fa-arrows-alt-h"></i> {{'PAGE.K8S.HORIZONTALSCALING' | translate}}
-      </button>
-      <button *ngIf="isCluster" type="button" class="btn btn-primary dropdown-item" placement="left"
-        (click)="editCluster('vertical')" container="body" ngbTooltip="{{'PAGE.K8S.VERTICALSCALING' | translate}}">
-        <i class="fas fa-arrows-alt-v"></i> {{'PAGE.K8S.VERTICALSCALING' | translate}}
-      </button>
       <button *ngIf="isCluster" type="button" class="btn btn-primary dropdown-item" placement="left"
         (click)="getCredentials()" container="body" ngbTooltip="{{'PAGE.K8S.GETCREDENTIALS' | translate}}">
         <i class="fas fa-download icons"></i> {{'PAGE.K8S.GETCREDENTIALS' | translate}}
@@ -95,7 +91,7 @@ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.i
     </div>
   </div>
   <div *ngIf="isKSU" class="btn-group" ngbDropdown display="dynamic" container="body">
-    <button type="button" class="btn btn-primary dropdown-toggle action-button" ngbDropdownToggle>
+    <button type="button" class="btn btn-primary dropdown-toggle action-button" [disabled]="state != 'CREATED'" ngbDropdownToggle>
       {{'ACTION' | translate}}
     </button>
     <div class="dropdown-menu list-action-dropdown" ngbDropdownMenu>
index bbd574f..919dda1 100644 (file)
@@ -133,16 +133,19 @@ export class K8sActionComponent {
     }
 
     if (this.getK8sType === 'infra-config' || this.getK8sType === 'infra-controller' || this.getK8sType === 'app-profile' || this.getK8sType === 'resource-profile') {
-    this.isProfile = true;
+      this.isProfile = true;
     } else {
       this.isProfile = false;
     }
   }
 
   /** Delete User Account @public */
-  public deleteK8s(): void {
+  public deleteK8s(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();
index e8b57b6..e9ac743 100644 (file)
@@ -29,12 +29,6 @@ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.i
     <h4 *ngIf="profileType === 'update'" class="modal-title" id="modal-basic-title">{{'PAGE.K8S.UPDATECLUSTER' |
       translate}}
     </h4>
-    <h4 *ngIf="profileType === 'vertical'" class="modal-title" id="modal-basic-title">{{'PAGE.K8S.VERTICALSCALING' |
-      translate}}
-    </h4>
-    <h4 *ngIf="profileType === 'horizontal'" class="modal-title" id="modal-basic-title">{{'PAGE.K8S.HORIZONTALSCALING' |
-      translate}}
-    </h4>
     <button class="button-xs" type="button" class="close" aria-label="Close" (click)="activeModal.close()">
       <i class="fas fa-times-circle text-danger"></i>
     </button>
@@ -163,20 +157,6 @@ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.i
           required>
       </div>
     </div>
-    <div class="form-group row mb-3" *ngIf="profileType === 'horizontal'">
-      <label class="col-sm-4 col-form-label" for="node_count">{{'PAGE.K8S.NODECOUNT' | translate}}</label>
-      <div class="col-sm-8">
-        <input autocomplete="off" class="form-control" placeholder="{{'PAGE.K8S.NODECOUNT' | translate}}" type="text"
-          formControlName="nodeCount" id="node_count" [ngClass]="{ 'is-invalid': submitted && f.nodeCount.errors }">
-      </div>
-    </div>
-    <div class="form-group row mb-3" *ngIf="profileType === 'vertical'">
-      <label class="col-sm-4 col-form-label" for="k8s_version">{{'PAGE.K8S.NODESIZE' | translate}}</label>
-      <div class="col-sm-8">
-        <input autocomplete="off" class="form-control" placeholder="{{'PAGE.K8S.NODESIZE' | translate}}" type="text"
-          formControlName="nodeSize" id="k8s_version" [ngClass]="{ 'is-invalid': submitted && f.nodeSize.errors }">
-      </div>
-    </div>
     <div class="form-group row mb-3" *ngIf="profileType === 'upgrade'">
       <label class="col-sm-4 col-form-label" for="k8s_version">{{'PAGE.K8S.K8SVERSION' | translate}}</label>
       <div class="col-sm-8">
@@ -189,7 +169,7 @@ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.i
     <button type="button" class="btn btn-danger" (click)="activeModal.close()">{{'CANCEL' | translate}}</button>
     <button *ngIf="profileType === 'Manage'" type="submit" class="btn btn-primary">{{'CREATE' | translate}}</button>
     <button *ngIf="profileType === 'Register'" type="submit" class="btn btn-primary">{{'REGISTER' | translate}}</button>
-    <button *ngIf="profileType === 'upgrade' || profileType === 'vertical' || profileType === 'horizontal' || profileType === 'update'"
+    <button *ngIf="profileType === 'upgrade'|| profileType === 'update'"
       type="submit" class="btn btn-primary">{{'APPLY'
       | translate}}</button>
   </div>
index 37ddc13..34ceeab 100644 (file)
@@ -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: {}) => {
index 9a8a0d8..f65712d 100644 (file)
@@ -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') {
index ca48eb6..c7627d8 100644 (file)
@@ -16,13 +16,17 @@ limitations under the License.
 Author: SANDHYA JS (sandhya.j@tataelxsi.co.in)
 -->
 <div class="btn-group list action" role="group">
-    <button [disabled]="state != 'CREATED'" type="button" class="btn btn-primary" (click)="deleteoka()" placement="top" container="body"
-      ngbTooltip="{{'DELETE' | translate}}">
-      <i class="far fa-trash-alt icons"></i>
-    </button>
-    <button [disabled]="state != 'CREATED'" type="button" class="btn btn-primary" (click)="okaEdit()" placement="top" container="body"
-      ngbTooltip="{{'EDIT' | translate}}">
-      <i class="far fa-edit icons"></i>
-    </button>
-  </div>
-  <app-loader [waitingMessage]="message" *ngIf="isLoadingDownloadResult"></app-loader>
\ No newline at end of file
+  <button type="button" class="btn btn-primary" (click)="deleteoka(false)"
+    placement="top" container="body" ngbTooltip="{{'DELETE' | translate}}">
+    <i class="far fa-trash-alt icons"></i>
+  </button>
+  <button [disabled]="state != 'CREATED'" type="button" class="btn btn-primary" (click)="okaEdit()" placement="top"
+    container="body" ngbTooltip="{{'EDIT' | translate}}">
+    <i class="far fa-edit icons"></i>
+  </button>
+  <button type="button" class="btn btn-primary" (click)="deleteoka(true)"
+    placement="top" container="body" ngbTooltip="{{'FORCEDELETE' | translate}}">
+    <i class="fas fa-trash-alt icons text-danger" title="delete"></i>
+  </button>
+</div>
+<app-loader [waitingMessage]="message" *ngIf="isLoadingDownloadResult"></app-loader>
\ No newline at end of file
index 6fdbd1b..37ae771 100644 (file)
@@ -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();