Commit Graph

182 Commits

Author SHA1 Message Date
GitLab Bot e33f87ac0f Add latest changes from gitlab-org/gitlab@master 2020-04-21 15:21:10 +00:00
GitLab Bot be2f4c5788 Add latest changes from gitlab-org/gitlab@master 2020-03-24 03:09:28 +00:00
GitLab Bot 7ebcead8cf Add latest changes from gitlab-org/gitlab@master 2020-03-09 18:07:59 +00:00
GitLab Bot ae78b85a25 Add latest changes from gitlab-org/gitlab@master 2020-02-24 12:09:00 +00:00
GitLab Bot b9bac6dbf7 Add latest changes from gitlab-org/gitlab@master 2020-02-20 15:08:44 +00:00
GitLab Bot 82a708b9f0 Add latest changes from gitlab-org/gitlab@master 2020-02-19 06:09:21 +00:00
GitLab Bot 1804227b4f Add latest changes from gitlab-org/gitlab@master 2020-02-09 12:08:54 +00:00
GitLab Bot 26384c9a61 Add latest changes from gitlab-org/gitlab@master 2020-02-05 09:08:43 +00:00
GitLab Bot 5ad0cf2655 Add latest changes from gitlab-org/gitlab@master 2020-01-23 12:08:38 +00:00
GitLab Bot ea20020f71 Add latest changes from gitlab-org/gitlab@master 2020-01-17 06:08:39 +00:00
GitLab Bot f6e985dba4 Add latest changes from gitlab-org/gitlab@master 2020-01-08 06:08:13 +00:00
GitLab Bot 3888bc4261 Add latest changes from gitlab-org/gitlab@master 2019-12-24 00:07:31 +00:00
GitLab Bot 69d6d3ca20 Add latest changes from gitlab-org/gitlab@master 2019-12-16 21:08:00 +00:00
GitLab Bot 47b8f79a08 Add latest changes from gitlab-org/gitlab@master 2019-12-13 00:08:05 +00:00
GitLab Bot ab7cf450ba Add latest changes from gitlab-org/gitlab@master 2019-12-03 18:06:49 +00:00
GitLab Bot 0a6ffb540e Add latest changes from gitlab-org/gitlab@master 2019-11-21 12:06:40 +00:00
GitLab Bot 29c01c6c91 Add latest changes from gitlab-org/gitlab@master 2019-11-14 03:06:25 +00:00
GitLab Bot 56d96ad7fa Add latest changes from gitlab-org/gitlab@master 2019-11-01 03:06:26 +00:00
GitLab Bot 8078bd185f Add latest changes from gitlab-org/gitlab@master 2019-11-01 00:06:02 +00:00
GitLab Bot 6653aab95d Add latest changes from gitlab-org/gitlab@master 2019-10-22 15:06:06 +00:00
GitLab Bot 94be244a9f Add latest changes from gitlab-org/gitlab@master 2019-10-15 03:06:19 +00:00
GitLab Bot b4e072cbaf Add latest changes from gitlab-org/gitlab@master 2019-10-11 06:06:27 +00:00
GitLab Bot 012e59c2af Add latest changes from gitlab-org/gitlab@master 2019-10-06 12:05:58 +00:00
GitLab Bot 83ad9ec8cc Add latest changes from gitlab-org/gitlab@master 2019-09-24 00:06:02 +00:00
GitLab Bot 80f61b4035 Add latest changes from gitlab-org/gitlab@master 2019-09-18 14:02:45 +00:00
dineshpanda e908e11776 Avoid calling freeze on already frozen strings in lib/gitlab 2019-09-04 09:52:02 +05:30
João Cunha f8821f828e Make use of Gitlab::Kubernetes
- refactor Knative and Prometheus
2019-08-14 20:02:37 +00:00
Thong Kuah b577825e54 Bump Helm to 2.14.3 and kubectl to 1.11.10 2019-08-13 00:07:27 +12: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
Rémy Coutable f74387d298 Merge branch 'georgekoltsov/55474-outbound-setting-system-hooks' into 'master'
Add outbound setting for system hooks

See merge request gitlab-org/gitlab-ce!31177
2019-08-05 08:55:16 +00:00
Dylan Griffith 5027979b9b Implement Helm ResetCommand for removing Tiller
Also creates specs

Only allow Helm to be uninstalled if it's the only app

- Remove Tiller leftovers after reser command
- Fixes specs and offenses

Adds changelog file

Fix reset_command specs
2019-08-02 19:02:57 +00:00
George Koltsov e5e1c907c0 Add outbound requests setting for system hooks
This MR adds new application setting to network section
`allow_local_requests_from_system_hooks`. Prior to this change
system hooks were allowed to do local network requests by default
and we are adding an ability for admins to control it.
2019-08-02 15:39:18 +01:00
João Cunha d7c7ebf50a Allow knative do be uninstalled:
- After uninstalling the knative helm chart it's necessary to also
remove some leftover resources to allow the cluster to be clean
and knative to be reinstalleable.
- Adds knative uninstall disclaimer
- Uninstall ksvc before uninstalling knative

Make list of Knative and Ingres resources explicit

- To avoid deleting unwanted resources we are listing exact
which resources will be deleted rather than simply deleting any
resource that contains istio or knative words.
2019-07-31 11:58:38 +00:00
Dylan Griffith c9b0ac5fc4 GitLab Managed App ensure helm version uses tls opts
The TLS opts were missing from helm version command which meant that it
was just perpetually failing and hence wasting 30s of time waiting for a
command to be successful that was never going to be successful. This
never actually caused any errors because this loop will happily just
fail 30 times without breaking the overall script but it was just a
waste of installation time so now installing apps should be ~30s faster.
2019-07-15 11:38:40 +10:00
Hordur Freyr Yngvason 6971fd261d Give Knative serving permissions to service account
GitLab uses a kubernetes service account to perform deployments. For
serverless deployments to work as expected with externally created
clusters with their own knative installations (e.g. via Cloud Run), this
account requires additional permissions in the serving.knative.dev API
group.
2019-07-11 11:26:15 +00:00
Thong Kuah c7d50ddf55 Fix connection to Tiller error while uninstalling
Both the `install-<app>` and `uninstall-<app>` pods loads the
`values-content-configuration-<app>` configmap into the pod
(see `#volume_specification`). This configmap contains the cert
necessary to connect to Tiller. The cert though is only valid for 30
minutes.

So this fixes the bug where the configmap when uninstalling should be
updated as well.
2019-06-05 00:07:47 +12:00
Jacques Erasmus 3c913df28e Add changelog entry
Added a changelog entry for the feature
2019-05-27 08:23:17 +00:00
Thong Kuah 33a765c17a Teach Helm::Api about #uninstall 2019-04-29 22:55:11 -07:00
Thong Kuah f8326af565 Implement commands to uninstall cluster applications
This is the backend part which just allows uninstalling Prometheus for
now.
2019-04-16 09:10:11 +10:00
Dylan Griffith c239bfcb17 Add more info logging to cluster apps
Log events so that it's easy to see
when different requests are starting.
2019-04-10 06:38:27 +00:00
Mayra Cabrera 135b78bb25 Revert "Merge branch 'bump_kubernetes_1_11_9' into 'master'"
This reverts merge request !26991
2019-04-05 20:22:50 +00:00
Thong Kuah 38b40f9164 Bump Helm to 2.13.1 and kubectl to 1.11.9 2019-04-05 00:08:11 +13:00
Grzegorz Bizon 5cea1e8b80 Merge branch '56937-edit-knative-domain' into 'master'
Edit Knative domain after it has been deployed

Closes #56937

See merge request gitlab-org/gitlab-ce!25386
2019-03-07 12:43:34 +00:00
João Cunha f8234d9a08 Creates Clusterss::ApplciationsController update endpoint
- Creates new route
- Creates new controller action
- Creates call stack:
  Clusterss::ApplciationsController calls -->
  Clusters::Applications::UpdateService calls -->
  Clusters::Applications::ScheduleUpdateService calls -->
  ClusterUpdateAppWorker calls -->
  Clusters::Applications::PatchService -->
  ClusterWaitForAppInstallationWorker

DRY req params

Adds gcp_cluster:cluster_update_app queue

Schedule_update_service is uneeded

Extract common logic to a parent class (UpdateService will need it)

Introduce new UpdateService

Fix rescue class namespace

Fix RuboCop offenses

Adds BaseService for create and update services

Remove request_handler code duplication

Fixes update command

Move update_command to ApplicationCore so all apps can use it

Adds tests for Knative update_command

Adds specs for PatchService

Raise error if update receives an unistalled app

Adds update_service spec

Fix RuboCop offense

Use subject in favor of go

Adds update endpoint specs for project namespace

Adds update endpoint specs for group namespace
2019-03-05 08:32:51 +02:00
Yorick Peterse 03340f0987 Merge branch 'security-kubernetes-local-ssrf' into 'master'
Block local URLs for Kubernetes integration

See merge request gitlab/gitlabhq!2901
2019-03-04 18:36:50 +00:00
Thong Kuah af16fd687e Do not allow local urls in Kubernetes form
Use existing `public_url` validation to block various local urls. Note
that this validation will allow local urls if the "Allow requests to the
local network from hooks and services" admin setting is enabled.

Block KubeClient from using local addresses

It will also respect `allow_local_requests_from_hooks_and_services` so
if that is enabled KubeClinet will allow local addresses
2019-02-21 23:16:11 +13:00
Thong Kuah 8004508943 Bump helm and kubectl versions
Bump the helm and kubectl used in our Kubernetes integration, used e.g.
to install apps.

Note I have only bumped to the latest patch of the v1.11 series for
kubectl as GKE clusters are still on 1.10/1.11
2019-02-20 09:54:07 +13:00
Thong Kuah f67fc23727 Upgrade cluster applications, starting with runner 2019-02-07 21:40:55 +00:00
Thong Kuah f234aef994 Use http_max_redirects opt to replace monkeypatch
http_max_redirects was introduced in 4.2.2, so upgrade kubeclient.

The monkey-patch was global so we will have to check that all instances
of Kubeclient::Client are handled.

Spec all methods of KubeClient

This should provide better confidence that we are indeed disallowing
redirection in all cases
2019-01-25 16:48:37 +13:00
Takuya Noguchi db237d8431 Update Helm to 2.12.2 to address Helm client vulnerability
Signed-off-by: Takuya Noguchi <takninnovationresearch@gmail.com>
2019-01-18 09:21:47 +09:00
Thong Kuah dc18272091 Modify service so that it can be re-run
If the service fails mid-point, then we should be able to re-run this
service. So, detect presence of any previously created Kubernetes
resource and update or create accordingly.

Fix specs accordingly. In the case of finalize_creation_service_spec.rb,
I decided to stub out the async worker rather than maintaining
individual stubs for various kubeclient calls for that worker.

Also add test cases for group clusters
2018-12-04 15:46:46 +13:00
Stan Hu 681d7139a9 Merge branch 'json-logging-for-k8s' into 'master'
Json logging for k8s Integration

See merge request gitlab-org/gitlab-ce!23328
2018-11-27 16:51:34 +00:00
Dylan Griffith 7e7fb6deba Use JSON logging for helm install services 2018-11-27 15:23:02 +01:00
Dylan Griffith 6a66e4a1f1 Don't remove failed install pods
We want to keep failed install pods around so that it is easier to debug
why a failure occured. With this change we also need to ensure that we
remove a previous pod with the same name before installing so that
re-install does not fail.

Another change here is that we no longer need to catch errors from
delete_pod! in CheckInstallationProgressService as we now catch the
ResourceNotFoundError in Helm::Api. The catch statement in
CheckInstallationProgressService was also probably too broad before and
should have been narrowed down simply to ResourceNotFoundError.
2018-11-27 12:54:32 +01:00
Amit Rathi c3bad68d1c Merge branch 'master' into certmanager-temp 2018-11-20 17:58:10 +05:30
Amit Rathi 2bb7573380 Updated schema.rb and remove extra char from install_command 2018-11-20 00:02:07 +05:30
Amit Rathi 1c7372ad56 Merge branch 'master' into certmanager-temp 2018-11-19 23:12:52 +05:30
Amit Rathi feee33e0dc Remove application flags 2018-11-19 22:47:59 +05:30
gfyoung 7ec8af5017 Enable even more frozen string for lib/gitlab
Enables frozen string for the following:

* lib/gitlab/hook_data/**/*.rb
* lib/gitlab/i18n/**/*.rb
* lib/gitlab/import/**/*.rb
* lib/gitlab/import_export/**/*.rb
* lib/gitlab/kubernetes/**/*.rb
* lib/gitlab/legacy_github_import/**/*.rb
* lib/gitlab/manifest_import/**/*.rb
* lib/gitlab/metrics/**/*.rb
* lib/gitlab/middleware/**/*.rb

Partially addresses gitlab-org/gitlab-ce#47424.
2018-11-16 17:41:14 -08:00
Kamil Trzciński 5b75fcf6f2 Merge branch '49726-upgrade-helm-to-2-11' into 'master'
Resolve "Upgrade Helm Tiller Version Used By GitLab Managed Apps"

Closes #49726

See merge request gitlab-org/gitlab-ce!22693
2018-11-16 12:09:26 +00:00
Dylan Griffith 1244533b77 Remove unnecessary --tiller-namespace 2018-11-16 10:57:48 +00:00
Dylan Griffith 9b1a99b03d Use helm version loop instead of sleep in ClientCommand 2018-11-16 10:57:27 +00:00
Dylan Griffith a71b3f6a7c Extract Helm::ClientCommand for shared commands 2018-11-16 10:57:20 +00:00
Dylan Griffith fe1469e12f Upgrade helm to 2.11.0 and upgrade on every install 2018-11-16 10:22:40 +00:00
Kamil Trzciński 5059c15d06 Merge branch '53626-update-config-map-on-install-retry' into 'master'
Update config map if already present on install

Closes #53626

See merge request gitlab-org/gitlab-ce!22969
2018-11-15 12:33:40 +00:00
Amit Rathi 161e66890c Set appropriate RBAC flag for cluster applications 2018-11-15 17:52:41 +05:30
Chris Baumbauer 327892b23e Add knative client to kubeclient library 2018-11-15 11:39:43 +00:00
Thong Kuah 429d3e4952 Update config map if already present on install
When an application install fails, and the user retries install, the
configmap for the application will already exists. If so, we simply
update instead of create.
2018-11-15 22:39:42 +13:00
Amit Rathi 5c275490ec Merge branch 'master' into certmanager-temp 2018-11-14 10:14:50 +05:30
Amit Rathi 631ab89885 Use email on the account 2018-11-13 20:36:06 +05:30
Thong Kuah 14b3033a0d Show HTTP response code for Kubernetes errors 2018-11-13 12:46:01 +00:00
Amit Rathi 0e4ad53c92 Remove logging from pod.rb 2018-11-13 17:42:34 +05:30
Amit Rathi 7be10a7c21 Remove logging changes 2018-11-13 17:40:38 +05:30
Amit Rathi 6dda43d67e Cleanup 2018-11-13 17:38:04 +05:30
Amit Rathi 206f6747ec Updated logging 2018-11-13 16:57:49 +05:30
Amit Rathi c2407dab3e Merge branch 'master' into certmanager-temp 2018-11-12 12:06:59 +05:30
Dylan Griffith da7836956e Improve Debugging Capabilities For Helm Application Installs 2018-11-09 15:03:24 +00:00
Chris Baumbauer 26673cc827 Fix double-negation 2018-11-06 12:06:37 -08:00
Chris Baumbauer 008126a878 Refactor preinstall/postinstall methods in the helm installer 2018-11-06 12:00:16 -08:00
Chris Baumbauer 97441486ce Fix issue with missing knative cluster role binding, and cleanup tests 2018-11-05 23:55:18 -08:00
Chris Baumbauer c10452d285 Resolve issues raised by Kamil 2018-11-03 10:48:48 -07:00
Chris Baumbauer aa44393e8f Merge branch 'master' into triggermesh-phase1-knative 2018-11-03 10:13:35 -07:00
Amit Rathi 8837519445 Pushing WIP state for backup 2018-11-03 09:08:21 +05:30
Dylan Griffith d86f76320c Use our own docker image for helm install pods
This will reduce dependencies and failure points during installation. It
will also reduce security risks from untrusted dependencies being able
to effect all our users
2018-11-02 17:46:33 +00:00
Thong Kuah 5ede567d71 Incorporates Kubernetes Namespace into Cluster's flow 2018-11-02 15:46:15 +00:00
Chris Baumbauer dc078c2417 Merge branch 'master' into triggermesh-phase1-knative 2018-11-02 08:39:25 -07:00
Chris Baumbauer 0ddff09385 Revert Helm version bump 2018-10-29 10:56:46 -07:00
Kamil Trzciński 9e6098a6db Merge branch 'refactor_gitlab_kube_client' into 'master'
Refactor Gitlab::KubeClient

Closes #52131

See merge request gitlab-org/gitlab-ce!22073
2018-10-25 12:02:11 +00:00
Chris Baumbauer b5155b90ee Knative support 2018-10-24 22:38:44 -07:00
Chris Baumbauer 661fd213de Update helm version 1.7.2 -> 2.11.0 2018-10-24 15:13:33 -07:00
Thong Kuah a5419138fd Store version within SUPPORTED_API_GROUPS hash
This removes the ability to pass in a different version. We can instead
create a new entry in the SUPPORTED_API_GROUPS hash for a different
version if need be.
2018-10-23 23:52:34 +13:00
Thong Kuah 170071e365 DRY up *_clients methods
Build using `define_method` directly from the constant, saves us writing
api_groups strings twice.
2018-10-23 23:38:44 +13:00
Thong Kuah 27979aac0a Split hashed_clients into one per api_group
Essentially make #build_kubeclient do less.

Should be much clearer now
2018-10-23 23:36:44 +13:00
Thong Kuah 983c4a50d0 Remove api_groups from KubeClient constructor
We should have access to #core_client, #rbac_client,
and #extensions_client without having to pass in an awkward array.

Also change api_version to default_api_version, which allows us to use a
different version for an individual client. Special case for
apis/extensions which only go up to v1beta1

Makes #hashed_client private

Removes the #clients and #discover! methods which are un-used
2018-10-23 23:36:43 +13:00
Mayra Cabrera 1e4d615000 Add RoleBinding methods
Includes RoleBinding methods to Kubeclient and introduce a new lib class
to generate RoleBinding resources.

This MR is part of
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/22011
2018-10-22 17:16:14 -05:00
Thong Kuah f6ff32d9bd Port Helm::Api EE extensions to CE
We will need these utility level code in the future to help upgrade all
helm applications.
2018-10-01 11:16:07 +13:00
Thong Kuah e6fd3f1986 Port UpgradeCommand to CE
This is a utility class that we will need in the future to update and
upgrade our managed helm applications, which we do plan to do in CE.
2018-09-27 18:15:04 +12:00
Thong Kuah a02e35308b Always create `gitlab` service account and service account token regardless of ABAC/RBAC
This also solves the async nature of the automatic creation of default
service tokens for service accounts. It also makes explicit which
service account token we always use.

create cluster role binding only if the provider has legacy_abac
disabled.
2018-09-14 16:26:51 +12:00
Thong Kuah 8c8ccd3167 Teach GitLab how to create Secret of type ServiceAccountToken
Add create_secret to KubeClient
2018-09-14 16:26:51 +12:00
Thong Kuah 6f2ad2b604 Enable Kubernetes RBAC for GitLab Managed Apps for existing clusters 2018-09-06 10:03:38 +00:00