Create TAP Workload with a long list of environment variables
search cancel

Create TAP Workload with a long list of environment variables

book

Article ID: 428071

calendar_today

Updated On:

Products

VMware Tanzu Platform - Kubernetes

Issue/Introduction

  • How we can create a workload with a very long list (ie. >200) of environment variables tied to it?
  • If we create a workload with them defined one by one under spec.env, we get a "place-scripts exec /usr/bin/sh: argument list too long " error in the config-writer pod. 
  • If we attempt to map them to a config map in the workload definition by doing something such as:
spec:
  envFrom:
    - configMapRef:
        name: my-config-map
  • We get the following error:

Workload in version "v1alpha1" cannot be handled as a Workload: strict decoding error: unknown field "spec.envFrom"

Environment

TAP 1.12.3

Cause

There is a limitation in the number of environment variables that can be applied in the Workload configuration, which prevents workload creation.

Resolution

Reference the configMap with spec.env.valueFrom.configMapKeyRef in the workload yaml.

 

If this fails, it is recommended to load the variables via a file in the pod to work around limitations in the workload yaml configuration.