Skip to content

Commit

Permalink
Fix auto-deployment labels to be valid GCP labels.
Browse files Browse the repository at this point in the history
Related to:
 kubeflow#444
  • Loading branch information
Jeremy Lewi committed Oct 25, 2019
1 parent 6828c18 commit bafa3d4
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions py/kubeflow/testing/create_unique_kf_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,16 +198,15 @@ def main(): # pylint: disable=too-many-locals,too-many-statements
env.update(os.environ)
env.update(oauth_info)

labels = {"GIT_LABEL": git_describe,
"PURPOSE": "kf-test-cluster",}
# GCP labels can only take as input alphanumeric characters, hyphens, and
# underscores. Replace not valid characters with hyphens.
labels = {"git": git_describe,
"purpose": "kf-test-cluster",}

label_args = []
for k, v in labels.items():
# labels can only take as input alphanumeric characters, hyphens, and
# underscores. Replace not valid characters with hyphens.
val = v.lower().replace("\"", "")
val = re.sub(r"[^a-z0-9\-_]", "-", val)
label_args.append("{key}={val}".format(key=k.lower(), val=val))
labels[k] = v

deploy_with_kfctl_go(kfctl_path, args, app_dir, env, labels=labels)

Expand Down

0 comments on commit bafa3d4

Please sign in to comment.