Commit db2617fd authored by Sean McGivern's avatar Sean McGivern

Merge branch 'default-kubernetes-namespace' into 'master'

Make a default namespace of Kubernetes service to contain project ID

Closes #28516

See merge request !9741
parents 79c9eab1 6fa106b8
...@@ -36,7 +36,7 @@ class KubernetesService < DeploymentService ...@@ -36,7 +36,7 @@ class KubernetesService < DeploymentService
def initialize_properties def initialize_properties
if properties.nil? if properties.nil?
self.properties = {} self.properties = {}
self.namespace = project.path if project.present? self.namespace = "#{project.path}-#{project.id}" if project.present?
end end
end end
......
---
title: Make a default namespace of Kubernetes service to contain project ID
merge_request:
author:
...@@ -74,8 +74,10 @@ describe KubernetesService, models: true, caching: true do ...@@ -74,8 +74,10 @@ describe KubernetesService, models: true, caching: true do
describe '#initialize_properties' do describe '#initialize_properties' do
context 'with a project' do context 'with a project' do
it 'defaults to the project name' do let(:namespace_name) { "#{project.path}-#{project.id}" }
expect(described_class.new(project: project).namespace).to eq(project.name)
it 'defaults to the project name with ID' do
expect(described_class.new(project: project).namespace).to eq(namespace_name)
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment