Skip to content

OCPBUGS-65950: Update template whenever settings are updated#16143

Open
celdrake wants to merge 1 commit intoopenshift:mainfrom
celdrake:OCPBUGS-65950-update-template
Open

OCPBUGS-65950: Update template whenever settings are updated#16143
celdrake wants to merge 1 commit intoopenshift:mainfrom
celdrake:OCPBUGS-65950-update-template

Conversation

@celdrake
Copy link
Contributor

@celdrake celdrake commented Mar 13, 2026

The Vsphere Plugin was not managing the platform.vsphere.failureDomains.topology.template field.

If it's defined, we'll ensure it has the expected pattern /<datacenter>/vm/<existing-value>.

This covers all possible cases:

  • The settings are defined initially with a placeholder value (eg. datacenterplaceholder from Assisted Installer)
  • The datacenter value is modified later by the user

Summary by CodeRabbit

Release Notes

  • New Features
    • Added optional template field support to vSphere infrastructure topology configuration
    • Implemented automatic template path normalization for vCenter domain configurations, now automatically prefixing template paths with the selected datacenter information

@openshift-ci-robot openshift-ci-robot added jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. labels Mar 13, 2026
@openshift-ci-robot
Copy link
Contributor

@celdrake: This pull request references Jira Issue OCPBUGS-65950, 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.22.0) matches configured target version for branch (4.22.0)
  • bug is in the state New, which is one of the valid states (NEW, ASSIGNED, POST)

No GitHub users were found matching the public email listed for the QA contact in Jira (dasulin@redhat.com), skipping review request.

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

Details

In response to this:

The Vsphere Plugin was not managing the platform.vsphere.failureDomains.topology.template field.

If it's defined, we'll ensure it has the expected pattern /<datacenter>/vm/<existing-value>.

This covers all possible cases:

  • The settings are defined initially with a placeholder value (eg. datacenterplaceholder from Assisted Installer)
  • The datacenter value is modified later by the user

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 mareklibra and rawagner March 13, 2026 11:10
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 13, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: celdrake
Once this PR has been reviewed and has the lgtm label, please assign mareklibra for approval. For more information see the Code Review Process.

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

Details 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-robot
Copy link
Contributor

@celdrake: This pull request references Jira Issue OCPBUGS-65950, which is valid.

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

No GitHub users were found matching the public email listed for the QA contact in Jira (dasulin@redhat.com), skipping review request.

Details

In response to this:

The Vsphere Plugin was not managing the platform.vsphere.failureDomains.topology.template field.

If it's defined, we'll ensure it has the expected pattern /<datacenter>/vm/<existing-value>.

This covers all possible cases:

  • The settings are defined initially with a placeholder value (eg. datacenterplaceholder from Assisted Installer)
  • The datacenter value is modified later by the user

Summary by CodeRabbit

Release Notes

  • New Features
  • Added optional template field support to vSphere infrastructure topology configuration
  • Implemented automatic template path normalization for vCenter domain configurations, now automatically prefixing template paths with the selected datacenter information

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
Contributor

coderabbitai bot commented Mar 13, 2026

📝 Walkthrough

Walkthrough

This pull request extends the VSphere infrastructure configuration by introducing template path normalization and schema updates. The infrastructure.ts file adds an optional template field to the vSphere failureDomains topology structure, allowing template specifications at the topology level. The persist.ts file implements logic to normalize template paths containing /vm/<extraPart> patterns by prepending the selected datacenter, transforming them to /<datacenter>/vm/<extraPart>. This normalization occurs during the persistence operation when populating infrastructure configuration from user-selected values.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main objective: updating the template field in vCenterDomainCfg.topology whenever datacenter settings change.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Tip

CodeRabbit can generate a title for your PR based on the changes with custom instructions.

Set the reviews.auto_title_instructions setting to generate a title for your PR based on the changes in the PR with custom instructions.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
frontend/packages/vsphere-plugin/src/components/persist.ts (1)

514-518: Consider extracting to a helper function for consistency (optional).

For symmetry with getInfrastructureResourcePoolPath (lines 465-481), you could extract this to something like getInfrastructureTemplatePath. Not strictly necessary given the simpler logic here, but it would improve consistency and testability.

♻️ Optional: Extract to helper function
+const getInfrastructureTemplatePath = (
+  datacenter: string,
+  originalTemplate: string | undefined,
+): string | undefined => {
+  const extraPartMatch = (originalTemplate || '').match(/\/vm\/(.+)$/);
+  return extraPartMatch ? `/${datacenter}/vm/${extraPartMatch[1]}` : originalTemplate;
+};
+

Then at usage site:

-  // Template is in the form: /<datacenter>/vm/<extraPart>
-  const extraPartMatch = (vCenterDomainCfg.topology.template || '').match(/\/vm\/(.+)$/);
-  if (extraPartMatch) {
-    vCenterDomainCfg.topology.template = `/${values.datacenter}/vm/${extraPartMatch[1]}`;
-  }
+  vCenterDomainCfg.topology.template = getInfrastructureTemplatePath(
+    values.datacenter,
+    vCenterDomainCfg.topology.template,
+  );
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/packages/vsphere-plugin/src/components/persist.ts` around lines 514
- 518, Extract the template-rewriting logic into a new helper named
getInfrastructureTemplatePath and use it where
vCenterDomainCfg.topology.template is currently mutated; specifically, move the
logic that parses (vCenterDomainCfg.topology.template ||
'').match(/\/vm\/(.+)$/) and constructs `/${values.datacenter}/vm/${extraPart}`
into getInfrastructureTemplatePath(template, datacenter) and replace the inline
code with vCenterDomainCfg.topology.template =
getInfrastructureTemplatePath(vCenterDomainCfg.topology.template,
values.datacenter); this mirrors getInfrastructureResourcePoolPath and improves
consistency and testability.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@frontend/packages/vsphere-plugin/src/components/persist.ts`:
- Around line 514-518: Extract the template-rewriting logic into a new helper
named getInfrastructureTemplatePath and use it where
vCenterDomainCfg.topology.template is currently mutated; specifically, move the
logic that parses (vCenterDomainCfg.topology.template ||
'').match(/\/vm\/(.+)$/) and constructs `/${values.datacenter}/vm/${extraPart}`
into getInfrastructureTemplatePath(template, datacenter) and replace the inline
code with vCenterDomainCfg.topology.template =
getInfrastructureTemplatePath(vCenterDomainCfg.topology.template,
values.datacenter); this mirrors getInfrastructureResourcePoolPath and improves
consistency and testability.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 3c73067a-396f-48d5-b0c7-d2009f263bac

📥 Commits

Reviewing files that changed from the base of the PR and between 0f65889 and 8b0908c.

📒 Files selected for processing (2)
  • frontend/packages/vsphere-plugin/src/components/persist.ts
  • frontend/packages/vsphere-plugin/src/resources/infrastructure.ts

@celdrake
Copy link
Contributor Author

/retest

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 13, 2026

@celdrake: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-gcp-console 8b0908c link true /test e2e-gcp-console

Full PR test history. Your PR dashboard.

Details

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.

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

Labels

jira/valid-bug Indicates that a referenced Jira bug is valid 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