Commit graph

20 commits

Author SHA1 Message Date
GitLab Bot
9e68395a98 Add latest changes from gitlab-org/gitlab@master 2020-08-21 12:10:22 +00:00
GitLab Bot
f6e985dba4 Add latest changes from gitlab-org/gitlab@master 2020-01-08 06:08:13 +00:00
GitLab Bot
4eea104c69 Add latest changes from gitlab-org/gitlab@master 2019-12-11 15:07:38 +00:00
GitLab Bot
ed73d4f207 Add latest changes from gitlab-org/gitlab@master 2019-12-06 03:08:02 +00:00
GitLab Bot
ab7cf450ba Add latest changes from gitlab-org/gitlab@master 2019-12-03 18:06:49 +00:00
GitLab Bot
6f9edd1a4c Add latest changes from gitlab-org/gitlab@master 2019-09-23 15:06:32 +00:00
Tiger
9e8daeb8a6 Move generic k8s services out of GCP namespace
These services aren't specific to GCP, and will be used for AWS
as part of https://gitlab.com/gitlab-org/gitlab-ce/issues/46686
2019-08-28 13:54:32 +10:00
Tiger Watson
36a01a88ce Use separate Kubernetes namespaces per environment
Kubernetes deployments on new clusters will now have
a separate namespace per project environment, instead
of sharing a single namespace for the project.

Behaviour of existing clusters is unchanged.

All new functionality is controlled by the
:kubernetes_namespace_per_environment feature flag,
which is safe to enable/disable at any time.
2019-08-07 04:40:29 +00:00
Thong Kuah
4615dca1d9 Drop fallback to deployment platform
All deployments should have already their cluster_id filled in on
creation. Legacy deployments will not be retried as:-

* Ci::Build#retry calls `Ci::RetryBuildService`
* Ci::Pipeline#retry
calls `Ci::RetryPipelineService` which also calls
`Ci::RetryBuildService`
* `Ci::RetryBuildService` will clone a build to retry

It is also impossibly to backfill Deployment#cluster_id from
Project#deployment_platform correctly as clusters could have been
deleted, added or altered in the intervening time.
2019-06-27 17:28:52 +12:00
Thong Kuah
2cdb72ea03 Use deployment's cluster for kubernetes prereq
A deployment will have a cluster associated on creation if there is one.

Otherwise fallback to deployment_platform for legacy deployments.
2019-06-27 17:28:52 +12:00
Stan Hu
db9783f782 Merge branch 'refactor_deployment_cluster' into 'master'
Refactor Deployment#cluster to #deployment_platform_cluster

See merge request gitlab-org/gitlab-ce!29961
2019-06-24 22:23:18 +00:00
Thong Kuah
ee18ca2fa5 Rename method to not clash with #cluster
We will introduce #cluster at a later stage.
Also deprecate this method
2019-06-24 16:59:22 +12:00
Tiger
74702f0e0e Enable project-level JIT resource creation
Previously this behaviour was only available to group
and instance-level clusters, as some project clusters
relied on Kubernetes credentials being passed through
to the runner instead of having their resources managed
by GitLab (which is not available when using JIT). These
clusters have been migrated to unmanaged, so resources
can be created on demand for the remaining managed clusters.
2019-06-18 12:43:52 +10:00
Dylan Griffith
ee28255b21 Refresh service_account_token for kubernetes_namespaces
There seems to be several examples where service_account_token is blank
even in GitLab.com newly created kubernetes_namespaces . We have not
figured out why they are blank but this should hopefully fix some issues
similar to https://gitlab.com/gitlab-org/gitlab-ce/issues/55362
2019-06-14 16:00:54 +10:00
Mayra Cabrera
89132bbdd6 Add gitlab-managed option to clusters form
When this option is enabled, GitLab will create namespaces and service
accounts as usual. When disabled, GitLab wont create any project
specific kubernetes resources

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/56557
2019-05-03 01:05:53 +00:00
Tiger
e33ecfdec3 Disable JIT resource creation for project clusters
JIT resource creation blocks deployments if a user is
self-managing their cluster, as it will fail the build
if unable to create a namespace and service account.

Using a custom namespace and service account was previously
supported for project level clusters, so we should preserve
this functionality.

https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/27352
2019-04-16 13:59:37 +10:00
Tiger
325d504c3c Don't recreate Kubernetes namespaces if they exist
Instead of attempting to create or update a Kubernetes
namespace on every deploy, only do so when we know it
doesn't exist yet.
2019-03-20 12:04:46 +11:00
Tiger
89b0bc04b9 Create one Kubernetes namespace for a deployment
Instead of creating a Kubernetes namespace on every
cluster related to a project, only create one on the
cluster the project is about to be deployed to.
2019-03-20 12:04:46 +11:00
Tiger
98a14a498d Add build prerequisite for Kubernetes namespaces
Builds that have deployments require Kubernetes resources
to be created before the build can be deployed. These
resources are no longer created when the cluster is
created, which allows us to only create the resources
required by each specific build.
2019-03-20 12:04:46 +11:00
Tiger
00f0d356b7 Create framework for build prerequisites
Introduces the concept of Prerequisites for a CI build.
If a build has unmet prerequisites it will go through the
:preparing state before being made available to a runner.

There are no actual prerequisites yet, so current
behaviour is unchanged.
2019-03-20 12:04:40 +11:00