Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v3 env substitution is not working #650

Closed
bgruening opened this issue Jun 18, 2017 · 4 comments · Fixed by #658
Closed

v3 env substitution is not working #650

bgruening opened this issue Jun 18, 2017 · 4 comments · Fixed by #658

Comments

@bgruening
Copy link

Hi,

I have a few problems with the latest kompose version and the substitutions of env vars.

bag@bag ~/temp/foo % go get -u github.com/kubernetes-incubator/kompose                                                  
bag@bag ~/temp/foo % kompose version
0.7.0 (08658d3)

This small test file:

version: "3"
services:
  web:
    image: quay.io/bgruening/galaxy-web:${IMAGE_VER:-latest}
    environment:
        - GALAXY_RUNNERS_ENABLE_K8=${GALAXY_RUNNERS_ENABLE_K8}

result in this k8s file:

bag@bag ~/temp/foo % IMAGE_VER=foo GALAXY_RUNNERS_ENABLE_K8="asdf" kompose convert -f k8.yaml && cat web-deployment.yaml
INFO Kubernetes file "web-service.yaml" created   
INFO Kubernetes file "web-deployment.yaml" created 
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  creationTimestamp: null
  labels:
    io.kompose.service: web
  name: web
spec:
  replicas: 1
  strategy: {}
  template:
    metadata:
      creationTimestamp: null
      labels:
        io.kompose.service: web
    spec:
      containers:
      - env:
        - name: GALAXY_RUNNERS_ENABLE_K8
        image: quay.io/bgruening/galaxy-web:latest
        name: web
        resources: {}
      restartPolicy: Always
status: {}

I tried to create an .env file

GALAXY_RUNNERS_ENABLE_K8=True
IMAGE_VER=8.9

and also exported it with no success.

- GALAXY_RUNNERS_ENABLE_K8=${GALAXY_RUNNERS_ENABLE_K8:-default} in the docker-compose.yml file will substitute it with default but not with the values available during runtime.
- GALAXY_RUNNERS_ENABLE_K8=$GALAXY_RUNNERS_ENABLE_K8 does not work at all.

Thanks a lot for any help!

@bgruening
Copy link
Author

ping @cdrage as you have rocked the v3 world lately :)

@cdrage
Copy link
Member

cdrage commented Jun 19, 2017

Hey @bgruening I'm going to have a look into this and see what's up! Other than the env variables, I'm assuming everything has converted correctly for docker-galaxy-stable?

@bgruening
Copy link
Author

@cdrage galaxy-docker-stable is a very complicated beast and we have some more problems.

For example this one: bgruening/docker-galaxy-stable@2c56ffa

An other thing is that I want to get this under CI testing. So I use ./hack/local-up-cluster.sh to start a k8s test env and in this it seems I need to have PV.yaml files which are not generated.

Coming back to the env problem this is the hack I'm currently using, maybe this helps in some way. It works reliable as bash is probably the best way to replace bash envs :)

#!/bin/bash
cat > $2 << EOF
`cat $1`
EOF

Thanks @cdrage for working on this!

@kadel
Copy link
Member

kadel commented Jun 20, 2017

hope I haven't stepped on your toe @cdrage 😇 I just wanted to look what is happening there, and saw a solution - #658 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants