Commit e67ec278 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Merge branch 'feature/ignore-prometheus-metrics-not-present' into 'master'

Ignore non-existing metrics when uninstalling Prometheus

See merge request gitlab-org/gitlab!18020
parents 673ccf80 47c23151
......@@ -112,7 +112,12 @@ module Clusters
def delete_knative_istio_metrics
return [] unless cluster.application_knative_available?
[Gitlab::Kubernetes::KubectlCmd.delete("-f", Clusters::Applications::Knative::METRICS_CONFIG)]
[
Gitlab::Kubernetes::KubectlCmd.delete(
"-f", Clusters::Applications::Knative::METRICS_CONFIG,
"--ignore-not-found"
)
]
end
end
end
......
---
title: Avoid knative and prometheus uninstall race condition
merge_request: 18020
author:
type: changed
......@@ -175,6 +175,18 @@ describe Clusters::Applications::Prometheus do
expect(subject).to be_rbac
end
describe '#predelete' do
let(:knative) { create(:clusters_applications_knative, :updated ) }
let(:prometheus) { create(:clusters_applications_prometheus, cluster: knative.cluster) }
subject { prometheus.uninstall_command.predelete }
it 'deletes knative metrics' do
metrics_config = Clusters::Applications::Knative::METRICS_CONFIG
is_expected.to include("kubectl delete -f #{metrics_config} --ignore-not-found")
end
end
context 'on a non rbac enabled cluster' do
before do
prometheus.cluster.platform_kubernetes.abac!
......
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