Make a default namespace of Kubernetes service to contain project ID

This commit is contained in:
Kamil Trzcinski 2017-03-06 20:32:37 +01:00
parent 348dff0a82
commit 6fa106b898
No known key found for this signature in database
GPG Key ID: 4505F5C7E12C6A5A
3 changed files with 9 additions and 3 deletions

View File

@ -36,7 +36,7 @@ class KubernetesService < DeploymentService
def initialize_properties
if properties.nil?
self.properties = {}
self.namespace = project.path if project.present?
self.namespace = "#{project.path}-#{project.id}" if project.present?
end
end

View File

@ -0,0 +1,4 @@
---
title: Make a default namespace of Kubernetes service to contain project ID
merge_request:
author:

View File

@ -74,8 +74,10 @@ describe KubernetesService, models: true, caching: true do
describe '#initialize_properties' do
context 'with a project' do
it 'defaults to the project name' do
expect(described_class.new(project: project).namespace).to eq(project.name)
let(:namespace_name) { "#{project.path}-#{project.id}" }
it 'defaults to the project name with ID' do
expect(described_class.new(project: project).namespace).to eq(namespace_name)
end
end