summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorThong Kuah <tkuah@gitlab.com>2018-12-10 13:31:22 +1300
committerThong Kuah <tkuah@gitlab.com>2018-12-10 13:57:19 +1300
commit22289352be9cfb2e031634394ab19cf778f68b6c (patch)
tree95b6ccd94045ae1758ef87c6a736ad952b65da79 /app/controllers
parent6cbc982ceeab56542701aa9b5c36cc4ae343cc53 (diff)
downloadgitlab-ce-22289352be9cfb2e031634394ab19cf778f68b6c.tar.gz
Set cluster_type for a new cluster
This enables #allow_user_defined_namespace? to work so that the form for a group cluster will now longer show the "Project namespace" field.
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/clusters/clusters_controller.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/app/controllers/clusters/clusters_controller.rb b/app/controllers/clusters/clusters_controller.rb
index 2e9c77ae55c..86721fd7a7e 100644
--- a/app/controllers/clusters/clusters_controller.rb
+++ b/app/controllers/clusters/clusters_controller.rb
@@ -189,6 +189,15 @@ class Clusters::ClustersController < Clusters::BaseController
def user_cluster
@user_cluster = ::Clusters::Cluster.new.tap do |cluster|
cluster.build_platform_kubernetes
+
+ case clusterable.subject
+ when ::Project
+ cluster.cluster_type = :project_type
+ when ::Group
+ cluster.cluster_type = :group_type
+ else
+ raise NotImplementedError
+ end
end.present(current_user: current_user)
end