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:
parent
4d5ea927d6
commit
a1b3cd4064
2 changed files with 17 additions and 1 deletions
|
@ -153,7 +153,17 @@ class KubernetesService < DeploymentService
|
||||||
end
|
end
|
||||||
|
|
||||||
def default_namespace
|
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
|
end
|
||||||
|
|
||||||
def build_kubeclient!(api_path: 'api', api_version: 'v1')
|
def build_kubeclient!(api_path: 'api', api_version: 'v1')
|
||||||
|
|
6
changelogs/unreleased/mr-14642.yml
Normal file
6
changelogs/unreleased/mr-14642.yml
Normal 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
|
Loading…
Reference in a new issue