Skip to content

mgr/dashboard: Current security configuration should be visible in edit page of nvme gateway service - #70733

Merged
nizamial09 merged 1 commit into
ceph:mainfrom
rhcs-dashboard:fix-78889-nvme-edit-security
Aug 24, 2026
Merged

nizamial09 merged 1 commit into
ceph:mainfrom
rhcs-dashboard:fix-78889-nvme-edit-security

Conversation

@pujaoshahu

@pujaoshahu pujaoshahu commented Jul 30, 2026 •

Copy link
Copy Markdown
image

Fixes: https://tracker.ceph.com/issues/78889
Signed-off-by: pujasohahu [email protected]

Summary :
Show current NVMe/TCP gateway security settings on the edit page (encryption key, mTLS/enable_auth, certificate type and cert fields).
Reuse cd-certificate-authority-form for mTLS certificate UI, and preselect existing hosts when editing a gateway group.

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

@pujaoshahu
pujaoshahu force-pushed the fix-78889-nvme-edit-security branch 4 times, most recently from 390cc53 to 5f6dbf7 Compare July 30, 2026 21:37
@pujaoshahu
pujaoshahu marked this pull request as ready for review July 30, 2026 21:38
@pujaoshahu
pujaoshahu requested a review from a team as a code owner July 30, 2026 21:38
@pujaoshahu
pujaoshahu force-pushed the fix-78889-nvme-edit-security branch from 5f6dbf7 to 3544a4a Compare July 31, 2026 05:38
@pujaoshahu

Copy link
Copy Markdown
Author

jenkins test dashboard

@pujaoshahu

Copy link
Copy Markdown
Author

jenkins test dashboard cephadm

1 similar comment
@pujaoshahu

Copy link
Copy Markdown
Author

jenkins test dashboard cephadm

@afreen23 afreen23 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR does a lot: edit-mode for gateway groups, shared component template reshuffling, text-label-list label positioning fix, certificate-authority-form layout rewrite. That's too many concerns for one PR, but reviewing what's here:

Shared component changes — need extra scrutiny

text-label-list template change affects ALL consumers

The label positioning change (moving {{ $index === 0 ? label : '' }} from after the input div to a block before it, with ​ for subsequent items) affects every consumer: service-form uses this component ~10 times for DNS names, SANs, custom configs, etc. The cds-text-label component expects its text content projection to be the label — moving it from after the input to before changes rendering order. Has this been tested against the service-form (RGW, ingress, NFS) edit flows?

certificate-authority-form layout rewrite

Replacing cdsRow/cdsCol/[condensed] grid with [cdsStack] throughout the certificate display. This is a visual-only change but it alters spacing for the existing service-form consumer too. The service-form mounts this component inside its own grid context — switching from grid to stack may break alignment there.

Functional issues

1. service_id change in tests is suspicious

Tests now expect service_id: 'default' instead of service_id: 'nvmeof.default'. The create path sets serviceId = groupName (not nvmeof.${groupName}). But the orchestrator/cephadm expects service_id to be the full nvmeof.<group> form for NVMe-oF services. If this is correct, it contradicts how service_id works for other service types. Verify against the backend CephService.create endpoint.

2. pendingHostReload race condition

The pendingHostReload flag in gateway-node component retries getHosts after the current fetch completes. But if the preselection arrives, sets pendingHostReload=true, and then the fetch finishes and re-fetches — the preselection might not be applied because preSelectedHostnames was set before the second fetch even started. The ngOnChanges handler for preSelectedHostnames only fires on input changes, not on data reload. Does the second fetch correctly apply preselection?

3. encryptionKey required validator removed silently

In the original code, when encryption is enabled, the form requires an encryption key (there's a required error span in the template). The PR changes enableEncryption.valueChanges to clear errors on disable, but on enable it no longer adds Validators.required to encryptionKey. The helper text changes to "Optional" — is it really optional to have encryption enabled with no key? If the backend requires it, the form will submit invalid data.

4. enableEncryption is now driven by !!encryptionKey not !!spec.ssl

populateFormFromService sets enableEncryption: !!encryptionKey. Previously it was enableEncryption: spec.ssl || false. These are different — a service can have ssl: true (mTLS) without encryption_key. This changes the semantics of the checkbox. The original meaning was "this group uses TLS/encryption at all"; now it means "this group has a specific encryption key set." Is that correct?

5. cols="100" replaced with class="w-100" for textareas

w-100 is a Bootstrap utility class. Per project rules, Bootstrap classes should not be used. Use style="width: 100%" or a Carbon token.

Missing

  • No unit tests for text-label-list label positioning change
  • No unit tests for certificate-authority-form layout (existing consumers)
  • pendingHostReload logic has no test coverage

@abhidesai6

Copy link
Copy Markdown

LGTM. The flow works as expected

@pujaoshahu
pujaoshahu force-pushed the fix-78889-nvme-edit-security branch from 3544a4a to d301e3c Compare August 4, 2026 05:21
Copilot AI balanced review requested due to automatic review settings August 4, 2026 05:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Displays existing NVMe/TCP gateway security and host settings when editing.

Changes:

  • Prepopulates encryption, mTLS, certificates, and gateway hosts.
  • Reuses the shared certificate authority form.
  • Adds host reload and edit-mode tests.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
text-label-list.component.spec.ts Tests label positioning.
text-label-list.component.html Aligns repeated inputs.
certificate-authority-form.component.html Refines certificate layout.
nvmeof-group-form.component.ts Loads and submits edit settings.
nvmeof-group-form.component.spec.ts Tests edit prepopulation and submission.
nvmeof-group-form.component.html Displays security and certificate controls.
nvmeof-gateway-node.component.ts Adds host reload and security details.
nvmeof-gateway-node.component.spec.ts Tests host reload behavior.
block.module.ts Imports the certificate form.
Suppressed comments (2)

src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-group-form/nvmeof-group-form.component.ts:268

  • This fallback also runs after host loading has completed. If an editor deliberately deselects every row, selected is empty and the original placement is silently submitted, so the button remains enabled and the user's change is ignored. Limit the fallback to the period while the child table is actually loading; once loaded, an empty selection must remain empty and fail the existing validation.
  private getSelectedOrPreselectedHosts(): string[] {
    const selected = this.gatewayNodeComponent?.getSelectedHostnames?.() || [];
    if (selected.length > 0) {
      return selected;
    }
    // Edit: fall back to loaded placement while table selection syncs
    return this.editing ? this.preSelectedHostnames : [];

src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-group-form/nvmeof-group-form.component.ts:355

  • The service update endpoint is task-backed and may return HTTP 202 before orchestration finishes. This path treats that acceptance response as final success, drops task tracking, and tells the user the group was updated even if the asynchronous task later fails. Keep the task registered and report success/failure from its completion; the separate transient gateway-read race should be suppressed without discarding the update task outcome.
    if (this.editing) {
      // On edit, navigate immediately once the orchestrator accepts the spec (HTTP 200/202).
      // Using taskWrapperService here would subscribe to the async task poller, which races
      // against the daemon restart and spuriously raises "Gateway group does not exist" from
      // the NVMe-oF gRPC layer before the new daemon is ready.

@pujaoshahu
pujaoshahu force-pushed the fix-78889-nvme-edit-security branch from d301e3c to 04e7262 Compare August 4, 2026 06:02
Copilot AI review requested due to automatic review settings August 4, 2026 06:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.

Suppressed comments (4)

src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-gateway-node/nvmeof-gateway-node.component.spec.ts:258

  • These tests do not exercise the retry path. of([]) completes synchronously before the second getHosts() call, and manually setting isLoadingHosts afterward leaves no active subscription whose finalize can launch the pending reload; the other two tests only cover ordinary single fetches. Use a Subject or delayed observable, call getHosts() again before completing it, then complete it and assert that the API was called twice and the updated preselection was applied.
    it('should set pendingHostReload when getHosts is called while a fetch is in-flight', fakeAsync(() => {
      spyOn(nvmeofService, 'getAvailableHosts').and.returnValue(of([]));
      component.getHosts(new CdTableFetchDataContext(() => undefined));
      component.isLoadingHosts = true;
      component.getHosts(new CdTableFetchDataContext(() => undefined));

src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-group-form/nvmeof-group-form.component.ts:349

  • Require all five PEM controls when mTLS uses an external certificate. Switching an existing internal service to External leaves these values empty, so this branch sends certificate_source: 'inline' while omitting every certificate; NvmeofServiceSpec.validate() rejects that payload (service_spec.py:2254-2265). The general service form already applies conditional required validators for this case (service-form.component.ts:238-301), so this form should block submission in the same way.
      if (formValues.certificateType === CertificateType.external) {
        if (formValues.rootCACert) {
          serviceSpec['root_ca_cert'] = formValues.rootCACert;
        }
        if (formValues.clientCert) {

src/pybind/mgr/dashboard/frontend/src/app/shared/components/text-label-list/text-label-list.component.spec.ts:155

  • This test never checks for a zero-width space; it only counts labels, so it still passes if the template renders empty content. Assert that each subsequent label's textContent contains \u200B to cover the behavior named by the test.
    it('should project a zero-width space as content for subsequent rows', () => {
      component.writeValue(['a', 'b']);
      fixture.detectChanges();

      // The template uses &#8203; for rows after the first; the component
      // must render 3 cds-text-label elements (a, b, and empty trailing input).
      const labels = fixture.debugElement.queryAll(By.css('cds-text-label'));
      expect(labels.length).toBe(3);

src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-group-form/nvmeof-group-form.component.ts:368

  • Do not treat the edit HTTP response as completed work. The service update endpoint is task-decorated and can return 202; bypassing TaskWrapperService immediately shows success and navigates away without registering the executing task, so a later orchestration failure is invisible. Keep task tracking for edits and address any daemon-restart race in the task handling instead.
    if (this.editing) {
      this.cephServiceService
        .update(serviceSpec)
        .pipe(
          tap(() => {

Copilot AI review requested due to automatic review settings August 4, 2026 06:25
@pujaoshahu
pujaoshahu force-pushed the fix-78889-nvme-edit-security branch from 04e7262 to 88c09d0 Compare August 4, 2026 06:25
@pujaoshahu

Copy link
Copy Markdown
Author

jenkins test dashboard cephadm

@pujaoshahu

Copy link
Copy Markdown
Author

jenkins test dashboard

@pujaoshahu

Copy link
Copy Markdown
Author

jenkins test dashboard cephadm

@pujaoshahu

Copy link
Copy Markdown
Author

jenkins test dashboard cephadm

@pujaoshahu
pujaoshahu force-pushed the fix-78889-nvme-edit-security branch 2 times, most recently from c0a6648 to d9966a4 Compare August 20, 2026 09:40
@pujaoshahu
pujaoshahu requested a review from afreen23 August 20, 2026 09:40
@github-project-automation github-project-automation Bot moved this from Review in progress to Reviewer approved in Ceph-Dashboard Aug 20, 2026
@pujaoshahu
pujaoshahu force-pushed the fix-78889-nvme-edit-security branch from d9966a4 to 9fc6816 Compare August 20, 2026 11:00
@pujaoshahu
pujaoshahu force-pushed the fix-78889-nvme-edit-security branch from 9fc6816 to 4051e31 Compare August 20, 2026 11:01
@pujaoshahu

Copy link
Copy Markdown
Author

jenkins test dashboard

@pujaoshahu

Copy link
Copy Markdown
Author

jenkins test dashboard

2 similar comments
@pujaoshahu

Copy link
Copy Markdown
Author

jenkins test dashboard

@pujaoshahu

Copy link
Copy Markdown
Author

jenkins test dashboard

@pujaoshahu
pujaoshahu force-pushed the fix-78889-nvme-edit-security branch from 4051e31 to e969d52 Compare August 21, 2026 11:28
@pujaoshahu

Copy link
Copy Markdown
Author

jenkins test dashboard

@pujaoshahu
pujaoshahu force-pushed the fix-78889-nvme-edit-security branch from e969d52 to 7698a00 Compare August 24, 2026 10:02
@github-actions

Copy link
Copy Markdown

This is an automated message by src/script/redmine-upkeep.py.

I have resolved the following tracker ticket due to the merge of this PR:

No backports are pending for the ticket. If this is incorrect, please update the tracker
ticket and reset to Pending Backport state.

Update Log: https://github.com/ceph/ceph/actions/runs/32728797156

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

6 participants