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

Invalid environment variables, rkt volume with dash or underscore in task name #2358

Closed
blalor opened this issue Feb 24, 2017 · 4 comments
Closed

Comments

@blalor
Copy link
Contributor

blalor commented Feb 24, 2017

  • Nomad v0.5.4
  • CentOS Linux release 7.3.1611 (Core), 4.9.10-1.el7.elrepo.x86_64
  • rkt Version: 1.24.0
job "example" {
    group "example" {
        task "$TASK0" {
            driver = "rkt"

            config {
                image = "example.com/aci0:LATEST"

                port_map {
                    api = "api"
                }
            }
        }
        
        task "othertask" {
            driver = "rkt"
            
            config {
                image = "example.com/aci1:LATEST"
            }
    }
}
  1. If $TASK0 is set to log-ingester, rkt run will fail for the second (othertask) task because Nomad attempts to set the environment variable NOMAD_ADDR_log-ingester_api, and the - is not a valid environment variable name, per the ACI spec (IEEE Std 1003.1-2001).

  2. If $TASK0 is set to log_ingester (trying to work around the above problem), rkt run will fail for the first (log_ingester/$TASK0) task because Nomad creates invalid volume names for the local, alloc, and secret directories:

     Error: invalid argument "$ALLOC_ID-log_ingester-alloc,kind=host,source=…" for --volume=$ALLOC_ID-log_ingester-alloc,kind=host,source=…:
         invalid value in --volume flag "$ALLOC_ID-log_ingester-alloc,kind=host,source=…":
             ACName must contain only lower case alphanumeric characters plus "-"
    

ACName must be ^[a-z0-9]+([-][a-z0-9]+)*$

The workaround for both of these is to make the task name match ^[a-z0-9]+$. The 2nd issue is obviously rkt-specific, but unless the Docker driver does something different about the environment variables, they're of limited use with bash, for example.

@blalor
Copy link
Contributor Author

blalor commented Mar 7, 2017

related to #2406 #2405

@schmichael
Copy link
Member

  1. is fixed by Replace "-" in port labels with "_" for env vars #2406 (there's an attached binary you can test with if you have time); working on 2. now.

My plan is to just escape underscores with dashes in rkt volume names since we just need a task unique name.

A safer approach would be to hash+base32 task names in volumes as the volume name just needs to be unique, but I'd really like to make the names human readable if possible.

@schmichael
Copy link
Member

#2416 should enforce env var name compliance with the standard.

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants