-
Notifications
You must be signed in to change notification settings - Fork 792
[BUG] Environment variables referencing .env values are resolved as blank in generated manifests #2006
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
Variables like ${MINIO_USER}, ${MINIO_PASSWORD}, etc., should be resolved to their values defined in the .env file.
Generated manifests (e.g., minio-pod.yaml) should contain environment variables with non-empty values.
Actual Behavior
Kompose outputs warnings indicating variables are unset (e.g., WARN The "MINIO_PORT" variable is not set. Defaulting to a blank string).
terminal output:
WARN The "MINIO_USER" variable is not set. Defaulting to a blank string.
WARN The "MINIO_PASSWORD" variable is not set. Defaulting to a blank string.
WARN The "TIMEZONE" variable is not set. Defaulting to a blank string.
WARN The "MINIO_PORT" variable is not set. Defaulting to a blank string.
WARN The "MINIO_CONSOLE_PORT" variable is not set. Defaulting to a blank string.
WARN /Users/xiaoyuefan/workenv-new/kompose/pkg/loader/compose/docker-compose-simple.yml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion
WARN File don't exist or failed to check if the directory is empty: stat :/data: no such file or directory
INFO Kubernetes file "pkg/loader/compose/docker-compose-simple/templates/minio-service.yaml" created
INFO Kubernetes file "pkg/loader/compose/docker-compose-simple/templates/minio-pod.yaml" created
INFO Kubernetes file "pkg/loader/compose/docker-compose-simple/templates/env-configmap.yaml" created
INFO Kubernetes file "pkg/loader/compose/docker-compose-simple/templates/minio-data-persistentvolumeclaim.yaml" created
INFO chart created in "./pkg/loader/compose/docker-compose-simple/"
The generated minio-pod.yaml includes environment variables with empty values:
apiVersion: v1
kind: Pod
metadata:
annotations:
kompose.cmd: kompose -f ./pkg/loader/compose/docker-compose-simple.yml convert -c
kompose.version: 1.35.0 (HEAD)
labels:
io.kompose.service: minio
name: minio
spec:
containers:
- args:
- server
- --console-address
- :9001
- /data
env:
- name: MINIO_CONSOLE_PORT
valueFrom:
configMapKeyRef:
key: MINIO_CONSOLE_PORT
name: env
- name: MINIO_HOST
valueFrom:
configMapKeyRef:
key: MINIO_HOST
name: env
- name: MINIO_PASSWORD
valueFrom:
configMapKeyRef:
key: MINIO_PASSWORD
name: env
- name: MINIO_PORT
valueFrom:
configMapKeyRef:
key: MINIO_PORT
name: env
- name: MINIO_ROOT_PASSWORD
- name: MINIO_ROOT_USER
- name: MINIO_USER
valueFrom:
configMapKeyRef:
key: MINIO_USER
name: env
- name: TIMEZONE
valueFrom:
configMapKeyRef:
key: TIMEZONE
name: env
- name: TZ
image: quay.io/minio/minio:RELEASE.2023-12-20T01-00-02Z
name: ragflow-minio
ports:
- containerPort: 9000
protocol: TCP
- containerPort: 9001
protocol: TCP
volumeMounts:
- mountPath: /data
name: minio-data
restartPolicy: OnFailure
volumes:
- name: minio-data
persistentVolumeClaim:
claimName: minio-data
Steps To Reproduce
- Create a
docker-compose-simple.ymlwith:
version: '3'
services:
minio:
image: quay.io/minio/minio:RELEASE.2023-12-20T01-00-02Z
env_file: .env
environment:
- MINIO_ROOT_USER=${MINIO_USER}
- MINIO_ROOT_PASSWORD=${MINIO_PASSWORD}
- TZ=${TIMEZONE}
ports:
- ${MINIO_PORT}:9000
- ${MINIO_CONSOLE_PORT}:9001
- Create a
.envfile in the same directory with:
MINIO_USER=rag_flow
MINIO_PASSWORD=infini_rag_flow
TIMEZONE=Asia/Shanghai
MINIO_PORT=9000
MINIO_CONSOLE_PORT=9001
- Run
kompose -f docker-compose-simple.yml convert -c.
Kompose Version
1.35.0
Docker-Compose file
version: '3'
services:
minio:
image: quay.io/minio/minio:RELEASE.2023-12-20T01-00-02Z
env_file: .env
environment:
- MINIO_ROOT_USER=${MINIO_USER}
- MINIO_ROOT_PASSWORD=${MINIO_PASSWORD}
- TZ=${TIMEZONE}
ports:
- ${MINIO_PORT}:9000
- ${MINIO_CONSOLE_PORT}:9001Anything else?
If this is confirmed as a bug, I would be glad to submit a fix.
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.