Skip to content

Conversation

@cajieh
Copy link
Contributor

@cajieh cajieh commented Nov 24, 2025

… console

@openshift-ci-robot openshift-ci-robot added jira/severity-moderate Referenced Jira bug's severity is moderate for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Nov 24, 2025
@openshift-ci-robot
Copy link
Contributor

@cajieh: This pull request references Jira Issue OCPBUGS-65678, which is invalid:

  • expected the bug to target the "4.21.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

In response to this:

… console

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai
Copy link

coderabbitai bot commented Nov 24, 2025

Walkthrough

Added two new default YAML templates (MachineConfigModel and ServiceMonitorModel) to the YAML templates file, and adjusted the default-template detection in the Create YAML component to use the resolved template when calculating isDefaultTemplate. No exported APIs were changed.

Changes

Cohort / File(s) Summary
YAML template additions
frontend/public/models/yaml-templates.ts
Added two new default templates: a MachineConfigModel template containing an OpenShift MachineConfig manifest with ignition version, storage files, and a sample /etc/example-config file; and a ServiceMonitorModel template containing a ServiceMonitor manifest with a basic app selector and endpoint configuration.
Create YAML behavior tweak
frontend/public/components/create-yaml.tsx
In CreateYAMLInner, changed the isDefaultTemplate calculation to compare against resolvedTemplate instead of template, aligning the default check with how resolvedTemplate is chosen and used elsewhere.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Review YAML manifest syntax and ensure indentation/escaping and resource fields match expected schemas for MachineConfig and ServiceMonitor.
  • Validate the ignition storage/file content and keys (paths, permissions) for MachineConfig template.
  • Verify the ServiceMonitor template matches PrometheusOperator expectations (selector, endpoints).
  • Confirm the isDefaultTemplate change doesn't alter UI flows unexpectedly (template selection, initial resource rendering).
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between 36ec7c3 and b4e519c.

📒 Files selected for processing (2)
  • frontend/public/components/create-yaml.tsx (1 hunks)
  • frontend/public/models/yaml-templates.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • frontend/public/models/yaml-templates.ts
🧰 Additional context used
📓 Path-based instructions (1)
**

⚙️ CodeRabbit configuration file

-Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity.

Files:

  • frontend/public/components/create-yaml.tsx
🔇 Additional comments (1)
frontend/public/components/create-yaml.tsx (1)

66-67: Bug fix correctly aligns default template detection with resolved template.

The change fixes a logic error where isDefaultTemplate was comparing the template prop (often undefined when no custom template is provided) instead of the resolvedTemplate that's actually used. When template is undefined, the fallback chain resolves to either a model-specific or DEFAULT template, but the old check would incorrectly return false. This prevented the apiVersion override (lines 77-78) from being applied, likely causing the runtime error mentioned in the PR title when creating resources with the default template.

The fix correctly identifies when the DEFAULT template is being used after resolution.


Comment @coderabbitai help to get the list of available commands and usage tips.

@cajieh
Copy link
Contributor Author

cajieh commented Nov 24, 2025

/jira refresh

@openshift-ci-robot openshift-ci-robot added jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. and removed jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Nov 24, 2025
@openshift-ci-robot
Copy link
Contributor

@cajieh: This pull request references Jira Issue OCPBUGS-65678, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.21.0) matches configured target version for branch (4.21.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @yapei

In response to this:

/jira refresh

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci bot requested review from Leo6Leo, spadgett and yapei November 24, 2025 15:48
@openshift-ci openshift-ci bot added the component/core Related to console core functionality label Nov 24, 2025
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Nov 24, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cajieh

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 24, 2025
@cajieh cajieh force-pushed the runtime-error-create-machineConfig-default-yaml- branch from 36ec7c3 to b4e519c Compare November 24, 2025 16:09
@cajieh cajieh changed the title OCPBUGS-65678: Runtime error occurs when create MachineConfig with default yaml from… [WIP] OCPBUGS-65765, OCPBUGS-65678: apiVersion is empty on YAML creation page - Runtime error occurs when create MachineConfig with default yaml from… Nov 24, 2025
@openshift-ci-robot openshift-ci-robot added jira/severity-important Referenced Jira bug's severity is important for the branch this PR is targeting. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. and removed jira/severity-moderate Referenced Jira bug's severity is moderate for the branch this PR is targeting. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. labels Nov 24, 2025
@openshift-ci-robot
Copy link
Contributor

@cajieh: This pull request references Jira Issue OCPBUGS-65765, which is invalid:

  • expected the bug to target the "4.21.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

This pull request references Jira Issue OCPBUGS-65678, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.21.0) matches configured target version for branch (4.21.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @yapei

The bug has been updated to refer to the pull request using the external bug tracker.

In response to this:

… console

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 24, 2025
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Nov 24, 2025

@cajieh: all tests passed!

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@cajieh cajieh changed the title [WIP] OCPBUGS-65765, OCPBUGS-65678: apiVersion is empty on YAML creation page - Runtime error occurs when create MachineConfig with default yaml from… OCPBUGS-65765, OCPBUGS-65678: apiVersion is empty on YAML creation page - Runtime error occurs when create MachineConfig with default yaml from… Nov 25, 2025
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. component/core Related to console core functionality jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. jira/severity-important Referenced Jira bug's severity is important for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants