Skip to content

feat(snc): make the cluster DNS suffix configurable - #995

Open
jangel97 wants to merge 2 commits into
redhat-developer:mainfrom
jangel97:feat/ocp-snc-dns-suffix
Open

jangel97 wants to merge 2 commits into
redhat-developer:mainfrom
jangel97:feat/ocp-snc-dns-suffix

Conversation

@jangel97

@jangel97 jangel97 commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add a --dns-suffix flag to mapt aws openshift-snc create and mapt ibmcloud openshift-snc create to replace the hardcoded nip.io used for the cluster endpoints
  • When set, the suffix is written to /opt/crc/dns-suffix on the instance through the cloud-config, where the ocp-custom-domain service picks it up — this is the mechanism introduced by ocp-custom-domain: Make DNS suffix configurable crc-org/snc#1266
  • The generated kubeconfig (API server URL rewrite) and the reported console URL follow the same suffix
  • When the flag is empty the behaviour is unchanged: no file is written and nip.io is used everywhere, so bundles predating ocp-custom-domain: Make DNS suffix configurable crc-org/snc#1266 keep working

Follows up on crc-org/snc#1265 / crc-org/snc#1266 on the bundle side.

Test plan

  • go build ./...
  • go vet on the touched packages
  • Unit tests: cloud-config renders without the dns-suffix file when no suffix is set, and with the correct content when one is set (both AWS and IBM Cloud templates)
  • Manual: create an SNC cluster with --dns-suffix sslip.io and verify console, OAuth, API and registry endpoints use the suffix, and that the kubeconfig works

The SNC cluster endpoints are hardcoded to nip.io on the mapt side
(console URL, kubeconfig API server rewrite) and on the bundle side
(ocp-custom-domain service).

Add a --dns-suffix flag to `aws openshift-snc create` and
`ibmcloud openshift-snc create` that overrides the default. When set,
the suffix is written to /opt/crc/dns-suffix on the instance via the
cloud-config, where it is picked up by ocp-custom-domain (requires a
bundle including crc-org/snc#1266). The generated kubeconfig and the
reported console URL follow the same suffix.

When the flag is empty the behaviour is unchanged: no file is written
and nip.io is used everywhere, so older bundles keep working.
@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

This review ran on the open-source allowance, not this organization's plan, because the pull request author doesn't have an assigned seat. Waiting won't change this — ask an organization admin to assign them a seat, or add seats in Billing if every seat is already assigned, then retry.

Next included review available in 39 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4f80fd4c-8371-45cd-bbe3-acaddcffbba5
Commits

Reviewing files that changed from the base of the PR and between f7c8a35 and 314c530.

Files selected for processing: 8

  • cmd/mapt/cmd/aws/services/snc.go
  • cmd/mapt/cmd/ibmcloud/services/snc.go
  • docs/aws/openshift-snc.md
  • docs/ibmcloud/openshift-snc.md
  • pkg/provider/aws/action/snc/snc.go
  • pkg/provider/ibmcloud/action/snc/snc.go
  • pkg/target/service/snc/api.go
  • pkg/target/service/snc/api_test.go

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • New Features
    • Added an optional --dns-suffix setting for AWS and IBM Cloud SNC clusters. When supported by the SNC bundle, the custom suffix is used for cluster endpoints, kubeconfig, and the reported console URL.
    • The default nip.io suffix remains in use when no custom suffix is configured.
  • Documentation
    • Added guidance and examples for configuring a custom DNS suffix, including DNS requirements and bundle compatibility.

AWS and IBM Cloud SNC create commands now accept a custom DNS suffix. Providers use it for generated console and API URLs and write it to cloud-config when set. An empty suffix retains nip.io as the default.

Changes: SNC custom DNS suffix

Layer / File(s) Summary
Suffix contract and command input
pkg/target/service/snc/api.go, pkg/target/service/snc/snc.go, cmd/mapt/cmd/aws/services/snc.go, cmd/mapt/cmd/ibmcloud/services/snc.go, docs/aws/openshift-snc.md, docs/ibmcloud/openshift-snc.md
Adds the DNSuffix argument, default suffix and URL helpers. Both create commands expose --dns-suffix. The documentation describes its use and bundle requirement.
Provider setup and generated configuration
pkg/provider/aws/action/snc/snc.go, pkg/provider/ibmcloud/action/snc/snc.go, pkg/provider/ibmcloud/action/snc/cloud-config, pkg/target/service/snc/cloud-config, pkg/target/service/snc/cloudconfig.go, pkg/provider/ibmcloud/action/snc/snc_test.go, pkg/target/service/snc/cloudconfig_test.go
Both providers pass the suffix into cloud-config and kubeconfig URL generation. The templates write /opt/crc/dns-suffix when a suffix is set. Tests check the file for set and unset values.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant AWSCommand as AWS create command
  participant IBMCommand as IBM Cloud create command
  participant AWSProvider as AWS SNC provider
  participant IBMProvider as IBM Cloud SNC provider
  participant CloudConfig
  participant Kubeconfig
  alt AWS
    AWSCommand->>AWSProvider: pass SNCArgs with DNSuffix
    AWSProvider->>CloudConfig: pass DNSSuffix
    AWSProvider->>Kubeconfig: use APIServerURL with DNSuffix
  else IBM Cloud
    IBMCommand->>IBMProvider: pass SNCArgs with DNSuffix
    IBMProvider->>CloudConfig: pass DNSSuffix
    IBMProvider->>Kubeconfig: use APIServerURL with DNSuffix
  end
Loading

Suggested reviewers: adrianriobo, anjannath

Merge Risk: Minimal · previous review f7c8a

This adds an optional --dns-suffix flag for AWS and IBM Cloud OpenShift SNC clusters. When the flag is unset, behavior is unchanged and nip.io remains the default. No merge-blocking issue was found. A custom suffix needs a bundle that includes snc#1266, and an end-to-end manual cluster creation with a custom suffix is still worth running before release.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "feat(snc): make the cluster DNS suffix configurable" matches the main change. The PR adds a --dns-suffix flag for AWS and IBM Cloud openshift-snc create, and threads the suffix through clou…
Description check Passed The description states the purpose (a --dns-suffix flag replacing the hardcoded nip.io), the cloud-config mechanism writing /opt/crc/dns-suffix, the kubeconfig and console URL behavior, backward compa…
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.
Full details: Title check

Explanation

The title "feat(snc): make the cluster DNS suffix configurable" matches the main change. The PR adds a --dns-suffix flag for AWS and IBM Cloud openshift-snc create, and threads the suffix through cloud-config, kubeconfig rewriting, and console URL generation.

Full details: Description check

Explanation

The description states the purpose (a --dns-suffix flag replacing the hardcoded nip.io), the cloud-config mechanism writing /opt/crc/dns-suffix, the kubeconfig and console URL behavior, backward compatibility when the flag is empty, and a test plan. This matches the changeset.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 46ff3a3d-7ed6-4ca6-baa1-dc592696f00a
Commits

Reviewing files that changed from the base of the PR and between 5a70cbd and f7c8a35.

Files selected for processing: 13

  • cmd/mapt/cmd/aws/services/snc.go
  • cmd/mapt/cmd/ibmcloud/services/snc.go
  • docs/aws/openshift-snc.md
  • docs/ibmcloud/openshift-snc.md
  • pkg/provider/aws/action/snc/snc.go
  • pkg/provider/ibmcloud/action/snc/cloud-config
  • pkg/provider/ibmcloud/action/snc/snc.go
  • pkg/provider/ibmcloud/action/snc/snc_test.go
  • pkg/target/service/snc/api.go
  • pkg/target/service/snc/cloud-config
  • pkg/target/service/snc/cloudconfig.go
  • pkg/target/service/snc/cloudconfig_test.go
  • pkg/target/service/snc/snc.go

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Reject --dns-suffix when the requested OpenShift version runs a
bundle that does not read /opt/crc/dns-suffix: without the check the
file is silently ignored, the cluster endpoints stay on nip.io and
the generated kubeconfig points to a non-existent domain.

crc-org/snc#1266 was merged to master and backported to the
release-4.22 and release-5.0 bundle branches, so the suffix requires
OpenShift >= 4.22 or 5.x. The check also validates the suffix itself
(bare DNS label, no whitespace or path separators).
@jangel97

jangel97 commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator Author

Added a version guard: --dns-suffix is now rejected for OpenShift < 4.22, since only the release-4.22 and release-5.0 bundle branches carry crc-org/snc#1266 (verified via the ocp-custom-domain.sh history on each branch). Without the guard the file would be silently ignored by older bundles and the kubeconfig would point at a non-existent domain. Suffix syntax (bare label, no whitespace/separators) is validated too. Includes unit tests.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant