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:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-11 18:07:38 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-11 18:07:38 +0300
commit4eea104c69e59f6fa53c7bc15b986c69f29b60c8 (patch)
tree2eff1ce7ac4a58de15b1f5980acfdb22c7b92ac0 /lib/gitlab/ci
parentb86f474bf51e20d2db4cf0895d0a8e0894e31c08 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/ci')
-rw-r--r--lib/gitlab/ci/build/prerequisite/kubernetes_namespace.rb23
-rw-r--r--lib/gitlab/ci/templates/Managed-Cluster-Applications.gitlab-ci.yml3
2 files changed, 24 insertions, 2 deletions
diff --git a/lib/gitlab/ci/build/prerequisite/kubernetes_namespace.rb b/lib/gitlab/ci/build/prerequisite/kubernetes_namespace.rb
index 65445ab3fc4..465877871ea 100644
--- a/lib/gitlab/ci/build/prerequisite/kubernetes_namespace.rb
+++ b/lib/gitlab/ci/build/prerequisite/kubernetes_namespace.rb
@@ -63,12 +63,33 @@ module Gitlab
end
def create_namespace
+ namespace = kubernetes_namespace || build_namespace_record
+
+ return if conflicting_ci_namespace_requested?(namespace)
+
Clusters::Kubernetes::CreateOrUpdateNamespaceService.new(
cluster: deployment_cluster,
- kubernetes_namespace: kubernetes_namespace || build_namespace_record
+ kubernetes_namespace: namespace
).execute
end
+ ##
+ # A namespace can only be specified via gitlab-ci.yml
+ # for unmanaged clusters, as we currently have no way
+ # of preventing a job requesting a namespace it
+ # shouldn't have access to.
+ #
+ # To make this clear, we fail the build instead of
+ # silently using a namespace other than the one
+ # explicitly specified.
+ #
+ # Support for managed clusters will be added in
+ # https://gitlab.com/gitlab-org/gitlab/issues/38054
+ def conflicting_ci_namespace_requested?(namespace_record)
+ build.expanded_kubernetes_namespace.present? &&
+ namespace_record.namespace != build.expanded_kubernetes_namespace
+ end
+
def build_namespace_record
Clusters::BuildKubernetesNamespaceService.new(
deployment_cluster,
diff --git a/lib/gitlab/ci/templates/Managed-Cluster-Applications.gitlab-ci.yml b/lib/gitlab/ci/templates/Managed-Cluster-Applications.gitlab-ci.yml
index 878f2acb276..938b6f89b76 100644
--- a/lib/gitlab/ci/templates/Managed-Cluster-Applications.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Managed-Cluster-Applications.gitlab-ci.yml
@@ -1,12 +1,13 @@
apply:
stage: deploy
- image: "registry.gitlab.com/gitlab-org/cluster-integration/cluster-applications:v0.2.0"
+ image: "registry.gitlab.com/gitlab-org/cluster-integration/cluster-applications:v0.3.0"
environment:
name: production
variables:
TILLER_NAMESPACE: gitlab-managed-apps
GITLAB_MANAGED_APPS_FILE: $CI_PROJECT_DIR/.gitlab/managed-apps/config.yaml
INGRESS_VALUES_FILE: $CI_PROJECT_DIR/.gitlab/managed-apps/ingress/values.yaml
+ SENTRY_VALUES_FILE: $CI_PROJECT_DIR/.gitlab/managed-apps/sentry/values.yaml
script:
- gitlab-managed-apps /usr/local/share/gitlab-managed-apps/helmfile.yaml
only: