Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMayra Cabrera <mcabrera@gitlab.com>2019-01-23 19:28:19 +0300
committerMayra Cabrera <mcabrera@gitlab.com>2019-02-04 20:43:34 +0300
commit8ff73614a1466ffc39e4464462719e7456c03e29 (patch)
tree8573da7dc5ea258c1aa7bd373b757b4b0e6cf996 /app/models/clusters/cluster.rb
parent280b6f6f8d038c4c28b32c5965e8a052adf4a052 (diff)
Moves domain setting to Cluster setting
Changes domain field to be on the Cluster page show, removing it from Auto DevOps setting. Also injects the new environment variable KUBE_INGRESS_BASE_DOMAIN into kubernetes#predefined_variables. Migration to move the information from ProjectAutoDevops#domain to Clusters::Cluster#domain. As well as necessary modifications to qa selectors Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/52363
Diffstat (limited to 'app/models/clusters/cluster.rb')
-rw-r--r--app/models/clusters/cluster.rb19
1 files changed, 18 insertions, 1 deletions
diff --git a/app/models/clusters/cluster.rb b/app/models/clusters/cluster.rb
index a2c48973fa5..2b677961df5 100644
--- a/app/models/clusters/cluster.rb
+++ b/app/models/clusters/cluster.rb
@@ -49,7 +49,7 @@ module Clusters
validates :name, cluster_name: true
validates :cluster_type, presence: true
- validates :domain, allow_nil: true, hostname: { allow_numeric_hostname: true, require_valid_tld: true }
+ validates :domain, allow_blank: true, hostname: { allow_numeric_hostname: true, require_valid_tld: true }
validate :restrict_modification, on: :update
validate :no_groups, unless: :group_type?
@@ -65,6 +65,7 @@ module Clusters
delegate :available?, to: :application_ingress, prefix: true, allow_nil: true
delegate :available?, to: :application_prometheus, prefix: true, allow_nil: true
delegate :available?, to: :application_knative, prefix: true, allow_nil: true
+ delegate :external_ip, to: :application_ingress, prefix: true, allow_nil: true
enum cluster_type: {
instance_type: 1,
@@ -193,8 +194,24 @@ module Clusters
project_type?
end
+ def has_domain?
+ domain.present? || instance_domain.present?
+ end
+
+ def predefined_variables
+ Gitlab::Ci::Variables::Collection.new.tap do |variables|
+ break variables unless has_domain?
+
+ variables.append(key: 'KUBE_INGRESS_BASE_DOMAIN', value: domain.presence || instance_domain)
+ end
+ end
+
private
+ def instance_domain
+ Gitlab::CurrentSettings.auto_devops_domain
+ end
+
def restrict_modification
if provider&.on_creation?
errors.add(:base, "cannot modify during creation")