kubernetes / kompose

Convert Compose to Kubernetes
http://kompose.io
Apache License 2.0
9.62k stars 760 forks source link

[BUG] Can't escape interpolation #1906

Open slaskis opened 3 months ago

slaskis commented 3 months ago

Expected Behavior

Expect $$REDIS_PASSWORD to be interpolated according to the compose spec so into $REDIS_PASSWORD.

Actual Behavior

It interpolated it into $(REDIS)_PASSWORD.

Steps To Reproduce

  1. Run kompose convert
  2. Look into the "redis-deployment.yaml" file and see $$REDIS_PASSWORD being interpolated as $(REDIS)_PASSWORD

Kompose Version

1.34.0 (HEAD)

Docker-Compose file

services:
  redis:
    image: redis
    command: redis-server --requirepass $$REDIS_PASSWORD
    ports:
      - 6379

Anything else?

No response

slaskis commented 3 months ago

An interesting observation is that the healthcheck test seems to interpolate it correctly:

services:
  redis:
    image: redis
    command: redis-server --requirepass $$REDIS_PASSWORD
    healthcheck:
      test: redis-cli -a $$REDIS_PASSWORD --raw incr ping
    ports:
      - 6379
apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    kompose.cmd: kompose convert
    kompose.version: 1.34.0 (HEAD)
  labels:
    io.kompose.service: redis
  name: redis
spec:
  replicas: 1
  selector:
    matchLabels:
      io.kompose.service: redis
  template:
    metadata:
      annotations:
        kompose.cmd: kompose convert
        kompose.version: 1.34.0 (HEAD)
      labels:
        io.kompose.service: redis
    spec:
      containers:
        - args:
            - redis-server
            - --requirepass
            - $(){REDIS_PASSWORD}
          image: redis
          livenessProbe:
            exec:
              command:
                - redis-cli -a $REDIS_PASSWORD --raw incr ping
            failureThreshold: 120
            periodSeconds: 3
            timeoutSeconds: 10
          name: redis
          ports:
            - containerPort: 6379
              protocol: TCP
      restartPolicy: Always
k8s-triage-robot commented 3 weeks ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale