summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-20 15:08:44 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-20 15:08:44 +0000
commitb9bac6dbf78a5a7976fba14aaeef96bdeb0da612 (patch)
treeffe277b562256f718b0818e8fd3c8fd8766d0269 /lib
parent8c4198cbe631278e87fee04157d23494fbb80cdb (diff)
downloadgitlab-ce-b9bac6dbf78a5a7976fba14aaeef96bdeb0da612.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/kubernetes/helm.rb6
-rw-r--r--lib/gitlab/kubernetes/helm/client_command.rb2
-rw-r--r--lib/gitlab/serverless/domain.rb13
-rw-r--r--lib/gitlab/serverless/function_uri.rb46
-rw-r--r--lib/gitlab/serverless/service.rb6
5 files changed, 12 insertions, 61 deletions
diff --git a/lib/gitlab/kubernetes/helm.rb b/lib/gitlab/kubernetes/helm.rb
index c7c348ce9eb..9f66f35b5ab 100644
--- a/lib/gitlab/kubernetes/helm.rb
+++ b/lib/gitlab/kubernetes/helm.rb
@@ -10,6 +10,12 @@ module Gitlab
SERVICE_ACCOUNT = 'tiller'
CLUSTER_ROLE_BINDING = 'tiller-admin'
CLUSTER_ROLE = 'cluster-admin'
+
+ MANAGED_APPS_LOCAL_TILLER_FEATURE_FLAG = :managed_apps_local_tiller
+
+ def self.local_tiller_enabled?
+ Feature.enabled?(MANAGED_APPS_LOCAL_TILLER_FEATURE_FLAG)
+ end
end
end
end
diff --git a/lib/gitlab/kubernetes/helm/client_command.rb b/lib/gitlab/kubernetes/helm/client_command.rb
index b953ce24c4a..e7ade7e4d39 100644
--- a/lib/gitlab/kubernetes/helm/client_command.rb
+++ b/lib/gitlab/kubernetes/helm/client_command.rb
@@ -59,7 +59,7 @@ module Gitlab
end
def local_tiller_enabled?
- Feature.enabled?(:managed_apps_local_tiller)
+ ::Gitlab::Kubernetes::Helm.local_tiller_enabled?
end
end
end
diff --git a/lib/gitlab/serverless/domain.rb b/lib/gitlab/serverless/domain.rb
deleted file mode 100644
index ec7c68764d1..00000000000
--- a/lib/gitlab/serverless/domain.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# frozen_string_literal: true
-
-module Gitlab
- module Serverless
- class Domain
- UUID_LENGTH = 14
-
- def self.generate_uuid
- SecureRandom.hex(UUID_LENGTH / 2)
- end
- end
- end
-end
diff --git a/lib/gitlab/serverless/function_uri.rb b/lib/gitlab/serverless/function_uri.rb
deleted file mode 100644
index c0e0cf00f35..00000000000
--- a/lib/gitlab/serverless/function_uri.rb
+++ /dev/null
@@ -1,46 +0,0 @@
-# frozen_string_literal: true
-
-module Gitlab
- module Serverless
- class FunctionURI < URI::HTTPS
- SERVERLESS_DOMAIN_REGEXP = %r{^(?<scheme>https?://)?(?<function>[^.]+)-(?<cluster_left>\h{2})a1(?<cluster_middle>\h{10})f2(?<cluster_right>\h{2})(?<environment_id>\h+)-(?<environment_slug>[^.]+)\.(?<domain>.+)}.freeze
-
- attr_reader :function, :cluster, :environment
-
- def initialize(function: nil, cluster: nil, environment: nil)
- initialize_required_argument(:function, function)
- initialize_required_argument(:cluster, cluster)
- initialize_required_argument(:environment, environment)
-
- @host = "#{function}-#{cluster.uuid[0..1]}a1#{cluster.uuid[2..-3]}f2#{cluster.uuid[-2..-1]}#{"%x" % environment.id}-#{environment.slug}.#{cluster.domain}"
-
- super('https', nil, host, nil, nil, nil, nil, nil, nil)
- end
-
- def self.parse(uri)
- match = SERVERLESS_DOMAIN_REGEXP.match(uri)
- return unless match
-
- cluster = ::Serverless::DomainCluster.find(match[:cluster_left] + match[:cluster_middle] + match[:cluster_right])
- return unless cluster
-
- environment = ::Environment.find(match[:environment_id].to_i(16))
- return unless environment&.slug == match[:environment_slug]
-
- new(
- function: match[:function],
- cluster: cluster,
- environment: environment
- )
- end
-
- private
-
- def initialize_required_argument(name, value)
- raise ArgumentError.new("missing argument: #{name}") unless value
-
- instance_variable_set("@#{name}".to_sym, value)
- end
- end
- end
-end
diff --git a/lib/gitlab/serverless/service.rb b/lib/gitlab/serverless/service.rb
index 643e076c587..c3ab2e9ddeb 100644
--- a/lib/gitlab/serverless/service.rb
+++ b/lib/gitlab/serverless/service.rb
@@ -60,7 +60,11 @@ class Gitlab::Serverless::Service
def proxy_url
if cluster&.serverless_domain
- Gitlab::Serverless::FunctionURI.new(function: name, cluster: cluster.serverless_domain, environment: environment)
+ ::Serverless::Domain.new(
+ function_name: name,
+ serverless_domain_cluster: cluster.serverless_domain,
+ environment: environment
+ ).uri.to_s
end
end