Skip to content

Conversation

@nexus49
Copy link
Contributor

@nexus49 nexus49 commented Dec 18, 2025

Summary

Adds pre-installation validation to check that required DNS entries (portal.dev.local and kcp.api.portal.dev.local) are properly configured before starting the local setup process.

Problem

Currently, the local setup only suggests adding hosts entries at the end of installation. This causes the installation to fail with cryptic connection errors when:

  • kubectl commands try to connect to kcp.api.portal.dev.local:8443 during example-data setup
  • Users try to access the portal after installation completes

Solution

Add early validation during the environment checks phase that:

  • ✅ Verifies both hostnames resolve to 127.0.0.1
  • ✅ Fails early with clear, actionable error messages if entries are missing
  • ✅ Works without sudo permissions
  • ✅ Supports macOS, Linux, and WSL environments
  • ✅ Provides platform-specific guidance

Changes

local-setup/scripts/check-environment.sh

  • Added check_hosts_entry() function that detects OS and uses appropriate DNS resolution method
    • macOS: Uses dscacheutil
    • Linux: Uses getent (with fallback to direct /etc/hosts parsing)
    • Filters out IPv6 addresses (only checks for 127.0.0.1)
  • Added check_hosts_entries() function that validates both required hostnames
    • Shows clear error messages listing missing hosts
    • Provides copy-paste ready command for /etc/hosts
    • Includes WSL-specific guidance when detected
  • Integrated check into run_environment_checks() to run before installation starts

local-setup/scripts/start.sh

  • Removed redundant hosts entry instruction at end (since we now validate upfront)
  • Changed message to only remind about organization-specific hosts entries
  • Moved WSL guidance after organization warning for better flow

Add pre-installation check to verify that portal.dev.local and kcp.api.portal.dev.local resolve to 127.0.0.1 before starting the local setup process.

Changes:
- Add check_hosts_entry() and check_hosts_entries() functions to check-environment.sh
- Validate DNS entries during environment checks phase
- Fail early with clear, actionable error messages if entries are missing
- Provide platform-specific guidance (macOS, Linux, WSL)
- No sudo required - uses native OS tools (dscacheutil, getent) with fallback to /etc/hosts parsing
- Update end-of-installation message to only remind about organization-specific hosts entries

This prevents the installation from failing with cryptic connection errors when kubectl commands try to access kcp.api.portal.dev.local during the installation process.

Signed-off-by: Bastian Echterhölter <bastian.echterhoelter@sap.com>
On-behalf-of: @SAP <bastian.echterhoelter@sap.com>
@nexus49 nexus49 force-pushed the feat/add-hosts-entry-check branch from 3cc25ed to 333a843 Compare December 19, 2025 07:21
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.

local setup fails with dial tcp: lookup kcp.api.portal.dev.local on 127.0.0.53:53: when hosts entries are not set ahead of time

3 participants