Home > Software design >  How to use env variable on kubernetes script?
How to use env variable on kubernetes script?

Time:09-27

I have this kubernetes script on argo workflows template

- name: rendition-composer
  inputs:
    parameters:
      - name: original_resolution
  script:
    image: node:9.1-alpine
    command: [node]
    source: |
      // some node.js script
      ...
      console.log($(SD_RENDITION));
    volumeMounts: 
    - name: workdir
      mountPath: /mnt/vol
    - name: config
      mountPath: /config
      readOnly: true
    env:
      - name: SD_RENDITION
        valueFrom: 
          configMapKeyRef:
            name: rendition-specification           
            key: res480p

In here console.log($(SD_RENDITION)); I can't get the env value. it returns error

ReferenceError: $ is not defined

I already did all the setup for the ConfigMap on this kubernetes official documentation

Is there anything I miss?

CodePudding user response:

process.env.SD_RENDITION

The above syntax solved my problem. It seems I miss some essential concepts about js' process object

  • Related