summaryrefslogtreecommitdiff
path: root/app/models/clusters/applications
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/clusters/applications')
-rw-r--r--app/models/clusters/applications/cert_manager.rb2
-rw-r--r--app/models/clusters/applications/helm.rb9
-rw-r--r--app/models/clusters/applications/ingress.rb2
-rw-r--r--app/models/clusters/applications/jupyter.rb2
-rw-r--r--app/models/clusters/applications/knative.rb8
-rw-r--r--app/models/clusters/applications/prometheus.rb7
-rw-r--r--app/models/clusters/applications/runner.rb2
7 files changed, 24 insertions, 8 deletions
diff --git a/app/models/clusters/applications/cert_manager.rb b/app/models/clusters/applications/cert_manager.rb
index 27d4180e5b9..18cbf827a67 100644
--- a/app/models/clusters/applications/cert_manager.rb
+++ b/app/models/clusters/applications/cert_manager.rb
@@ -65,7 +65,7 @@ module Clusters
end
def retry_command(command)
- "for i in $(seq 1 30); do #{command} && break; sleep 1s; echo \"Retrying ($i)...\"; done"
+ "for i in $(seq 1 30); do #{command} && s=0 && break || s=$?; sleep 1s; echo \"Retrying ($i)...\"; done; (exit $s)"
end
def post_delete_script
diff --git a/app/models/clusters/applications/helm.rb b/app/models/clusters/applications/helm.rb
index 455cf200fbc..4a1bcac4bb7 100644
--- a/app/models/clusters/applications/helm.rb
+++ b/app/models/clusters/applications/helm.rb
@@ -27,7 +27,7 @@ module Clusters
def set_initial_status
return unless not_installable?
- self.status = 'installable' if cluster&.platform_kubernetes_active?
+ self.status = status_states[:installable] if cluster&.platform_kubernetes_active?
end
# It can only be uninstalled if there are no other applications installed
@@ -68,6 +68,13 @@ module Clusters
ca_key.present? && ca_cert.present?
end
+ def post_uninstall
+ cluster.kubeclient.delete_namespace(Gitlab::Kubernetes::Helm::NAMESPACE)
+ rescue Kubeclient::ResourceNotFoundError
+ # we actually don't care if the namespace is not present
+ # since we want to delete it anyway.
+ end
+
private
def files
diff --git a/app/models/clusters/applications/ingress.rb b/app/models/clusters/applications/ingress.rb
index 44c66f06059..885e4ff7197 100644
--- a/app/models/clusters/applications/ingress.rb
+++ b/app/models/clusters/applications/ingress.rb
@@ -3,7 +3,7 @@
module Clusters
module Applications
class Ingress < ApplicationRecord
- VERSION = '1.1.2'
+ VERSION = '1.22.1'
self.table_name = 'clusters_applications_ingress'
diff --git a/app/models/clusters/applications/jupyter.rb b/app/models/clusters/applications/jupyter.rb
index ec65482a846..ca93bc15be0 100644
--- a/app/models/clusters/applications/jupyter.rb
+++ b/app/models/clusters/applications/jupyter.rb
@@ -23,7 +23,7 @@ module Clusters
return unless cluster&.application_ingress_available?
ingress = cluster.application_ingress
- self.status = 'installable' if ingress.external_ip_or_hostname?
+ self.status = status_states[:installable] if ingress.external_ip_or_hostname?
end
def chart
diff --git a/app/models/clusters/applications/knative.rb b/app/models/clusters/applications/knative.rb
index a9b9374622d..1093efee85a 100644
--- a/app/models/clusters/applications/knative.rb
+++ b/app/models/clusters/applications/knative.rb
@@ -3,7 +3,7 @@
module Clusters
module Applications
class Knative < ApplicationRecord
- VERSION = '0.6.0'
+ VERSION = '0.7.0'
REPOSITORY = 'https://storage.googleapis.com/triggermesh-charts'
METRICS_CONFIG = 'https://storage.googleapis.com/triggermesh-charts/istio-metrics.yaml'
FETCH_IP_ADDRESS_DELAY = 30.seconds
@@ -21,7 +21,7 @@ module Clusters
return unless not_installable?
return unless verify_cluster?
- self.status = 'installable'
+ self.status = status_states[:installable]
end
state_machine :status do
@@ -47,6 +47,10 @@ module Clusters
{ "domain" => hostname }.to_yaml
end
+ def allowed_to_uninstall?
+ !pre_installed?
+ end
+
def install_command
Gitlab::Kubernetes::Helm::InstallCommand.new(
name: name,
diff --git a/app/models/clusters/applications/prometheus.rb b/app/models/clusters/applications/prometheus.rb
index 7a414d1a5bb..5e7fdd55cb6 100644
--- a/app/models/clusters/applications/prometheus.rb
+++ b/app/models/clusters/applications/prometheus.rb
@@ -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
diff --git a/app/models/clusters/applications/runner.rb b/app/models/clusters/applications/runner.rb
index 2d6af8f4f0b..954046c143b 100644
--- a/app/models/clusters/applications/runner.rb
+++ b/app/models/clusters/applications/runner.rb
@@ -3,7 +3,7 @@
module Clusters
module Applications
class Runner < ApplicationRecord
- VERSION = '0.8.0'
+ VERSION = '0.9.0'
self.table_name = 'clusters_applications_runners'