GoogleCloudPlatform / k8s-config-connector

GCP Config Connector, a Kubernetes add-on for managing GCP resources
https://cloud.google.com/config-connector/docs/overview
Apache License 2.0
894 stars 228 forks source link

Dependent Environment Variables doesn't work with config connector. #3072

Open fnacarellidev opened 4 days ago

fnacarellidev commented 4 days ago

Checklist

Bug Description

I'm not sure if this is a bug or if it has not been implemented, I was trying to do something like the dependent environment variables from k8s, but using config connector, however it does not seem to work, I tried doing exactly as k8s exemplifies by setting a variable hardcoded and trying using it on the next variable, however the variable is not expanded.

Additional Diagnostic Information

Expected the variable to be expanded, for example:

env:
  - name: VAL1
    value: World
  - name: VAL2
    value: "Hello, $(VAL1)"

Logging that on the application pushed to production gives the following output: INFO [18:29:56.093] [DefaultDispatcher-worker-1] com.trash.svcs.tracker.TrackerEndpoint - Hello, $(VAL1)

Expected: INFO [18:29:56.093] [DefaultDispatcher-worker-1] com.trash.svcs.tracker.TrackerEndpoint - Hello, World

Kubernetes Cluster Version

v1.29.1

Config Connector Version

1.123.1

Config Connector Mode

namespaced mode (default)

Log Output

No response

Steps to reproduce the issue

Set 2 variables, the first with some arbitrary text, and try to use its value on the next variable, I think it will be easier to understante looking at the yaml snippet provided ahead.

YAML snippets

apiVersion: run.cnrm.cloud.google.com/v1beta1
kind: RunService
spec:
  ingress: "INGRESS_TRAFFIC_ALL"
  location: "us-central1"
  projectRef:
    external: projects/trash-362115
  template:
    timeout: "600s"
    containers:
      - image: gcr.io/trash-362115/svcs.tracker
        env:
        - name: VAL1
          value: World
        - name: VAL2
          value: "Hello, $(VAL1)"
fnacarellidev commented 4 days ago

I would be very interested in trying to solve the problem myself, maybe with a little help i'll be able.