Skip to content

OCM-23235 |fix: remove validation for hcp cluster nodes size#3227

Open
marcolan018 wants to merge 1 commit intoopenshift:masterfrom
marcolan018:OCM-23235
Open

OCM-23235 |fix: remove validation for hcp cluster nodes size#3227
marcolan018 wants to merge 1 commit intoopenshift:masterfrom
marcolan018:OCM-23235

Conversation

@marcolan018
Copy link
Copy Markdown
Contributor

@marcolan018 marcolan018 commented Mar 30, 2026

PR Summary

remove validation for hcp cluster nodes size

Detailed Description of the Issue

To support min_replicas=0, in issue https://redhat.atlassian.net/browse/OCM-21663, we had changed the validation on nodepool min_replicas size. This PR focuses on the min_replicas size validation during cluster creation.

Related Issues and PRs

Type of Change

  • feat - adds a new user-facing capability.
  • fix - resolves an incorrect behavior or bug.
  • docs - updates documentation only.
  • style - formatting or naming changes with no logic impact.
  • refactor - code restructuring with no behavior change.
  • test - adds or updates tests only.
  • chore - maintenance work (tooling, housekeeping, non-product code).
  • build - changes build system, packaging, or dependencies for build output.
  • ci - changes CI pipelines, jobs, or automation workflows.
  • perf - improves performance without changing intended behavior.

Previous Behavior

rosa create cluster ... --min-replicas=0 --max-replicas=3  --enable-autoscaling
E: hosted Control Plane clusters require a minimum of 2 nodes, but 0 was requested

Behavior After This Change

rosa create cluster ... --min-replicas=0 --max-replicas=3  --enable-autoscaling
I: Cluster 'test' has been created.

How to Test (Step-by-Step)

Preconditions

Test Steps

Expected Results

Proof of the Fix

  • Screenshots:
  • Videos:
  • Logs/CLI output:
  • Other artifacts:

Breaking Changes

  • No breaking changes
  • Yes, this PR introduces a breaking change (describe impact and migration plan below)

Breaking Change Details / Migration Plan

Developer Verification Checklist

  • Commit subject/title follows [JIRA-TICKET] | [TYPE]: <MESSAGE>.
  • PR description clearly explains both what changed and why.
  • Relevant Jira/GitHub issues and related PRs are linked.
  • Tests were added/updated where appropriate.
  • I manually tested the change.
  • make test passes.
  • make lint passes.
  • make rosa passes.
  • Documentation was added/updated where appropriate.
  • Any risk, limitation, or follow-up work is documented.

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Mar 30, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: marcolan018

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

The pull request process is described 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 openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 30, 2026
@marcolan018
Copy link
Copy Markdown
Contributor Author

/retest

@marcolan018
Copy link
Copy Markdown
Contributor Author

/hold

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 30, 2026
Copy link
Copy Markdown
Contributor

@olucasfreitas olucasfreitas left a comment

Choose a reason for hiding this comment

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

Two blocking issues: missing unit test coverage for the changed function, and an unaddressed side effect on the non-autoscaling code path.

return err
}

if r.IsHostedCp && minReplicas < 2 {
Copy link
Copy Markdown
Contributor

@olucasfreitas olucasfreitas Mar 31, 2026

Choose a reason for hiding this comment

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

MinReplicaValidatorOnClusterCreate has zero unit test coverage in helper_test.go. Existing tests only cover MinReplicaValidator (nodepool level, line 520-571). A behavior change to an untested function must not merge without tests.

Add a DescribeTable in helper_test.go covering at minimum:

  • HCP: min_replicas=0 with valid privateSubnetsCount (pass)
  • HCP: negative min_replicas (fail)
  • HCP: exceeds 500-node limit (fail)
  • HCP: min_replicas not divisible by privateSubnetsCount (fail)
  • Classic: boundary cases for 180/249 node limits

"but %d was requested", minReplicas)
}

err = validateClusterVersionWithMaxNodesLimit(
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 validator is also invoked for non-autoscaling --compute-nodes in cmd/create/cluster/cmd.go:2849. With this removal, rosa create cluster --compute-nodes=0 on HCP without autoscaling now passes client-side validation.

If 0 nodes without autoscaling is not a valid HCP configuration, scope this removal to the autoscaling path only — the Autoscaling field already exists on ReplicaSizeValidation and can gate the check.

If the server rejects it anyway, document that explicitly in the PR description so reviewers can verify.

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. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants