Commit 52efe84c authored by ap4y's avatar ap4y

Remove cluster_applications_artifact feature flag

This commit removes feature flag from the parse cluster applications
service which will enable status reporting for Cilium.
parent 018ffad5
...@@ -14,8 +14,6 @@ module Clusters ...@@ -14,8 +14,6 @@ module Clusters
end end
def execute(artifact) def execute(artifact)
return success unless Feature.enabled?(:cluster_applications_artifact, project)
raise ArgumentError, 'Artifact is not cluster_applications file type' unless artifact&.cluster_applications? raise ArgumentError, 'Artifact is not cluster_applications file type' unless artifact&.cluster_applications?
return error(too_big_error_message, :bad_request) unless artifact.file.size < MAX_ACCEPTABLE_ARTIFACT_SIZE return error(too_big_error_message, :bad_request) unless artifact.file.size < MAX_ACCEPTABLE_ARTIFACT_SIZE
......
---
title: Enable state tracking for managed applications installed via the management project
merge_request: 38759
author:
type: added
...@@ -970,6 +970,11 @@ management project. Refer to the ...@@ -970,6 +970,11 @@ management project. Refer to the
[Cilium chart](https://github.com/cilium/cilium/tree/master/install/kubernetes/cilium) [Cilium chart](https://github.com/cilium/cilium/tree/master/install/kubernetes/cilium)
for the available configuration options. for the available configuration options.
You can check Cilium's installation status on the cluster management page:
- [Project-level cluster](../project/clusters/index.md): Navigate to your project's **Operations > Kubernetes** page.
- [Group-level cluster](../group/clusters/index.md): Navigate to your group's **Kubernetes** page.
CAUTION: **Caution:** CAUTION: **Caution:**
Installation and removal of the Cilium requires a **manual** Installation and removal of the Cilium requires a **manual**
[restart](https://docs.cilium.io/en/stable/gettingstarted/k8s-install-gke/#restart-unmanaged-pods) [restart](https://docs.cilium.io/en/stable/gettingstarted/k8s-install-gke/#restart-unmanaged-pods)
......
...@@ -36,105 +36,89 @@ RSpec.describe Clusters::ParseClusterApplicationsArtifactService do ...@@ -36,105 +36,89 @@ RSpec.describe Clusters::ParseClusterApplicationsArtifactService do
let(:job) { deployment.deployable } let(:job) { deployment.deployable }
let(:artifact) { create(:ci_job_artifact, :cluster_applications, job: job) } let(:artifact) { create(:ci_job_artifact, :cluster_applications, job: job) }
context 'when cluster_applications_artifact feature flag is disabled' do it 'calls Gitlab::Kubernetes::Helm::Parsers::ListV2' do
before do expect(Gitlab::Kubernetes::Helm::Parsers::ListV2).to receive(:new).and_call_original
stub_feature_flags(cluster_applications_artifact: false)
end
it 'does not call Gitlab::Kubernetes::Helm::Parsers::ListV2 and returns success immediately' do
expect(Gitlab::Kubernetes::Helm::Parsers::ListV2).not_to receive(:new)
result = described_class.new(job, user).execute(artifact) result = described_class.new(job, user).execute(artifact)
expect(result[:status]).to eq(:success) expect(result[:status]).to eq(:success)
end
end end
context 'when cluster_applications_artifact feature flag is enabled for project' do context 'artifact is not of cluster_applications type' do
before do let(:artifact) { create(:ci_job_artifact, :archive) }
stub_feature_flags(cluster_applications_artifact: job.project) let(:job) { artifact.job }
it 'raise ArgumentError' do
expect do
described_class.new(job, user).execute(artifact)
end.to raise_error(ArgumentError, 'Artifact is not cluster_applications file type')
end end
end
it 'calls Gitlab::Kubernetes::Helm::Parsers::ListV2' do context 'artifact exceeds acceptable size' do
expect(Gitlab::Kubernetes::Helm::Parsers::ListV2).to receive(:new).and_call_original it 'returns an error' do
stub_const("#{described_class}::MAX_ACCEPTABLE_ARTIFACT_SIZE", 1.byte)
result = described_class.new(job, user).execute(artifact) result = described_class.new(job, user).execute(artifact)
expect(result[:status]).to eq(:success) expect(result[:status]).to eq(:error)
expect(result[:message]).to eq('Cluster_applications artifact too big. Maximum allowable size: 1 Byte')
end end
end
context 'artifact is not of cluster_applications type' do context 'job has no deployment' do
let(:artifact) { create(:ci_job_artifact, :archive) } let(:job) { build(:ci_build) }
let(:job) { artifact.job }
it 'raise ArgumentError' do it 'returns an error' do
expect do result = described_class.new(job, user).execute(artifact)
described_class.new(job, user).execute(artifact)
end.to raise_error(ArgumentError, 'Artifact is not cluster_applications file type') expect(result[:status]).to eq(:error)
end expect(result[:message]).to eq('No deployment found for this job')
end end
end
context 'artifact exceeds acceptable size' do context 'job has no deployment cluster' do
it 'returns an error' do let(:deployment) { create(:deployment) }
stub_const("#{described_class}::MAX_ACCEPTABLE_ARTIFACT_SIZE", 1.byte) let(:job) { deployment.deployable }
result = described_class.new(job, user).execute(artifact) it 'returns an error' do
result = described_class.new(job, user).execute(artifact)
expect(result[:status]).to eq(:error) expect(result[:status]).to eq(:error)
expect(result[:message]).to eq('Cluster_applications artifact too big. Maximum allowable size: 1 Byte') expect(result[:message]).to eq('No deployment cluster found for this job')
end
end end
end
context 'job has no deployment' do context 'blob is empty' do
let(:job) { build(:ci_build) } let(:file) { fixture_file_upload(Rails.root.join("spec/fixtures/helm/helm_list_v2_empty_blob.json.gz")) }
let(:artifact) { create(:ci_job_artifact, :cluster_applications, job: job, file: file) }
it 'returns an error' do it 'returns success' do
result = described_class.new(job, user).execute(artifact) result = described_class.new(job, user).execute(artifact)
expect(result[:status]).to eq(:error) expect(result[:status]).to eq(:success)
expect(result[:message]).to eq('No deployment found for this job')
end
end end
end
context 'job has no deployment cluster' do context 'job has deployment cluster' do
let(:deployment) { create(:deployment) } context 'current user does not have access to deployment cluster' do
let(:job) { deployment.deployable } let(:other_user) { create(:user) }
it 'returns an error' do it 'returns an error' do
result = described_class.new(job, user).execute(artifact) result = described_class.new(job, other_user).execute(artifact)
expect(result[:status]).to eq(:error) expect(result[:status]).to eq(:error)
expect(result[:message]).to eq('No deployment cluster found for this job') expect(result[:message]).to eq('No deployment cluster found for this job')
end end
end end
context 'blob is empty' do it 'does not affect unpermitted cluster applications' do
let(:file) { fixture_file_upload(Rails.root.join("spec/fixtures/helm/helm_list_v2_empty_blob.json.gz")) } expect(Clusters::ParseClusterApplicationsArtifactService::RELEASE_NAMES).to contain_exactly('cilium')
let(:artifact) { create(:ci_job_artifact, :cluster_applications, job: job, file: file) }
it 'returns success' do
result = described_class.new(job, user).execute(artifact)
expect(result[:status]).to eq(:success)
end
end end
context 'job has deployment cluster' do Clusters::ParseClusterApplicationsArtifactService::RELEASE_NAMES.each do |release_name|
context 'current user does not have access to deployment cluster' do context release_name do
let(:other_user) { create(:user) } include_examples 'parse cluster applications artifact', release_name
it 'returns an error' do
result = described_class.new(job, other_user).execute(artifact)
expect(result[:status]).to eq(:error)
expect(result[:message]).to eq('No deployment cluster found for this job')
end
end
Clusters::ParseClusterApplicationsArtifactService::RELEASE_NAMES.each do |release_name|
context release_name do
include_examples 'parse cluster applications artifact', release_name
end
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment