-
Notifications
You must be signed in to change notification settings - Fork 792
[BUG] Conflicting name assigned to configmap generated for compose referencing ".env" files #1793
Copy link
Copy link
Closed
Labels
kind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.
Description
Expected Behavior
Compose files which refer to environment variables from files such as ".env" or ".env.local" in a simple React application should produce a configmap file whose filename follows the appropriate regex rules required by kubernetes.
Actual Behavior
For compose referencing env_files begining with ".env", the generated file name of configmap does not follow appropriate regex rules, which prevents deployment on minikube or any other platform.
Steps To Reproduce
- For this
docker-compose.yaml
version: '3.8'
services:
mongodb:
image: mongo:latest
restart: always
expose:
- 27017
app:
depends_on:
- mongodb
env_file:
- ./src/app/.env.local
build: src/
ports:
- "3000:3000"- On running
kompose convert -f docker-compose.yaml - File name for configmap
< path with '/' replace with '-' >-app--env-configmap.yaml - On minikube run
kubectl apply -f app-deployment.yaml - The deployment is not created

Kompose Version
1.31.2 (a92241f79)
Docker-Compose file
version: '3.8'
services:
mongodb:
image: mongo:latest
restart: always
expose:
- 27017
app:
depends_on:
- mongodb
env_file:
- ./src/app/.env
build: src/
ports:
- "3000:3000"Anything else?
The issue seems to be in kompose/pkg/transformer/kubernetes/k8sutils.go in the FormatEnvName function where the '.' has been replaced with '-' and can be resolved as shown in the below screen shot .
Thanks
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
kind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.
