Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Container environment variables key name restriction #447

Closed
mohanpindyala opened this issue Jun 14, 2016 · 2 comments
Closed

Container environment variables key name restriction #447

mohanpindyala opened this issue Jun 14, 2016 · 2 comments

Comments

@mohanpindyala
Copy link

mohanpindyala commented Jun 14, 2016

I am trying to add environment variables for containers , looks like there is restriction for key names
[a-zA-Z0-9_]
Sample code
List<EnvVar> envValues = new ArrayList<>(); for (Map.Entry<String, String> env : envProps.entrySet()) { EnvVar envVar = new EnvVar(); envVar.setName(env.getKey()); envVar.setValue(env.getValue()); envValues.add(envVar); } container.setEnv(envValues);

I try to use key like myprop.db.name it barfs . Is this client library limitation or k8s itself ?

@jimmidyson
Copy link
Contributor

@chenlein
Copy link
Contributor

@jimmidyson Kubernetes was relax restrictions on environment variable names.
Sample code:

          env:
            - name: "cluster.name"
              value: "elasticsearch-cluster-1550544058281"
            - name: "bootstrap.memory_lock"
              value: "true"
            - name: "discovery.zen.ping.unicast.hosts"
              value: "elasticsearch-discovery-1550544058281"
            - name: "node.master"
              value: "false"
            - name: "node.data"
              value: "true"
            - name: "ES_JAVA_OPTS"
              value: "-Xms8192m -Xmx8192m"

Error message:

javax.validation.ConstraintViolationException: Constraint Validations: name must match "^[A-Za-z_][A-Za-z0-9_]*$" on bean: EnvVar(name=cluster.name, value=elasticsearch-cluster-1550544067656, valueFrom=null, additionalProperties={})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants