From: Nizamudeen A Date: Wed, 24 Aug 2022 07:47:50 +0000 (+0530) Subject: mgr/dashboard: fix unable to create ingress unmanaged X-Git-Tag: v16.2.11~229^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8198ecfa2a469757eae00290a466e166f8257a39;p=ceph.git mgr/dashboard: fix unable to create ingress unmanaged the following snipped is the error from backend ``` File "/lib/python3.6/site-packages/ceph/deployment/service_spec.py", line 698, in _from_json_impl _cls.validate() File "/lib/python3.6/site-packages/ceph/deployment/service_spec.py", line 1058, in validate 'Cannot add ingress: No frontend_port specified') ceph.deployment.hostspec.SpecValidationError: Cannot add ingress: No frontend_port specified ``` It looks like even if we set unmanaged flag, we need to input the backend_service, frontend_port, monitor_port and virtual_ip, because there is a validation going for that in the backend. https://github.com/ceph/ceph/blob/main/src/python-common/ceph/deployment/service_spec.py#L1050 Fixes: https://tracker.ceph.com/issues/57284 Signed-off-by: Nizamudeen A (cherry picked from commit ea68560e148cf46dd69982120605519aba3a8955) --- diff --git a/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/services.po.ts b/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/services.po.ts index a7959c7b355f..481d6bc9b4d3 100644 --- a/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/services.po.ts +++ b/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/services.po.ts @@ -41,17 +41,21 @@ export class ServicesPageHelper extends PageHelper { exist?: boolean, count = '1', snmpVersion?: string, - snmpPrivProtocol?: boolean + snmpPrivProtocol?: boolean, + unmanaged = false ) { cy.get(`${this.pages.create.id}`).within(() => { this.selectServiceType(serviceType); switch (serviceType) { case 'rgw': cy.get('#service_id').type('foo'); - cy.get('#count').type(count); + unmanaged ? cy.get('label[for=unmanaged]').click() : cy.get('#count').type(count); break; case 'ingress': + if (unmanaged) { + cy.get('label[for=unmanaged]').click(); + } this.selectOption('backend_service', 'rgw.foo'); cy.get('#service_id').should('have.value', 'rgw.foo'); cy.get('#virtual_ip').type('192.168.100.1/24'); @@ -61,7 +65,7 @@ export class ServicesPageHelper extends PageHelper { case 'nfs': cy.get('#service_id').type('testnfs'); - cy.get('#count').type(count); + unmanaged ? cy.get('label[for=unmanaged]').click() : cy.get('#count').type(count); break; case 'snmp-gateway': @@ -85,7 +89,7 @@ export class ServicesPageHelper extends PageHelper { default: cy.get('#service_id').type('test'); - cy.get('#count').type(count); + unmanaged ? cy.get('label[for=unmanaged]').click() : cy.get('#count').type(count); break; } if (serviceType === 'snmp-gateway') { @@ -159,6 +163,18 @@ export class ServicesPageHelper extends PageHelper { }); } + isUnmanaged(serviceName: string, unmanaged: boolean) { + this.getTableCell(this.columnIndex.service_name, serviceName) + .parent() + .find(`datatable-body-cell:nth-child(${this.columnIndex.placement})`) + .should(($ele) => { + const placement = $ele.text().split(';'); + unmanaged + ? expect(placement).to.include('unmanaged') + : expect(placement).to.not.include('unmanaged'); + }); + } + deleteService(serviceName: string) { const getRow = this.getTableCell.bind(this, this.columnIndex.service_name); getRow(serviceName).click(); diff --git a/src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/09-services.e2e-spec.ts b/src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/09-services.e2e-spec.ts index 360bb3a92e9e..ed9ffb9890a1 100644 --- a/src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/09-services.e2e-spec.ts +++ b/src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/09-services.e2e-spec.ts @@ -103,4 +103,12 @@ describe('Services page', () => { services.deleteService('snmp-gateway'); }); + + it('should create ingress as unmanaged', () => { + services.navigateTo('create'); + services.addService('ingress', false, undefined, undefined, undefined, true); + services.checkExist('ingress.rgw.foo', true); + services.isUnmanaged('ingress.rgw.foo', true); + services.deleteService('ingress.rgw.foo'); + }); }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-form/service-form.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-form/service-form.component.html index c9cdc70b0cce..986d8d3aa85c 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-form/service-form.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-form/service-form.component.html @@ -326,7 +326,7 @@ - +
-
+