Skip to content

WIP Revert " fix(azure): prevent externalDNSDomain from shadowing cluster apps domain" - #8586

Closed
bryan-cox wants to merge 1 commit into
openshift:mainfrom
bryan-cox:revert-8480-azure-external-dns-validation
Closed

WIP Revert " fix(azure): prevent externalDNSDomain from shadowing cluster apps domain"#8586
bryan-cox wants to merge 1 commit into
openshift:mainfrom
bryan-cox:revert-8480-azure-external-dns-validation

Conversation

@bryan-cox

@bryan-cox bryan-cox commented May 26, 2026

Copy link
Copy Markdown
Member

Reverts #8480

Summary by CodeRabbit

Release Notes

  • Bug Fixes
    • Removed restrictive Azure DNS validation that was preventing certain external DNS domain configurations for private hosted clusters.
    • Updated documentation to reflect current Azure DNS configuration capabilities.

@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 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 May 26, 2026
@openshift-ci

openshift-ci Bot commented May 26, 2026

Copy link
Copy Markdown
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@coderabbitai

coderabbitai Bot commented May 26, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This PR removes Azure DNS base domain shadowing validation and detection across the HyperShift stack. The changes eliminate the kubebuilder validation rule that rejected HostedCluster configurations where the external DNS domain overlaps the base domain, remove the CLI-level validateExternalDNSDomain validation helper, remove the controller-level baseDomainShadowsClusterDomain detection logic that set degraded conditions, and update corresponding tests and user documentation that warned about this scenario.

Possibly related PRs

  • openshift/hypershift#8480: Added the Azure Private DNS shadowing guard and wildcard record deletion logic that this PR removes.

Suggested reviewers

  • enxebre
  • cblecker
🚥 Pre-merge checks | ✅ 6 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Ipv6 And Disconnected Network Test Compatibility ⚠️ Warning New e2e test calls EnsureKubeAPIServerAllowedCIDRs which uses generateTestCIDRs250() generating hardcoded IPv4 /32 CIDRs (250.250.250.x/32) without IPv6 equivalent. Replace hardcoded IPv4 CIDRs with IPv6-compatible alternates or detect cluster IP family and generate appropriate test CIDRs for IPv4/IPv6.
Test Structure And Quality ❓ Inconclusive The check requires reviewing Ginkgo test code, but modified test files use standard testing.T with Gomega, not Ginkgo patterns (no Context/Describe/It blocks). Clarify if check applies to standard Go tests using Gomega or only Ginkgo-style tests. These PR tests don't use Ginkgo, so check applicability is unclear.
✅ Passed checks (6 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: reverting a previous fix that prevented externalDNSDomain from shadowing cluster apps domain.
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 check applies only to Ginkgo tests (It(), Describe(), etc.). The PR modifies standard Go table-driven tests that do not use Ginkgo framework.
Topology-Aware Scheduling Compatibility ✅ Passed PR reverts validation logic and test coverage for Azure DNS shadowing. Does not add deployment manifests or scheduling constraints affecting multiple topologies.

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

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

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

@openshift-ci

openshift-ci Bot commented May 26, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: bryan-cox
Once this PR has been reviewed and has the lgtm label, please assign enxebre 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 openshift-ci Bot added area/api Indicates the PR includes changes for the API 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 area/documentation Indicates the PR includes changes for documentation area/platform/azure PR/issue for Azure (AzurePlatform) platform and removed do-not-merge/needs-area labels May 26, 2026

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@control-plane-operator/controllers/azureprivatelinkservice/controller.go`:
- Around line 337-338: Reinstate the base-domain shadowing protection that was
removed: before calling reconcileBaseDomainDNS( ctx, azPLS, hcp.Name, log )
ensure you run the prior shadowing validation (the logic removed around the
former 759-784 range) and only call reconcileBaseDomainDNS when that validation
reports "not shadowed"; if the validation detects a shadowed/overlapping base
domain, set the degraded condition and return the appropriate result/error
instead of reconciling DNS. Locate the shadow-checking logic previously adjacent
to reconcileBaseDomainDNS and rewire or extract it into a helper (e.g.,
validateBaseDomainShadowing or similar) so the controller uses that helper to
gate calls to reconcileBaseDomainDNS and surface degradation when overlapping
domains are detected.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Enterprise

Run ID: d8c4d2bf-5977-4c8e-b438-4f4209b8efa8

📥 Commits

Reviewing files that changed from the base of the PR and between fa30196 and e1ed49f.

⛔ Files ignored due to path filters (19)
  • api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/AAA_ungated.yaml is excluded by !**/zz_generated.featuregated-crd-manifests/**
  • api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/ClusterUpdateAcceptRisks.yaml is excluded by !**/zz_generated.featuregated-crd-manifests/**
  • api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/ClusterVersionOperatorConfiguration.yaml is excluded by !**/zz_generated.featuregated-crd-manifests/**
  • api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/ExternalOIDC.yaml is excluded by !**/zz_generated.featuregated-crd-manifests/**
  • api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/ExternalOIDCWithUIDAndExtraClaimMappings.yaml is excluded by !**/zz_generated.featuregated-crd-manifests/**
  • api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/ExternalOIDCWithUpstreamParity.yaml is excluded by !**/zz_generated.featuregated-crd-manifests/**
  • api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/GCPPlatform.yaml is excluded by !**/zz_generated.featuregated-crd-manifests/**
  • api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/HCPEtcdBackup.yaml is excluded by !**/zz_generated.featuregated-crd-manifests/**
  • api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/HyperShiftOnlyDynamicResourceAllocation.yaml is excluded by !**/zz_generated.featuregated-crd-manifests/**
  • api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/ImageStreamImportMode.yaml is excluded by !**/zz_generated.featuregated-crd-manifests/**
  • api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/KMSEncryptionProvider.yaml is excluded by !**/zz_generated.featuregated-crd-manifests/**
  • api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/OpenStack.yaml is excluded by !**/zz_generated.featuregated-crd-manifests/**
  • api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/TLSAdherence.yaml is excluded by !**/zz_generated.featuregated-crd-manifests/**
  • cmd/install/assets/crds/hypershift-operator/tests/hostedclusters.hypershift.openshift.io/stable.hostedclusters.azure.testsuite.yaml is excluded by !cmd/install/assets/**/*.yaml
  • cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/hostedclusters-Hypershift-CustomNoUpgrade.crd.yaml is excluded by !**/zz_generated.crd-manifests/**, !cmd/install/assets/**/*.yaml
  • cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/hostedclusters-Hypershift-Default.crd.yaml is excluded by !**/zz_generated.crd-manifests/**, !cmd/install/assets/**/*.yaml
  • cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/hostedclusters-Hypershift-TechPreviewNoUpgrade.crd.yaml is excluded by !**/zz_generated.crd-manifests/**, !cmd/install/assets/**/*.yaml
  • docs/content/reference/aggregated-docs.md is excluded by !docs/content/reference/aggregated-docs.md
  • vendor/github.com/openshift/hypershift/api/hypershift/v1beta1/hostedcluster_types.go is excluded by !vendor/**, !**/vendor/**
📒 Files selected for processing (7)
  • api/hypershift/v1beta1/hostedcluster_types.go
  • cmd/cluster/azure/create.go
  • cmd/cluster/azure/create_test.go
  • control-plane-operator/controllers/azureprivatelinkservice/controller.go
  • control-plane-operator/controllers/azureprivatelinkservice/controller_test.go
  • docs/content/how-to/azure/create-self-managed-azure-cluster.md
  • docs/content/how-to/azure/deploy-azure-private-clusters.md
💤 Files with no reviewable changes (2)
  • api/hypershift/v1beta1/hostedcluster_types.go
  • docs/content/how-to/azure/create-self-managed-azure-cluster.md

Comment on lines +337 to 338
if result, err := r.reconcileBaseDomainDNS(ctx, azPLS, hcp.Name, log); err != nil || !result.IsZero() {
return result, err

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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Restore base-domain shadowing protection in base-domain DNS reconciliation.

Line 759 drops the context needed for shadowing checks, and Line 337 now calls this path unconditionally for any non-empty base domain. That re-allows overlapping domain configurations to reconcile DNS records instead of surfacing a degraded condition, which can break private-cluster API/OAuth/apps name resolution.

Suggested fix
- if result, err := r.reconcileBaseDomainDNS(ctx, azPLS, hcp.Name, log); err != nil || !result.IsZero() {
+ if result, err := r.reconcileBaseDomainDNS(ctx, azPLS, hcp.Name, hcp.Spec.DNS.BaseDomain, log); err != nil || !result.IsZero() {
    return result, err
  }

-func (r *AzurePrivateLinkServiceReconciler) reconcileBaseDomainDNS(ctx context.Context, azPLS *hyperv1.AzurePrivateLinkService, clusterName string, log logr.Logger) (ctrl.Result, error) {
+func (r *AzurePrivateLinkServiceReconciler) reconcileBaseDomainDNS(ctx context.Context, azPLS *hyperv1.AzurePrivateLinkService, clusterName, hcpBaseDomain string, log logr.Logger) (ctrl.Result, error) {
+  if baseDomainShadowsClusterDomain(azPLS.Spec.BaseDomain, hcpBaseDomain) {
+    patch := client.MergeFrom(azPLS.DeepCopy())
+    meta.SetStatusCondition(&azPLS.Status.Conditions, metav1.Condition{
+      Type:               string(hyperv1.AzurePrivateDNSAvailable),
+      Status:             metav1.ConditionFalse,
+      Reason:             "BaseDomainShadowsClusterDomain",
+      Message:            "base domain overlaps cluster domain and may shadow private DNS resolution",
+      ObservedGeneration: azPLS.Generation,
+    })
+    if err := r.Status().Patch(ctx, azPLS, patch); err != nil {
+      return ctrl.Result{}, err
+    }
+    return ctrl.Result{}, nil
+  }
   recordNames, err := r.recordNamesForCR(ctx, azPLS, clusterName, log)
   if err != nil {
     return ctrl.Result{}, err
   }

As per coding guidelines, Design APIs contract-first following OpenShift and Kubernetes best practices and Enforce API and base code best practices aligned with OpenShift and Kubernetes standards.

Also applies to: 759-784

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@control-plane-operator/controllers/azureprivatelinkservice/controller.go`
around lines 337 - 338, Reinstate the base-domain shadowing protection that was
removed: before calling reconcileBaseDomainDNS( ctx, azPLS, hcp.Name, log )
ensure you run the prior shadowing validation (the logic removed around the
former 759-784 range) and only call reconcileBaseDomainDNS when that validation
reports "not shadowed"; if the validation detects a shadowed/overlapping base
domain, set the degraded condition and return the appropriate result/error
instead of reconciling DNS. Locate the shadow-checking logic previously adjacent
to reconcileBaseDomainDNS and rewire or extract it into a helper (e.g.,
validateBaseDomainShadowing or similar) so the controller uses that helper to
gate calls to reconcileBaseDomainDNS and surface degradation when overlapping
domains are detected.

@bryan-cox

Copy link
Copy Markdown
Member Author

/close

@openshift-ci openshift-ci Bot closed this May 26, 2026
@openshift-ci

openshift-ci Bot commented May 26, 2026

Copy link
Copy Markdown
Contributor

@bryan-cox: Closed this PR.

Details

In response to this:

/close

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.

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

Labels

area/api Indicates the PR includes changes for the API 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 area/documentation Indicates the PR includes changes for documentation area/platform/azure PR/issue for Azure (AzurePlatform) platform do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant