Skip to content

[Feature] customizing service name #1635

@s33kers

Description

@s33kers

What would you like to be added?

Now when creating Service and Deployment out of docker-compose.yaml service name is used for Kubernetes resource naming which cannot be customized out-of-the-box (e.g. providing environment variables for docker-compose.yaml during docker compose config)

  • Option would be to have kompose label (e.g. kompose.name-override) which would allow modifying Kubernetes resource name
  • Option would be to provide flag during kompose convert which would apply it as a prefix for all resources

Using container_name only changes container name within Pod.
Using kompose.service.group partially lets us achieve goal because Services are left with the same name as it is in docker-compose.yaml

Currently, we are solving that with string replace
docker-compose.yaml

services:
  prefix-service-a:
    image: xxx:latest
    ports:
      - "9999:9999"

  prefix-service-b:
    image: yyy:latest
    ports:
      - "8888:8888"
    environment:
      URL: http://prefix-xxx:9999

and then applying sed -i -e "s/prefix-/${random-uuid}/g" docker-compose.yaml before kompose convert

Why is this needed?

Kubernetes Service name cannot be customized when generating resources from docker-compose.yaml

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/featureCategorizes issue or PR as related to a new feature.lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions