kompose icon indicating copy to clipboard operation
kompose copied to clipboard

feature: add support for hostAliases

Open kfess opened this issue 1 month ago • 1 comments

What type of PR is this?

/kind feature

What this PR does / why we need it:

This PR adds support for converting Docker Compose's extra_hosts field to Kubernetes' hostAliases field in Pod specifications.

When a docker-compose.yaml file contains extra_hosts entries, Kompose will now automatically convert them to the equivalent Kubernetes hostAliases configuration. This allows users to maintain custom host-to-IP mappings when migrating from Docker Compose to Kubernetes.

Which issue(s) this PR fixes:

Fixes #2066

Special notes for your reviewer:

  • The conversion logic maps each extra_hosts entry (format: "hostname:ip") to a corresponding hostAliases entry with the IP and hostname
  • Added unit tests to verify the conversion behavior

kfess avatar Nov 20 '25 10:11 kfess

@dependabot rebase

eddumelendez avatar Dec 09 '25 18:12 eddumelendez