Skip to content

Commit

Permalink
Use dns safe usernames in dask pod labels
Browse files Browse the repository at this point in the history
  • Loading branch information
yuvipanda committed Dec 9, 2020
1 parent 4c83800 commit fdda146
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pangeo-deploy/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,24 @@ daskhub:
extraConfig:
optionHandler: |
from dask_gateway_server.options import Options, Float, String, Mapping
import string
from escapism import escape
dns_safe_chars = set(string.ascii_lowercase + string.digits)
def cluster_options(user):
# All valid label values must be DNS Safe
dns_safe_username = escapism.escape(user.name, safe=safe_chars, escape_char='-').lower()
def option_handler(options):
if ":" not in options.image:
raise ValueError("When specifying an image you must also provide a tag")
extra_annotations = {
"hub.jupyter.org/username": user.name,
"hub.jupyter.org/username": dns_safe_username,
"prometheus.io/scrape": "true",
"prometheus.io/port": "8787",
}
extra_labels = {
"hub.jupyter.org/username": user.name,
"hub.jupyter.org/username": dns_safe_username,
}
# We multiply the requests by 0.95 to ensure that that they
# pack well onto nodes. Kubernetes reserves a small fraction
Expand Down

0 comments on commit fdda146

Please sign in to comment.