Merge branch '57115-remove-unused-cluster-workers' into 'master'
Remove unused cluster configuration logic See merge request gitlab-org/gitlab-ce!25725
This commit is contained in:
commit
af9b1ffa75
|
@ -100,12 +100,6 @@ module Clusters
|
|||
|
||||
scope :default_environment, -> { where(environment_scope: DEFAULT_ENVIRONMENT) }
|
||||
|
||||
scope :missing_kubernetes_namespace, -> (kubernetes_namespaces) do
|
||||
subquery = kubernetes_namespaces.select('1').where('clusters_kubernetes_namespaces.cluster_id = clusters.id')
|
||||
|
||||
where('NOT EXISTS (?)', subquery)
|
||||
end
|
||||
|
||||
scope :with_knative_installed, -> { joins(:application_knative).merge(Clusters::Applications::Knative.available) }
|
||||
|
||||
scope :preload_knative, -> {
|
||||
|
@ -161,16 +155,6 @@ module Clusters
|
|||
return platform_kubernetes if kubernetes?
|
||||
end
|
||||
|
||||
def all_projects
|
||||
if project_type?
|
||||
projects
|
||||
elsif group_type?
|
||||
first_group.all_projects
|
||||
else
|
||||
Project.none
|
||||
end
|
||||
end
|
||||
|
||||
def first_project
|
||||
strong_memoize(:first_project) do
|
||||
projects.first
|
||||
|
|
|
@ -415,12 +415,6 @@ class Project < ApplicationRecord
|
|||
.where(project_ci_cd_settings: { group_runners_enabled: true })
|
||||
end
|
||||
|
||||
scope :missing_kubernetes_namespace, -> (kubernetes_namespaces) do
|
||||
subquery = kubernetes_namespaces.select('1').where('clusters_kubernetes_namespaces.project_id = projects.id')
|
||||
|
||||
where('NOT EXISTS (?)', subquery)
|
||||
end
|
||||
|
||||
enum auto_cancel_pending_pipelines: { disabled: 0, enabled: 1 }
|
||||
|
||||
chronic_duration_attr :build_timeout_human_readable, :build_timeout,
|
||||
|
|
|
@ -121,26 +121,6 @@ describe Clusters::Cluster, :use_clean_rails_memory_store_caching do
|
|||
end
|
||||
end
|
||||
|
||||
describe '.missing_kubernetes_namespace' do
|
||||
let!(:cluster) { create(:cluster, :provided_by_gcp, :project) }
|
||||
let(:project) { cluster.project }
|
||||
let(:kubernetes_namespaces) { project.kubernetes_namespaces }
|
||||
|
||||
subject do
|
||||
described_class.joins(:projects).where(projects: { id: project.id }).missing_kubernetes_namespace(kubernetes_namespaces)
|
||||
end
|
||||
|
||||
it { is_expected.to contain_exactly(cluster) }
|
||||
|
||||
context 'kubernetes namespace exists' do
|
||||
before do
|
||||
create(:cluster_kubernetes_namespace, project: project, cluster: cluster)
|
||||
end
|
||||
|
||||
it { is_expected.to be_empty }
|
||||
end
|
||||
end
|
||||
|
||||
describe 'validations' do
|
||||
subject { cluster.valid? }
|
||||
|
||||
|
@ -423,31 +403,6 @@ describe Clusters::Cluster, :use_clean_rails_memory_store_caching do
|
|||
end
|
||||
end
|
||||
|
||||
describe '#all_projects' do
|
||||
let(:project) { create(:project) }
|
||||
let(:cluster) { create(:cluster, projects: [project]) }
|
||||
|
||||
subject { cluster.all_projects }
|
||||
|
||||
context 'project cluster' do
|
||||
it 'returns project' do
|
||||
is_expected.to eq([project])
|
||||
end
|
||||
end
|
||||
|
||||
context 'group cluster' do
|
||||
let(:cluster) { create(:cluster, :group) }
|
||||
let(:group) { cluster.group }
|
||||
let(:project) { create(:project, group: group) }
|
||||
let(:subgroup) { create(:group, parent: group) }
|
||||
let(:subproject) { create(:project, group: subgroup) }
|
||||
|
||||
it 'returns all projects for group' do
|
||||
is_expected.to contain_exactly(project, subproject)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#first_project' do
|
||||
subject { cluster.first_project }
|
||||
|
||||
|
|
|
@ -173,24 +173,6 @@ describe Project do
|
|||
it { is_expected.to include_module(Sortable) }
|
||||
end
|
||||
|
||||
describe '.missing_kubernetes_namespace' do
|
||||
let!(:project) { create(:project) }
|
||||
let!(:cluster) { create(:cluster, :provided_by_user, :group) }
|
||||
let(:kubernetes_namespaces) { project.kubernetes_namespaces }
|
||||
|
||||
subject { described_class.missing_kubernetes_namespace(kubernetes_namespaces) }
|
||||
|
||||
it { is_expected.to contain_exactly(project) }
|
||||
|
||||
context 'kubernetes namespace exists' do
|
||||
before do
|
||||
create(:cluster_kubernetes_namespace, project: project, cluster: cluster)
|
||||
end
|
||||
|
||||
it { is_expected.to be_empty }
|
||||
end
|
||||
end
|
||||
|
||||
describe 'validation' do
|
||||
let!(:project) { create(:project) }
|
||||
|
||||
|
|
Loading…
Reference in New Issue