Skip to content

Commit

Permalink
fix(app): escape username in registry secret name
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Bleuler authored and ableuler committed Oct 5, 2020
1 parent c9b919a commit e960e36
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions renku_notebooks/api/notebooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@
"""Notebooks service API."""
import json
import os
from kubernetes.client.rest import ApiException

import escapism
from flask import Blueprint, abort, current_app, jsonify, request, make_response
from kubernetes.client.rest import ApiException

from .. import config
from ..util.gitlab_ import (
Expand Down Expand Up @@ -146,7 +147,8 @@ def launch_notebook(user):

# only create a pull secret if the project has limited visibility and a token is available
if config.GITLAB_AUTH and gl_project.visibility in {"private", "internal"}:
secret_name = f"{user.get('name')}-registry"
safe_username = escapism.escape(user.get("name"), escape_char="-").lower()
secret_name = f"{safe_username}-registry"
create_or_replace_registry_secret(user, namespace, secret_name)
payload["image_pull_secrets"] = [secret_name]

Expand Down

0 comments on commit e960e36

Please sign in to comment.