Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2021-10-26 21:10:01 +00:00
parent 67049ac7aa
commit ef2f70470a
18 changed files with 164 additions and 73 deletions

View File

@ -36,6 +36,7 @@ module Projects
private
attr_accessor :shared
attr_reader :logger
def execute_after_export_action(after_export_strategy)
return unless after_export_strategy
@ -74,7 +75,11 @@ module Projects
end
def project_tree_saver
tree_saver_class.new(project: project, current_user: current_user, shared: shared, params: params)
tree_saver_class.new(project: project,
current_user: current_user,
shared: shared,
params: params,
logger: logger)
end
def tree_saver_class
@ -116,7 +121,7 @@ module Projects
end
def notify_success
@logger.info(
logger.info(
message: 'Project successfully exported',
project_name: project.name,
project_id: project.id
@ -124,7 +129,7 @@ module Projects
end
def notify_error
@logger.error(
logger.error(
message: 'Project export error',
export_errors: shared.errors.join(', '),
project_name: project.name,

View File

@ -74,7 +74,7 @@
label_class: 'label-bold' }
.form-text.text-muted
= s_('ClusterIntegration|Allow GitLab to manage namespaces and service accounts for this cluster.')
= link_to _('More information'), help_page_path('user/project/clusters/gitlab_managed_clusters.md', anchor: 'gitlab-managed-clusters'), target: '_blank'
= link_to _('More information'), help_page_path('user/project/clusters/gitlab_managed_clusters.md'), target: '_blank'
.form-group
= field.check_box :namespace_per_environment, { label: s_('ClusterIntegration|Namespace per environment'), label_class: 'label-bold' }

View File

@ -4,12 +4,13 @@ group: Configure
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
---
# Connect EKS clusters through cluster certificates **(FREE)**
# Connect EKS clusters through cluster certificates (DEPRECATED) **(FREE)**
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/22392) in GitLab 12.5.
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/22392) in GitLab 12.5.
> - [Deprecated](https://gitlab.com/groups/gitlab-org/configure/-/epics/8) in GitLab 14.5.
WARNING:
Use [Infrastrucure as Code](../../infrastructure/iac/index.md#create-a-new-cluster-through-iac)
This feature was deprecated in GitLab 14.5. Use [Infrastrucure as Code](../../infrastructure/iac/index.md#create-a-new-cluster-through-iac)
to create new clusters.
Through GitLab, you can create new clusters and add existing clusters hosted on Amazon Elastic
@ -20,18 +21,10 @@ Kubernetes Service (EKS).
If you already have an EKS cluster and want to connect it to GitLab,
use the [GitLab Kubernetes Agent](../../clusters/agent/index.md).
Alternatively, you can [connect them with cluster certificates](add_existing_cluster.md),
although this method is not recommended for [security implications](../../infrastructure/clusters/connect/index.md#security-implications-for-clusters-connected-with-certificates).
## Create a new EKS cluster
To create a new cluster from GitLab, use [Infrastructure as Code](../../infrastructure/iac/index.md#create-a-new-cluster-through-iac).
Alternatively, you can [create new EKS clusters using cluster certificates](#how-to-create-a-new-cluster-on-eks-through-cluster-certificates-deprecated).
Although still available on the GitLab UI, this method was deprecated
in GitLab 14.0 and is scheduled for removal in GitLab 15.0.
It also has [security implications](../../infrastructure/clusters/connect/index.md#security-implications-for-clusters-connected-with-certificates).
### How to create a new cluster on EKS through cluster certificates (DEPRECATED)
> [Deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/327908) in GitLab 14.0.

View File

@ -4,17 +4,18 @@ group: Configure
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
---
# Connect existing clusters through cluster certificates
# Connect existing clusters through cluster certificates **(DEPRECATED)**
> [Deprecated](https://gitlab.com/groups/gitlab-org/configure/-/epics/8) in GitLab 14.5.
WARNING:
This feature was [deprecated](https://gitlab.com/groups/gitlab-org/configure/-/epics/8) in GitLab 14.5.
To connect your cluster to GitLab, use the [GitLab Kubernetes Agent](../../clusters/agent/index.md)
instead.
If you have an existing Kubernetes cluster, you can add it to a project, group,
or instance and benefit from the integration with GitLab.
WARNING:
The process described on this page uses cluster certificates to connect your cluster
to GitLab. Although this method still works, it is **no longer recommended**.
To connect your cluster to GitLab, we **recommend** using the [GitLab Kubernetes Agent](../../clusters/agent/index.md)
instead. **(PREMIUM)**
## Prerequisites
See the prerequisites below to add existing clusters to GitLab.

View File

@ -4,9 +4,12 @@ group: Configure
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
---
# Connect GKE clusters through cluster certificates **(FREE)**
# Connect GKE clusters through cluster certificates (DEPRECATED) **(FREE)**
> [Deprecated](https://gitlab.com/groups/gitlab-org/configure/-/epics/8) in GitLab 14.5.
WARNING:
This feature was [deprecated](https://gitlab.com/groups/gitlab-org/configure/-/epics/8) in GitLab 14.5.
Use [Infrastrucure as Code](../../infrastructure/clusters/connect/new_gke_cluster.md)
to create a cluster hosted on Google Kubernetes Engine (GKE).
@ -18,21 +21,13 @@ hosted on Google Kubernetes Engine (GKE).
If you already have a GKE cluster and want to connect it to GitLab,
use the [GitLab Kubernetes Agent](../../clusters/agent/index.md).
Alternatively, you can [connect them with cluster certificates](add_existing_cluster.md),
altough this method is not recommended for [security implications](../../infrastructure/clusters/connect/index.md#security-implications-for-clusters-connected-with-certificates).
## Create a new GKE cluster from GitLab
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/25925) in GitLab 12.4, all the GKE clusters provisioned by GitLab are [VPC-native](https://cloud.google.com/kubernetes-engine/docs/how-to/alias-ips).
To create a new GKE cluster from GitLab, use [Infrastructure as Code](../../infrastructure/clusters/connect/new_gke_cluster.md).
Alternatively, you can [create new GKE clusters using cluster certificates](#create-a-new-cluster-on-gke-through-cluster-certificates-deprecated).
Although still available in the GitLab UI, this method was deprecated
in GitLab 14.0 and is scheduled for removal in GitLab 15.0.
It also has [security implications](../../infrastructure/clusters/connect/index.md#security-implications-for-clusters-connected-with-certificates).
## Create a new cluster on GKE through cluster certificates (DEPRECATED)
## Create a new cluster on GKE through cluster certificates
> [Deprecated](https://gitlab.com/groups/gitlab-org/-/epics/6049) in GitLab 14.0.

View File

@ -9,9 +9,8 @@ info: To determine the technical writer assigned to the Stage/Group associated w
> [Deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/327908) in GitLab 14.0.
WARNING:
Creating a new cluster through cluster certificates
is deprecated and no longer recommended. To create a new cluster use
[Infrastructure as Code](../../infrastructure/iac/index.md#create-a-new-cluster-through-iac).
This feature was [deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/327908) in GitLab 14.0.
To create a new cluster use [Infrastructure as Code](../../infrastructure/iac/index.md#create-a-new-cluster-through-iac).
NOTE:
Every new Google Cloud Platform (GCP) account receives

View File

@ -4,9 +4,15 @@ group: Configure
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
---
# Cluster access controls (RBAC or ABAC)
# Access controls with cluster certificates (RBAC or ABAC) (DEPRECATED) **(FREE)**
> Restricted service account for deployment was [introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/51716) in GitLab 11.5.
> - Restricted service account for deployment was [introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/51716) in GitLab 11.5.
> - [Deprecated](https://gitlab.com/groups/gitlab-org/configure/-/epics/8) in GitLab 14.5.
WARNING:
This feature was [deprecated](https://gitlab.com/groups/gitlab-org/configure/-/epics/8) in GitLab 14.5.
To connect your cluster to GitLab, use the [GitLab Kubernetes Agent](../../clusters/agent/index.md)
instead.
When creating a cluster in GitLab, you are asked if you would like to create either:

View File

@ -4,13 +4,14 @@ group: Configure
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
---
# Deploy to a Kubernetes cluster with cluster certificates
# Deploy to a Kubernetes cluster with cluster certificates (DEPRECATED) **(FREE)**
> [Deprecated](https://gitlab.com/groups/gitlab-org/configure/-/epics/8) in GitLab 14.5.
WARNING:
The process described on this page uses cluster certificates to deploy to your cluster
from GitLab. Although this method still works, it is **no longer recommended**.
To deploy to your cluster from GitLab, we **recommend** using the [GitLab Kubernetes Agent](../../clusters/agent/index.md)
instead. **(PREMIUM)**
This feature was [deprecated](https://gitlab.com/groups/gitlab-org/configure/-/epics/8) in GitLab 14.5.
To connect your cluster to GitLab, use the [GitLab Kubernetes Agent](../../clusters/agent/index.md).
To deploy with the Agent, use the [CI/CD Tunnel](../../clusters/agent/ci_cd_tunnel.md).
A Kubernetes cluster can be the destination for a deployment job. If

View File

@ -4,10 +4,16 @@ group: Configure
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
---
# GitLab-managed clusters
# GitLab-managed clusters (DEPRECATED) **(FREE)**
> - [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/22011) in GitLab 11.5.
> - Became [optional](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/26565) in GitLab 11.11.
> - [Deprecated](https://gitlab.com/groups/gitlab-org/configure/-/epics/8) in GitLab 14.5.
WARNING:
This feature was [deprecated](https://gitlab.com/groups/gitlab-org/configure/-/epics/8) in GitLab 14.5.
To connect your cluster to GitLab, use the [GitLab Kubernetes Agent](../../../user/clusters/agent/index.md).
To manage applications, use the [Cluster Project Management Template](../../../user/clusters/management_project_template.md).
You can choose to allow GitLab to manage your cluster for you. If your cluster
is managed by GitLab, resources for your projects are automatically created. See

View File

@ -4,9 +4,16 @@ group: Configure
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
---
# Project-level Kubernetes clusters **(FREE)**
# Project-level Kubernetes clusters with cluster certificates (DEPRECATED) **(FREE)**
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/35954) in GitLab 10.1.
> - [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/35954) in GitLab 10.1.
> - [Deprecated](https://gitlab.com/groups/gitlab-org/configure/-/epics/8) in GitLab 14.5.
WARNING:
Project-level Kubernetes clusters with cluster certificates was
[deprecated](https://gitlab.com/groups/gitlab-org/configure/-/epics/8)
in GitLab 14.5.
To connect your cluster to GitLab, use the [GitLab Kubernetes Agent](../../../user/clusters/agent/index.md).
[Project-level Kubernetes clusters](../../infrastructure/clusters/connect/index.md#cluster-levels)
allow you to connect a Kubernetes cluster to a project in GitLab.

View File

@ -4,10 +4,14 @@ group: Monitor
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
---
# Kubernetes Logs **(FREE)**
# Kubernetes Logs (DEPRECATED) **(FREE)**
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/4752) in [GitLab Ultimate](https://about.gitlab.com/pricing/) 11.0.
> - [Moved](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/26383) to [GitLab Free](https://about.gitlab.com/pricing/) 12.9.
> - [Deprecated](https://gitlab.com/groups/gitlab-org/configure/-/epics/8) in GitLab 14.5.
WARNING:
This feature was [deprecated](https://gitlab.com/groups/gitlab-org/configure/-/epics/8) in GitLab 14.5.
GitLab makes it easy to view the logs of running pods in
[connected Kubernetes clusters](index.md). By displaying the logs directly in GitLab

View File

@ -4,10 +4,16 @@ group: Configure
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
---
# Multiple Kubernetes clusters for a single project
# Multiple clusters per project with cluster certificates (DEPRECATED) **(FREE)**
> - Introduced in [GitLab Premium](https://about.gitlab.com/pricing/) 10.3
> - [Moved](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/35094) to GitLab Free in 13.2.
> - [Deprecated](https://gitlab.com/groups/gitlab-org/configure/-/epics/8) in GitLab 14.5.
WARNING:
Using multiple Kubernetes clusters for a single project **with cluster
certificates** was [deprecated](https://gitlab.com/groups/gitlab-org/configure/-/epics/8) in GitLab 14.5.
To connect clusters to GitLab, use the [GitLab Kubernetes Agent](../../../user/clusters/agent/index.md).
You can associate more than one Kubernetes cluster to your
project. That way you can have different clusters for different environments,

View File

@ -6,20 +6,16 @@ module Gitlab
class TreeSaver
attr_reader :full_path
def initialize(project:, current_user:, shared:, params: {})
def initialize(project:, current_user:, shared:, params: {}, logger: Gitlab::Import::Logger)
@params = params
@project = project
@current_user = current_user
@shared = shared
@logger = logger
end
def save
ImportExport::Json::StreamingSerializer.new(
exportable,
reader.project_tree,
json_writer,
exportable_path: "project"
).execute
stream_export
true
rescue StandardError => e
@ -31,6 +27,32 @@ module Gitlab
private
def stream_export
on_retry = proc do |exception, try, elapsed_time, next_interval|
@logger.info(
message: "Project export retry triggered from streaming",
'error.class': exception.class,
'error.message': exception.message,
try_count: try,
elapsed_time_s: elapsed_time,
wait_to_retry_s: next_interval,
project_name: @project.name,
project_id: @project.id
)
end
serializer = ImportExport::Json::StreamingSerializer.new(
exportable,
reader.project_tree,
json_writer,
exportable_path: "project"
)
Retriable.retriable(on: Net::OpenTimeout, on_retry: on_retry) do
serializer.execute
end
end
def reader
@reader ||= Gitlab::ImportExport::Reader.new(shared: @shared)
end

View File

@ -23802,9 +23802,6 @@ msgstr ""
msgid "OnCallSchedules|Your schedule has been successfully created. To add individual users to this schedule, use the Add a rotation button. To enable notifications for this schedule, you must also create an %{linkStart}escalation policy%{linkEnd}."
msgstr ""
msgid "OnDemandScans|%{learnMoreLinkStart}Lean more about on-demand scans%{learnMoreLinkEnd}."
msgstr ""
msgid "OnDemandScans|Could not fetch scanner profiles. Please refresh the page, or try again later."
msgstr ""
@ -23889,15 +23886,6 @@ msgstr ""
msgid "OnDemandScans|Start time"
msgstr ""
msgid "OnDemandScans|There are no finished scans."
msgstr ""
msgid "OnDemandScans|There are no running scans."
msgstr ""
msgid "OnDemandScans|There are no scheduled scans."
msgstr ""
msgid "OnDemandScans|Use existing scanner profile"
msgstr ""

View File

@ -5,6 +5,9 @@ require 'spec_helper'
RSpec.describe Gitlab::ImportExport::Project::TreeSaver do
let_it_be(:export_path) { "#{Dir.tmpdir}/project_tree_saver_spec" }
let_it_be(:exportable_path) { 'project' }
let_it_be(:user) { create(:user) }
let_it_be(:group) { create(:group) }
let_it_be(:project) { setup_project }
shared_examples 'saves project tree successfully' do |ndjson_enabled|
include ImportExport::CommonUtil
@ -12,9 +15,6 @@ RSpec.describe Gitlab::ImportExport::Project::TreeSaver do
subject { get_json(full_path, exportable_path, relation_name, ndjson_enabled) }
describe 'saves project tree attributes' do
let_it_be(:user) { create(:user) }
let_it_be(:group) { create(:group) }
let_it_be(:project) { setup_project }
let_it_be(:shared) { project.import_export_shared }
let(:relation_name) { :projects }
@ -402,6 +402,50 @@ RSpec.describe Gitlab::ImportExport::Project::TreeSaver do
it_behaves_like "saves project tree successfully", true
end
context 'when streaming has to retry', :aggregate_failures do
let(:shared) { double('shared', export_path: exportable_path) }
let(:logger) { Gitlab::Import::Logger.build }
let(:serializer) { double('serializer') }
let(:error_class) { Net::OpenTimeout }
let(:info_params) do
{
'error.class': error_class,
project_name: project.name,
project_id: project.id
}
end
before do
allow(Gitlab::ImportExport::Json::StreamingSerializer).to receive(:new).and_return(serializer)
end
subject(:project_tree_saver) do
described_class.new(project: project, current_user: user, shared: shared, logger: logger)
end
it 'retries and succeeds' do
call_count = 0
allow(serializer).to receive(:execute) do
call_count += 1
call_count > 1 ? true : raise(error_class, 'execution expired')
end
expect(logger).to receive(:info).with(hash_including(info_params)).once
expect(project_tree_saver.save).to be(true)
end
it 'retries and does not succeed' do
retry_count = 3
allow(serializer).to receive(:execute).and_raise(error_class, 'execution expired')
expect(logger).to receive(:info).with(hash_including(info_params)).exactly(retry_count).times
expect(shared).to receive(:error).with(instance_of(error_class))
expect(project_tree_saver.save).to be(false)
end
end
def setup_project
release = create(:release)

View File

@ -238,8 +238,7 @@ RSpec.describe Members::CreateService, :aggregate_failures, :clean_gitlab_redis_
expect(source.issues).to all have_attributes(
project: source,
author: user,
assignees: array_including(member)
author: user
)
end
end

View File

@ -4,7 +4,8 @@ require 'spec_helper'
RSpec.describe Projects::ImportExport::ExportService do
describe '#execute' do
let!(:user) { create(:user) }
let_it_be(:user) { create(:user) }
let(:project) { create(:project) }
let(:shared) { project.import_export_shared }
let!(:after_export_strategy) { Gitlab::ImportExport::AfterExportStrategies::DownloadNotificationStrategy.new }
@ -28,7 +29,14 @@ RSpec.describe Projects::ImportExport::ExportService do
end
it 'saves the models' do
expect(Gitlab::ImportExport::Project::TreeSaver).to receive(:new).and_call_original
saver_params = {
project: project,
current_user: user,
shared: shared,
params: {},
logger: an_instance_of(Gitlab::Export::Logger)
}
expect(Gitlab::ImportExport::Project::TreeSaver).to receive(:new).with(saver_params).and_call_original
service.execute
end

View File

@ -0,0 +1,7 @@
# frozen_string_literal: true
Retriable.configure do |config|
config.multiplier = 1.0
config.rand_factor = 0.0
config.base_interval = 0
end