diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-06 09:08:30 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-06 09:08:30 +0300 |
commit | ab128cc125f9db0c3a1bd48845f90c3d61ef42c9 (patch) | |
tree | c3a1fc2bc7a6109b35597fd6e7a0a11089af0ec4 /app/models/clusters | |
parent | a6011c3d70e0e8ac318ba6629183c44f8614c4df (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/clusters')
-rw-r--r-- | app/models/clusters/cluster.rb | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/app/models/clusters/cluster.rb b/app/models/clusters/cluster.rb index 7f155a8d435..78efe2b4337 100644 --- a/app/models/clusters/cluster.rb +++ b/app/models/clusters/cluster.rb @@ -249,9 +249,13 @@ module Clusters platform_kubernetes.kubeclient if kubernetes? end - def kubernetes_namespace_for(environment) + def kubernetes_namespace_for(environment, deployable: environment.last_deployable) + if deployable && environment.project_id != deployable.project_id + raise ArgumentError, 'environment.project_id must match deployable.project_id' + end + managed_namespace(environment) || - ci_configured_namespace(environment) || + ci_configured_namespace(deployable) || default_namespace(environment) end @@ -318,8 +322,11 @@ module Clusters ).execute&.namespace end - def ci_configured_namespace(environment) - environment.last_deployable&.expanded_kubernetes_namespace + def ci_configured_namespace(deployable) + # YAML configuration of namespaces not supported for managed clusters + return if managed? + + deployable&.expanded_kubernetes_namespace end def default_namespace(environment) |