summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-01-17 06:08:39 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-17 06:08:39 +0000
commitea20020f71c7226d57b6449b1d9b6c6f1298223e (patch)
tree8e33029cf61ae40635dde3fc5c1567dda8d14d18 /app
parentd9e821dbd908f40ff9828357452cd55a651283fa (diff)
downloadgitlab-ce-ea20020f71c7226d57b6449b1d9b6c6f1298223e.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/api.js9
-rw-r--r--app/services/clusters/kubernetes/create_or_update_namespace_service.rb5
-rw-r--r--app/services/clusters/kubernetes/create_or_update_service_account_service.rb11
3 files changed, 19 insertions, 6 deletions
diff --git a/app/assets/javascripts/api.js b/app/assets/javascripts/api.js
index 5e3932db235..bee079c6643 100644
--- a/app/assets/javascripts/api.js
+++ b/app/assets/javascripts/api.js
@@ -54,10 +54,15 @@ const Api = {
});
},
- groupMembers(id) {
+ groupMembers(id, options) {
const url = Api.buildUrl(this.groupMembersPath).replace(':id', encodeURIComponent(id));
- return axios.get(url);
+ return axios.get(url, {
+ params: {
+ per_page: DEFAULT_PER_PAGE,
+ ...options,
+ },
+ });
},
// Return groups list. Filtered by query
diff --git a/app/services/clusters/kubernetes/create_or_update_namespace_service.rb b/app/services/clusters/kubernetes/create_or_update_namespace_service.rb
index 15be8446cc0..c6c7eb99bf3 100644
--- a/app/services/clusters/kubernetes/create_or_update_namespace_service.rb
+++ b/app/services/clusters/kubernetes/create_or_update_namespace_service.rb
@@ -21,10 +21,15 @@ module Clusters
attr_reader :cluster, :kubernetes_namespace, :platform
def create_project_service_account
+ environment_slug = kubernetes_namespace.environment&.slug
+ namespace_labels = { 'app.gitlab.com/app' => kubernetes_namespace.project.full_path_slug }
+ namespace_labels['app.gitlab.com/env'] = environment_slug if environment_slug
+
Clusters::Kubernetes::CreateOrUpdateServiceAccountService.namespace_creator(
platform.kubeclient,
service_account_name: kubernetes_namespace.service_account_name,
service_account_namespace: kubernetes_namespace.namespace,
+ service_account_namespace_labels: namespace_labels,
rbac: platform.rbac?
).execute
end
diff --git a/app/services/clusters/kubernetes/create_or_update_service_account_service.rb b/app/services/clusters/kubernetes/create_or_update_service_account_service.rb
index d798dcdcfd3..b1820474c9d 100644
--- a/app/services/clusters/kubernetes/create_or_update_service_account_service.rb
+++ b/app/services/clusters/kubernetes/create_or_update_service_account_service.rb
@@ -3,10 +3,11 @@
module Clusters
module Kubernetes
class CreateOrUpdateServiceAccountService
- def initialize(kubeclient, service_account_name:, service_account_namespace:, token_name:, rbac:, namespace_creator: false, role_binding_name: nil)
+ def initialize(kubeclient, service_account_name:, service_account_namespace:, service_account_namespace_labels: nil, token_name:, rbac:, namespace_creator: false, role_binding_name: nil)
@kubeclient = kubeclient
@service_account_name = service_account_name
@service_account_namespace = service_account_namespace
+ @service_account_namespace_labels = service_account_namespace_labels
@token_name = token_name
@rbac = rbac
@namespace_creator = namespace_creator
@@ -23,11 +24,12 @@ module Clusters
)
end
- def self.namespace_creator(kubeclient, service_account_name:, service_account_namespace:, rbac:)
+ def self.namespace_creator(kubeclient, service_account_name:, service_account_namespace:, service_account_namespace_labels:, rbac:)
self.new(
kubeclient,
service_account_name: service_account_name,
service_account_namespace: service_account_namespace,
+ service_account_namespace_labels: service_account_namespace_labels,
token_name: "#{service_account_namespace}-token",
rbac: rbac,
namespace_creator: true,
@@ -55,12 +57,13 @@ module Clusters
private
- attr_reader :kubeclient, :service_account_name, :service_account_namespace, :token_name, :rbac, :namespace_creator, :role_binding_name
+ attr_reader :kubeclient, :service_account_name, :service_account_namespace, :service_account_namespace_labels, :token_name, :rbac, :namespace_creator, :role_binding_name
def ensure_project_namespace_exists
Gitlab::Kubernetes::Namespace.new(
service_account_namespace,
- kubeclient
+ kubeclient,
+ labels: service_account_namespace_labels
).ensure_exists!
end