Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion pkg/resources/management.cattle.io/v3/project/mutator.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,9 @@ func (m *Mutator) createProjectNamespace(project *v3.Project) (*v3.Project, erro
// for the backing namespace, we need to generate it ourselves
if project.Name == "" {
// If err is nil, (meaning "project exists", see below) we need to repeat the generation process to find a project name and backing namespace that isn't taken
newName := ""
for err == nil {
newName := names.SimpleNameGenerator.GenerateName(project.GenerateName)
newName = names.SimpleNameGenerator.GenerateName(project.GenerateName)
_, err = m.projectCache.Get(newProject.Spec.ClusterName, newName)
if err == nil {
// A project with this name already exists. Generate a new name.
Expand All @@ -173,6 +174,7 @@ func (m *Mutator) createProjectNamespace(project *v3.Project) (*v3.Project, erro
return nil, err
}
}
newProject.Name = newName
} else {
backingNamespace = name.SafeConcatName(newProject.Spec.ClusterName, strings.ToLower(newProject.Name))
_, err = m.namespaceCache.Get(backingNamespace)
Expand Down
Loading