Skip to content

OCPBUGS-84307: Clarify --base-domain flag default behavior#8381

Open
dhgautam99 wants to merge 2 commits into
openshift:mainfrom
dhgautam99:add-context-base-domain
Open

OCPBUGS-84307: Clarify --base-domain flag default behavior#8381
dhgautam99 wants to merge 2 commits into
openshift:mainfrom
dhgautam99:add-context-base-domain

Conversation

@dhgautam99
Copy link
Copy Markdown

@dhgautam99 dhgautam99 commented Apr 30, 2026

What this PR does / why we need it:

Updates the help text for the --base-domain flag in the hypershift create cluster command
to clarify that when omitted, it defaults to the management cluster's apps domain. This
improves discoverability so users know the flag is optional and understand the fallback behavior.

Which issue(s) this PR fixes:

Fixes OCPBUGS-84307

Special notes for your reviewer:

Single-line help text change, no functional impact.

Checklist:

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.
  • This change includes unit tests.

Summary by CodeRabbit

  • Documentation

    • Clarified CLI help for the --base-domain flag: when omitted for HCP kubevirt clusters it defaults to the management cluster’s apps domain.
  • Tests

    • Added unit tests for CLI flag binding/parsing to confirm base domain, cluster name, and namespace behavior when provided or omitted.

@openshift-merge-bot
Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@openshift-ci-robot openshift-ci-robot added jira/severity-low Referenced Jira bug's severity is low for the branch this PR is targeting. 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 Apr 30, 2026
@openshift-ci-robot
Copy link
Copy Markdown

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

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

Details

In response to this:

What this PR does / why we need it:

Updates the help text for the --base-domain flag in the hypershift create cluster command
to clarify that when omitted, it defaults to the management cluster's apps domain. This
improves discoverability so users know the flag is optional and understand the fallback behavior.

Which issue(s) this PR fixes:

Fixes OCPBUGS-84307

Special notes for your reviewer:

Single-line help text change, no functional impact.

Checklist:

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.
  • This change includes unit tests.

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
Copy Markdown
Contributor

coderabbitai Bot commented Apr 30, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The --base-domain CLI flag help text in cmd/cluster/core/create.go was updated to document that for HCP kubevirt clusters, omitting the flag defaults to the management cluster’s apps domain. No runtime logic, validation, or control flow were changed. A unit test TestBindOptions was added to cmd/cluster/core/create_test.go (imports github.com/spf13/pflag) verifying that BindOptions with a pflag.FlagSet binds --base-domain, --name, and --namespace into opts.BaseDomain, opts.Name, and opts.Namespace, and that BaseDomain remains empty when the flag is absent.

🚥 Pre-merge checks | ✅ 11 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (11 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 change: clarifying the --base-domain flag's default behavior when omitted for HCP kubevirt clusters.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed The custom check applies to Ginkgo test titles (It(), Describe(), Context(), When()). The PR adds tests using standard Go testing with t.Run() subtests, not Ginkgo. This check is not applicable.
Test Structure And Quality ✅ Passed The custom check targets Ginkgo test code review, but this PR adds standard Go tests using testing.T with Gomega matchers, not Ginkgo (no Describe/It blocks). The check is not applicable.
Microshift Test Compatibility ✅ Passed No Ginkgo e2e tests are added in this PR. The changes include a documentation update and a standard Go unit test using *testing.T pattern, not Ginkgo framework. Check is not applicable.
Single Node Openshift (Sno) Test Compatibility ✅ Passed No Ginkgo e2e tests added. The PR only adds a standard Go unit test (TestBindOptions using testing.T and t.Run), which is not subject to the SNO compatibility check.
Topology-Aware Scheduling Compatibility ✅ Passed PR modifies only CLI code (cmd/cluster/core/create.go) and tests. No deployment manifests, operator code, or controllers are changed. No scheduling constraints are introduced. Check is not applicable.
Ote Binary Stdout Contract ✅ Passed PR modifies CLI library module with help text and unit tests. No process-level code or OTE binary infrastructure affected. No stdout writes at init/main level.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed Check not applicable. PR adds standard Go unit test (TestBindOptions) using testing.T, not Ginkgo e2e tests. Custom check specifically targets Ginkgo patterns only.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@openshift-ci openshift-ci Bot added do-not-merge/needs-area area/cli Indicates the PR includes changes for CLI labels Apr 30, 2026
@openshift-ci openshift-ci Bot requested review from csrwng and sjenning April 30, 2026 08:26
@openshift-ci openshift-ci Bot added area/control-plane-operator Indicates the PR includes changes for the control plane operator - in an OCP release and removed do-not-merge/needs-area labels Apr 30, 2026
@openshift-ci-robot
Copy link
Copy Markdown

@dhgautam99: This pull request references Jira Issue OCPBUGS-84307, which is valid.

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

In response to this:

What this PR does / why we need it:

Updates the help text for the --base-domain flag in the hypershift create cluster command
to clarify that when omitted, it defaults to the management cluster's apps domain. This
improves discoverability so users know the flag is optional and understand the fallback behavior.

Which issue(s) this PR fixes:

Fixes OCPBUGS-84307

Special notes for your reviewer:

Single-line help text change, no functional impact.

Checklist:

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.
  • This change includes unit tests.

Summary by CodeRabbit

  • Documentation

  • Clarified --base-domain CLI flag behavior to document that it defaults to the management cluster's apps domain when omitted.

  • Bug Fixes

  • Improved kubeadmin password reconciliation to validate bcrypt hash matching against the current password before regenerating.

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.

@dhgautam99 dhgautam99 force-pushed the add-context-base-domain branch from 50c4689 to d9dabe1 Compare April 30, 2026 08:29
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 40.07%. Comparing base (f2423d3) to head (83edfdd).
⚠️ Report is 92 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8381      +/-   ##
==========================================
+ Coverage   39.72%   40.07%   +0.35%     
==========================================
  Files         751      751              
  Lines       92461    92838     +377     
==========================================
+ Hits        36729    37205     +476     
+ Misses      53076    52946     -130     
- Partials     2656     2687      +31     
Files with missing lines Coverage Δ
cmd/cluster/core/create.go 61.70% <100.00%> (+7.69%) ⬆️

... and 45 files with indirect coverage changes

Flag Coverage Δ
cmd-support 34.31% <100.00%> (+0.31%) ⬆️
cpo-hostedcontrolplane 40.56% <ø> (+0.04%) ⬆️
cpo-other 40.14% <ø> (+0.11%) ⬆️
hypershift-operator 50.53% <ø> (+0.24%) ⬆️
other 31.54% <ø> (+1.84%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
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)
cmd/cluster/core/create_test.go (1)

49-59: 💤 Low value

Consider clarifying the subtest name to reflect pflag-level vs. runtime behavior.

The subtest is named "When base-domain is not provided it should default to empty", but the updated flag description documents that omitting --base-domain "defaults to management cluster's apps domain" at runtime. The test correctly asserts the pflag-level default ("") — which is accurate — but the name "default to empty" could mislead a future reader into thinking the system's end-to-end behavior is an empty string rather than the resolved apps domain.

✏️ Suggested rename
-	t.Run("When base-domain is not provided it should default to empty", func(t *testing.T) {
+	t.Run("When base-domain is not provided the flag value should be empty (resolved at runtime to management cluster apps domain)", func(t *testing.T) {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cmd/cluster/core/create_test.go` around lines 49 - 59, Rename the subtest to
clarify it asserts the flag's pflag-level default rather than runtime
resolution: update the t.Run description string (the subtest around NewWithT,
DefaultOptions, pflag.NewFlagSet, BindOptions and opts.BaseDomain) to something
like "When --base-domain flag is omitted, pflag default should be empty" so
readers understand the test checks the parsed flag default (opts.BaseDomain ==
"") not the runtime resolved apps domain.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@cmd/cluster/core/create_test.go`:
- Around line 49-59: Rename the subtest to clarify it asserts the flag's
pflag-level default rather than runtime resolution: update the t.Run description
string (the subtest around NewWithT, DefaultOptions, pflag.NewFlagSet,
BindOptions and opts.BaseDomain) to something like "When --base-domain flag is
omitted, pflag default should be empty" so readers understand the test checks
the parsed flag default (opts.BaseDomain == "") not the runtime resolved apps
domain.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: fc0fc7ab-2237-4e16-981f-9063a3689d9f

📥 Commits

Reviewing files that changed from the base of the PR and between d9dabe1 and 4bfc2c1.

📒 Files selected for processing (1)
  • cmd/cluster/core/create_test.go

@dhgautam99 dhgautam99 force-pushed the add-context-base-domain branch from 4bfc2c1 to 14b7ac5 Compare May 4, 2026 09:43
Comment thread cmd/cluster/core/create.go Outdated
flags.StringVar(&opts.Namespace, "namespace", opts.Namespace, "A namespace to contain the generated resources")
flags.StringVar(&opts.Name, "name", opts.Name, "A name for the cluster")
flags.StringVar(&opts.BaseDomain, "base-domain", opts.BaseDomain, "The ingress base domain for the cluster")
flags.StringVar(&opts.BaseDomain, "base-domain", opts.BaseDomain, "The ingress base domain for the cluster. When omitted, defaults to management cluster's apps domain.")
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 is only true for kubevirt, so not generally applicable to all platforms.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Reflected the default behaviour for kubevirt specific HCP cluster.

@dhgautam99 dhgautam99 force-pushed the add-context-base-domain branch from 14b7ac5 to e7ff1e5 Compare May 8, 2026 06:05
@dhgautam99
Copy link
Copy Markdown
Author

@coderabbitai full review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 8, 2026

✅ Actions performed

Full review triggered.

@dhgautam99
Copy link
Copy Markdown
Author

/test images

Update the help text for the --base-domain flag in the create command
to indicate that when omitted, it defaults to the management cluster's
apps domain.

Refs: OCPBUGS-84307
Signed-off-by: Dhruv Gautam <dgautam@redhat.com>
@dhgautam99 dhgautam99 force-pushed the add-context-base-domain branch from e7ff1e5 to a02d929 Compare May 8, 2026 11:50
@dhgautam99
Copy link
Copy Markdown
Author

@coderabbitai full review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 8, 2026

✅ Actions performed

Full review triggered.

@dhgautam99 dhgautam99 force-pushed the add-context-base-domain branch from a02d929 to e96ecb9 Compare May 8, 2026 13:19
@hypershift-jira-solve-ci
Copy link
Copy Markdown

Now I have the complete picture. Here is the final report:

Test Failure Analysis Complete

Job Information

  • Prow Job: codecov/project (GitHub Check via Codecov app)
  • Build ID: Check Run 75022638607
  • PR: #8381OCPBUGS-84307: Clarify --base-domain flag default behavior
  • Changed Files: cmd/cluster/core/create.go, cmd/cluster/core/create_test.go

Test Failure Analysis

Error

Project coverage is 34.84% (-2.70%) compared to base 37.53% (37f46b9).
Files: 751 → 444 (-307), Lines: 92025 → 37749 (-54276).

Summary

This is a race condition in Codecov evaluation, not a real coverage regression. The repository's codecov.yml sets wait_for_ci: false, which allows Codecov to post its project-level verdict before all GitHub Actions unit test jobs finish uploading coverage data. Codecov evaluated at 13:28:14 UTC, but only 3 of 5 coverage flags (cpo-hostedcontrolplane, cpo-other, other) had uploaded results at that point. The hypershift-operator flag completed 15 minutes later and cmd-support hadn't even started yet. With 2 flags missing, 307 files and 54,276 lines were absent from the coverage calculation, causing an artificial 2.70% drop. The PR's own patch coverage is 100% — codecov/patch passed. This failure is entirely unrelated to the code changes in PR #8381.

Root Cause

The codecov/project check failed because Codecov evaluated the project-level coverage before all unit test jobs had uploaded their coverage reports.

Configuration issue: The repo's codecov.yml explicitly sets wait_for_ci: false, telling Codecov to report results as soon as any upload arrives rather than waiting for all CI jobs to complete.

Timeline of events (all times UTC, May 8 2026):

  1. 13:19:54Detect Changes job completed (no coverage upload)
  2. 13:24:58Unit Tests (cpo-hostedcontrolplane) completed → coverage uploaded ✅
  3. 13:28:14Codecov posted codecov/project = FAILURE (evaluated with incomplete data)
  4. 13:28:20Unit Tests (cpo-other) completed → coverage uploaded (6 seconds too late)
  5. 13:29:10Unit Tests (other) completed → coverage uploaded
  6. 13:39:47Unit Tests (cmd-support) finally started (11 minutes after Codecov verdict)
  7. 13:43:05Unit Tests (hypershift-operator) completed → coverage uploaded

Result of premature evaluation: The base branch (main at 37f46b9) had all 5 flags uploaded (751 files, 92,025 lines, 37.53% coverage). The PR's evaluation only had 3 flags (444 files, 37,749 lines, 34.84% coverage). The -2.70% "regression" is entirely due to the 307 missing files from the cmd-support and hypershift-operator flags that hadn't uploaded yet.

Flags at evaluation time:

Flag Status at 13:28:14 Coverage
cmd-support ❌ Not started ? (no data)
cpo-hostedcontrolplane ✅ Uploaded 36.77%
cpo-other ⏳ Completed 6s later 37.76%
hypershift-operator ❌ Still running ? (no data)
other ⏳ Completed 56s later 27.77%
Recommendations
  1. No action needed on PR OCPBUGS-84307: Clarify --base-domain flag default behavior #8381 — the code changes are correct and achieve 100% patch coverage. This failure will likely self-resolve when Codecov re-evaluates after all uploads complete, or on the next push/rebase.

  2. Fix the wait_for_ci setting (recommended for the repo) — Change codecov.yml from wait_for_ci: false to wait_for_ci: true to prevent Codecov from evaluating before all CI jobs finish uploading coverage. This is a known Codecov misconfiguration that causes spurious codecov/project failures.

  3. If immediate merge is needed — the codecov/project check is not a required status check for merge in most Prow-governed repos. Verify whether it blocks merge; if so, re-trigger the Unit Tests workflow or wait for the cmd-support job to complete and check if Codecov auto-updates.

Evidence
Evidence Detail
codecov.yml setting wait_for_ci: false — Codecov does not wait for all CI jobs
Codecov evaluation time 2026-05-08T13:28:14Z
cmd-support job start 2026-05-08T13:39:47Z (11 min after Codecov verdict)
hypershift-operator completion 2026-05-08T13:43:05Z (15 min after Codecov verdict)
Missing flags cmd-support (?), hypershift-operator (?)
Files counted (base vs PR) 751 → 444 (−307 files missing)
Lines counted (base vs PR) 92,025 → 37,749 (−54,276 lines missing)
Coverage delta 37.53% → 34.84% (−2.70% — artificial)
codecov/patch result ✅ PASSED — all modified lines are covered
PR changed files cmd/cluster/core/create.go, cmd/cluster/core/create_test.go only
Recent PR #8457 codecov/project ✅ PASSED (all flags uploaded before evaluation)

Comment thread cmd/cluster/core/create.go Outdated
Verify that BindOptions correctly wires CLI flags to the
RawCreateOptions struct, covering the --base-domain flag
help text change.

Refs: OCPBUGS-84307
Signed-off-by: Dhruv Gautam <dgautam@redhat.com>
@dhgautam99 dhgautam99 force-pushed the add-context-base-domain branch from 934d055 to 83edfdd Compare May 14, 2026 05:54
@csrwng
Copy link
Copy Markdown
Contributor

csrwng commented May 14, 2026

/approve

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 14, 2026
Copy link
Copy Markdown
Member

@bryan-cox bryan-cox left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label May 14, 2026
@openshift-merge-bot
Copy link
Copy Markdown
Contributor

Scheduling tests matching the pipeline_run_if_changed or not excluded by pipeline_skip_if_only_changed parameters:
/test e2e-aks
/test e2e-aws
/test e2e-aws-upgrade-hypershift-operator
/test e2e-azure-self-managed
/test e2e-kubevirt-aws-ovn-reduced
/test e2e-v2-aws
/test e2e-v2-gke

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 14, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bryan-cox, csrwng, dhgautam99

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

@dhgautam99
Copy link
Copy Markdown
Author

/jira backport release-4.22

@openshift-ci-robot
Copy link
Copy Markdown

@dhgautam99: The following backport issues have been created:

Queuing cherrypicks to the requested branches to be created after this PR merges:
/cherrypick release-4.22

Details

In response to this:

/jira backport release-4.22

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-cherrypick-robot
Copy link
Copy Markdown

@openshift-ci-robot: once the present PR merges, I will cherry-pick it on top of release-4.22 in a new PR and assign it to you.

Details

In response to this:

@dhgautam99: The following backport issues have been created:

Queuing cherrypicks to the requested branches to be created after this PR merges:
/cherrypick release-4.22

In response to this:

/jira backport release-4.22

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.

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.

@dhgautam99
Copy link
Copy Markdown
Author

/test e2e-aks
/test e2e-aws

@hypershift-jira-solve-ci
Copy link
Copy Markdown

AI Test Failure Analysis

Job: pull-ci-openshift-hypershift-main-e2e-aws | Build: 2054950339374747648 | Cost: $3.72693225 | Failed step: hypershift-aws-run-e2e-nested

View full analysis report


Generated by hypershift-analyze-e2e-failure post-step using Claude claude-opus-4-6

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 14, 2026

@dhgautam99: 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-aws 83edfdd link true /test e2e-aws

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

approved Indicates a PR has been approved by an approver from all required OWNERS files. area/cli Indicates the PR includes changes for CLI area/control-plane-operator Indicates the PR includes changes for the control plane operator - in an OCP release jira/severity-low Referenced Jira bug's severity is low 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. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants