namespace should be lowercased in kubernetes. This is also true for the scenario where the namespace is generated from the project group-name.

This commit is contained in:
Mircea Danila Dumitrescu 2017-10-02 20:32:36 +00:00
parent 4d5ea927d6
commit a1b3cd4064
2 changed files with 17 additions and 1 deletions

View File

@ -153,7 +153,17 @@ class KubernetesService < DeploymentService
end
def default_namespace
"#{project.path}-#{project.id}" if project.present?
return unless project
# 1. lowercase
# 2. replace non kubernetes characters with dash
# 3. trim dash from the beginning and end
slugified = "#{project.path}-#{project.id}"
slugified.downcase!
slugified.gsub!(/[^a-z0-9]/, '-')
slugified.gsub!(/^-+|-+$/, '')
slugified
end
def build_kubeclient!(api_path: 'api', api_version: 'v1')

View File

@ -0,0 +1,6 @@
---
title: Auto Devops kubernetes default namespace is now correctly built out of gitlab
project group-name
merge_request: 14642
author: Mircea Danila Dumitrescu
type: fixed