Commit afed7fd1 authored by João Cunha's avatar João Cunha

Ignore non-existing metrics when uninstalling

parent 38c88bbe
...@@ -112,7 +112,12 @@ module Clusters ...@@ -112,7 +112,12 @@ module Clusters
def delete_knative_istio_metrics def delete_knative_istio_metrics
return [] unless cluster.application_knative_available? 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 end
end end
......
...@@ -175,6 +175,18 @@ describe Clusters::Applications::Prometheus do ...@@ -175,6 +175,18 @@ describe Clusters::Applications::Prometheus do
expect(subject).to be_rbac expect(subject).to be_rbac
end 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 context 'on a non rbac enabled cluster' do
before do before do
prometheus.cluster.platform_kubernetes.abac! 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