Env-from

The env-from trait mounts component environment variables from ConfigMaps or Secrets.

The following snippet shows an example application with a component and the env-from trait to mount environment variables from a ConfigMap and a Secret.

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
  name: my-app
  annotations: 
    version: "v0.0.1"
    description: "My application"
spec:
  components:
    - name: busybox
      type: worker
      properties:
        image: my-app-image:v1.0.0
        cmd: ["cmd"]
      traits:
        - type: sidecar
          properties:
            name: container-name
            image: my-container-image:v1.0.0
        - type: env-from
          properties:
            containerName: container-name # (Optional) Specify the name of the target container, if not set, use the component name
            configmapName: [configmap1, configmap2...] # (Optional) Specify the name of the configmap to be mounted as env vars
            secretName: [secret1, secret2] # (Optional) Specify the name of the secret to be mounted as env vars