loft-sh / vcluster

vCluster - Create fully functional virtual Kubernetes clusters - Each vcluster runs inside a namespace of the underlying k8s cluster. It's cheaper than creating separate full-blown clusters and it offers better multi-tenancy and isolation than regular namespaces.
https://www.vcluster.com
Apache License 2.0
6.26k stars 398 forks source link

Dependent Environment Variables are not getting Expanded on using vcluster #170

Closed ramanNarasimhan77 closed 2 years ago

ramanNarasimhan77 commented 2 years ago

Hello,

As per Kubernetes documentation, it is possible to define interdependent environment variables

https://kubernetes.io/docs/tasks/inject-data-application/define-interdependent-environment-variables/

Based on this, we have a helm chart wherein the service port is exposed as a Generic Env using something like below:

MY_SERVICE_PORT: $(MY_CHART_MY_SERVICE_PORT)

This works fine when I installation via helm directly on the cluster.

However when I use vcluster, the Variable expansion/substitution is not happening and the value of MY_SERVICE_PORT is string $(MY_CHART_MY_SERVICE_PORT)

Using vCluster : Not Working MY_SERVICE_PORT is not set properly

$ env | grep PROXY_API_SERVICE_PORT MY_SERVICE_PORT=$(MY_CHART_MY_SERVICE_PORT) MY_CHART_MY_SERVICE_PORT=8001

Direct Installation on cluster: MY_SERVICE_PORT is set properly

$ env | grep PROXY_API_SERVICE_PORT MY_SERVICE_PORT=8001 MY_CHART_MY_SERVICE_PORT=8001

FabianKramm commented 2 years ago

@ramanNarasimhan77 thanks for creating this issue! Could you make an example pod yaml that we can deploy to reproduce this issue?

rajeshnair commented 2 years ago

@FabianKramm , thanks for the quick resolution of the issue. Can you release the fix in a new tag for us to pick it up?

ramanNarasimhan77 commented 2 years ago

@FabianKramm thank you for quick resolution. The helm chart which I was trying to install is proprietary and I was planning to create one and share with you today for testing but by then you have already provided guidance to @matskiv for issuing a fix

I have built the syncer image from master and tested the fix & it works great. Thank you once again for issuing a quick fix