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
4 changed files with 0 additions and 85 deletions
|
@ -100,12 +100,6 @@ module Clusters
|
||||||
|
|
||||||
scope :default_environment, -> { where(environment_scope: DEFAULT_ENVIRONMENT) }
|
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 :with_knative_installed, -> { joins(:application_knative).merge(Clusters::Applications::Knative.available) }
|
||||||
|
|
||||||
scope :preload_knative, -> {
|
scope :preload_knative, -> {
|
||||||
|
@ -161,16 +155,6 @@ module Clusters
|
||||||
return platform_kubernetes if kubernetes?
|
return platform_kubernetes if kubernetes?
|
||||||
end
|
end
|
||||||
|
|
||||||
def all_projects
|
|
||||||
if project_type?
|
|
||||||
projects
|
|
||||||
elsif group_type?
|
|
||||||
first_group.all_projects
|
|
||||||
else
|
|
||||||
Project.none
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def first_project
|
def first_project
|
||||||
strong_memoize(:first_project) do
|
strong_memoize(:first_project) do
|
||||||
projects.first
|
projects.first
|
||||||
|
|
|
@ -415,12 +415,6 @@ class Project < ApplicationRecord
|
||||||
.where(project_ci_cd_settings: { group_runners_enabled: true })
|
.where(project_ci_cd_settings: { group_runners_enabled: true })
|
||||||
end
|
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 }
|
enum auto_cancel_pending_pipelines: { disabled: 0, enabled: 1 }
|
||||||
|
|
||||||
chronic_duration_attr :build_timeout_human_readable, :build_timeout,
|
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
|
||||||
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
|
describe 'validations' do
|
||||||
subject { cluster.valid? }
|
subject { cluster.valid? }
|
||||||
|
|
||||||
|
@ -423,31 +403,6 @@ describe Clusters::Cluster, :use_clean_rails_memory_store_caching do
|
||||||
end
|
end
|
||||||
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
|
describe '#first_project' do
|
||||||
subject { cluster.first_project }
|
subject { cluster.first_project }
|
||||||
|
|
||||||
|
|
|
@ -173,24 +173,6 @@ describe Project do
|
||||||
it { is_expected.to include_module(Sortable) }
|
it { is_expected.to include_module(Sortable) }
|
||||||
end
|
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
|
describe 'validation' do
|
||||||
let!(:project) { create(:project) }
|
let!(:project) { create(:project) }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue