Search code examples
kubernetesopenshiftopenshift-3

Kubernete / Openshift: Config map contains keys that are not valid environment variable names / xxx.yml is not a valid variable


Is this supported by Kubernete / Openshift 3? I use a yaml file after data: and got error from Openshift:

Config map app-config contains keys that are not valid environment variable names. Only config map keys with valid names will be added as environment variables.

enter image description here

And:

enter image description here

Strangely, it says operatorconfig.yml is not a valid variable, but it's not a variable, it's a file.

Before, it was operator-config.yml, but now after removing -, it still does not work.

The definition is like this:

  - apiVersion: v1
    kind: ConfigMap
    metadata:
      name: app-config
    data:
      appconfig.yml: |
        swarm:
          resource-adapters:
            resource-adapters:
              activemq-rar:
                config-properties:
                  ServerUrl:
                    value: {{ some_url }}
                  UserName:
                    value: {{ some_user }}
        anothercomponent:
          url: {{ some_url }}
      operatorconfig.yml: {{ APP_OPERATOR_CONFIG | to_nice_yaml(width=99999) | trim | to_yaml(width=99999) }}

Neither does appconfig.yml nor operatorconfig.yml works, none got their property values recognized by the service.

I noticed that if it's property file, or properties file without file extension, it works in the official page. Does this mean yaml is not supported?? https://docs.openshift.com/container-platform/3.11/dev_guide/configmaps.html


Solution

  • Config map app-config contains keys that are not valid environment variable names

    Above error denotes that ConfigMap used for a container inside pod is loaded as environment variables. its an issue with environment variable key name used. Variables with "." is not supported naming convention for environmental variables ex: test.var, operatorconfig.yml and appconfig.yml