Keda: ResolveContainerEnv does not consider interdependent environment variables

Created on 25 Sep 2020  路  5Comments  路  Source: kedacore/keda

This is a follow up of #1181 . Turns out my connection string cannot be parsed because I am setting it up using interdependent environment variables

My setup looks like this:

      env:
        - name: SERVICEBUS_CONNECT_GENERAL
          valueFrom:
            secretKeyRef:
              name: service-bus
              key: connectionString
        - name: SERVICEBUS_CONNECT
          value: $(SERVICEBUS_CONNECT_GENERAL);EntityPath=my-topic

Which I use, since I have around 20 topics and do not want to maintain 20 different secrets, as the connection string is always the same. The concept is supported from a kubernetes point of view, but apparantly the function ResolveContainerEnvdoes not consider interdependent variables.

Expected Behavior

The connection string is extracted from the environment like it is done in kubernetes

Actual Behavior

the connection string is extracted as $(SERVICEBUS_CONNECT_GENERAL);EntityPath=my-topic and can thus cannot be parsed.

Specifications

KEDA Version: 2.0.0 beta
Platform & Version: Azure Kubernetes Service
Kubernetes Version: 1.17.9
Scaler(s): Azure Service Bus

Hacktoberfest bug help wanted

Most helpful comment

Can I try to work on this? I am interested in this.

All 5 comments

Agree, we should support this. @rangp Are you willing to contribute this part?

@zroubalik in theory yes, in practice I have 0 experience in go. I suspect keda should use the logic here https://github.com/kubernetes/kubernetes/blob/88512be213159f87ed2dad07f75c02d355eadac5/pkg/kubelet/kubelet_pods.go, or at least emulate it.

But I don't think I will be able to contribute much in terms of a pull request.

Can I try to work on this? I am interested in this.

@mosesyou that's great, absolutely, go ahead 馃憤 Would be great to add some tests for env resolving as part of this effort.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cwhfa picture cwhfa  路  4Comments

alexakr picture alexakr  路  4Comments

aman-bansal picture aman-bansal  路  4Comments

trisberg picture trisberg  路  4Comments

audunsol picture audunsol  路  4Comments