Skip to content

Conversation

@kfess
Copy link
Member

@kfess kfess commented Nov 20, 2025

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

@k8s-ci-robot k8s-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Nov 20, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: kfess
Once this PR has been reviewed and has the lgtm label, please assign cdrage for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

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

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Nov 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for converting Docker Compose extra_hosts to Kubernetes hostAliases

2 participants