Skip to content

chore: add conditions#385

Merged
rollandf merged 1 commit into
Mellanox:mainfrom
dahalperin:main
Jun 30, 2026
Merged

chore: add conditions#385
rollandf merged 1 commit into
Mellanox:mainfrom
dahalperin:main

Conversation

@dahalperin

Copy link
Copy Markdown
Contributor

No description provided.

@dahalperin dahalperin requested a review from rollandf June 24, 2026 07:14
@github-actions

Copy link
Copy Markdown

@greptile-apps

greptile-apps Bot commented Jun 24, 2026

Copy link
Copy Markdown

Greptile Summary

This PR documents the new status.conditions[] feature for NicClusterPolicy and NicNodePolicy, following the standard Kubernetes metav1.Condition model. It adds a comprehensive new section to life-cycle-management.rst (condition field model, per-component types, aggregate Ready logic, kubectl query examples, and three annotated YAML status examples) and updates the CRD reference in crds.rst to reflect the new field on both status types.

  • docs/life-cycle-management.rst: New ~370-line "NicClusterPolicy Status Conditions" section covering the full condition lifecycle, with a note that NicNodePolicy exposes the same model for its three managed components.
  • docs/customizations/crds.rst: ConditionHolder interface entry added; conditions field row appended to both NicClusterPolicyStatus and NicNodePolicyStatus tables with a link to the upstream Kubernetes metav1.Condition reference.

Confidence Score: 4/5

Documentation-only PR that is safe to merge; the heading hierarchy mismatch in the new subsections remains unresolved from the prior review thread.

The content is accurate and internally consistent. The heading style issue in life-cycle-management.rst (using top-level ### overline inside a section that should use ^) was flagged in a prior review and remains open, which means docutils may flag a title-level inconsistency at build time.

docs/life-cycle-management.rst — heading levels for the new subsections should be verified against the file's declared hierarchy before merging.

Important Files Changed

Filename Overview
docs/life-cycle-management.rst Adds a large new "NicClusterPolicy Status Conditions" section (~370 lines) covering the condition field model, per-component types, aggregate Ready logic, kubectl examples, and three YAML status examples; also cleans up trailing whitespace. The heading hierarchy for the new subsections uses the top-level ### overline style instead of the ^ level required by the file's own comment at line 17.
docs/customizations/crds.rst Adds a new ConditionHolder interface entry and appends a conditions field row to both NicClusterPolicyStatus and NicNodePolicyStatus tables, with a link to the upstream Kubernetes metav1.Condition reference.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Reconcile Loop] --> B{For each configured component}
    B --> C[Component state = ready]
    B --> D[Component state = notReady]
    B --> E[Component state = error]
    B --> F[Component state = ignore]
    C --> G["condition: status=True\nreason=ComponentReady"]
    D --> H["condition: status=False\nreason=ComponentNotReady"]
    E --> I["condition: status=False\nreason=ComponentError"]
    F --> J[No condition written / stale pruned]
    G & H & I --> K[Aggregate Ready condition]
    K --> L{Any ComponentError?}
    L -- Yes --> M["Ready: False\nreason=ComponentError"]
    L -- No --> N{Any ComponentNotReady?}
    N -- Yes --> O["Ready: False\nreason=ComponentsNotReady"]
    N -- No --> P["Ready: True\nreason=AllComponentsReady"]
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A[Reconcile Loop] --> B{For each configured component}
    B --> C[Component state = ready]
    B --> D[Component state = notReady]
    B --> E[Component state = error]
    B --> F[Component state = ignore]
    C --> G["condition: status=True\nreason=ComponentReady"]
    D --> H["condition: status=False\nreason=ComponentNotReady"]
    E --> I["condition: status=False\nreason=ComponentError"]
    F --> J[No condition written / stale pruned]
    G & H & I --> K[Aggregate Ready condition]
    K --> L{Any ComponentError?}
    L -- Yes --> M["Ready: False\nreason=ComponentError"]
    L -- No --> N{Any ComponentNotReady?}
    N -- Yes --> O["Ready: False\nreason=ComponentsNotReady"]
    N -- No --> P["Ready: True\nreason=AllComponentsReady"]
Loading

Reviews (2): Last reviewed commit: "chore: ncp conditions" | Re-trigger Greptile

Comment on lines +141 to +143
#####################
Condition Field Model
#####################

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Heading style inconsistent with file convention

The file's comment on line 17 declares the heading hierarchy as # #, * *, =, -, ^, ", meaning # with overline is the top-level style and ^ is the sub-subsection style that should follow -. The existing ^ headings (e.g., Troubleshooting and Returning Pods…) were level 4 before this PR. Introducing ### (overline #) as a new level 4 inside this section demotes every existing ^ heading to level 5 while those ^ sections remain direct children of level-3 (---) headings — a level skip that docutils flags as "Title level inconsistent". Using ^ here (consistent with the rest of the file) avoids reassigning heading levels for the entire document.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Comment thread docs/common/vars.rst Outdated
.. |spectrum-x-operator-stig-rhel-repository| replace:: nvcr.io/nvidia/mellanox
.. |spectrum-x-operator-stig-ubuntu-version| replace:: network-operator-v26.4.0-stig-fips-ubuntu
.. |spectrum-x-operator-stig-ubuntu-repository| replace:: nvcr.io/nvidia/mellanox

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

not needed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

Comment thread docs/customizations/crds.rst Outdated
| ``appliedStates`` | AppliedStates provide a finer view of the observed state |
| :ref:`[]AppliedState <AppliedState>` | |
+---------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------+
| ``conditions`` | Standard Kubernetes conditions representing per-component and aggregate health. |

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

run make api-docs and commit the changes

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

Signed-off-by: Dana Halperin <dahalperin@nvidia.com>
@rollandf rollandf merged commit df5f151 into Mellanox:main Jun 30, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants