summaryrefslogtreecommitdiff
path: root/app/models/clusters/applications
diff options
context:
space:
mode:
authorChris Baumbauer <cab@cabnetworks.net>2018-12-20 19:38:50 -0800
committerChris Baumbauer <cab@cabnetworks.net>2019-01-03 13:10:40 -0800
commitda873584afaaa87ee993df8114f4097bde25be8b (patch)
tree7b46e5c55b065c789c1354db6fc12344c91d173c /app/models/clusters/applications
parent0e20c8eb8b71eaa71fbfd5dedf6ccd6492531e14 (diff)
downloadgitlab-ce-da873584afaaa87ee993df8114f4097bde25be8b.tar.gz
Add Knative metrics to Prometheus
Diffstat (limited to 'app/models/clusters/applications')
-rw-r--r--app/models/clusters/applications/knative.rb9
-rw-r--r--app/models/clusters/applications/prometheus.rb7
2 files changed, 13 insertions, 3 deletions
diff --git a/app/models/clusters/applications/knative.rb b/app/models/clusters/applications/knative.rb
index 5ac152278da..0a3168afe68 100644
--- a/app/models/clusters/applications/knative.rb
+++ b/app/models/clusters/applications/knative.rb
@@ -5,7 +5,7 @@ module Clusters
class Knative < ActiveRecord::Base
VERSION = '0.2.2'.freeze
REPOSITORY = 'https://storage.googleapis.com/triggermesh-charts'.freeze
-
+ METRICS_CONFIG = 'https://storage.googleapis.com/triggermesh-charts/istio-metrics.yaml'.freeze
FETCH_IP_ADDRESS_DELAY = 30.seconds
self.table_name = 'clusters_applications_knative'
@@ -49,7 +49,8 @@ module Clusters
rbac: cluster.platform_kubernetes_rbac?,
chart: chart,
files: files,
- repository: REPOSITORY
+ repository: REPOSITORY,
+ postinstall: install_knative_metrics
)
end
@@ -94,6 +95,10 @@ module Clusters
rescue Kubeclient::ResourceNotFoundError
[]
end
+
+ def install_knative_metrics
+ ["kubectl apply -f #{METRICS_CONFIG}"] if cluster.application_prometheus_available?
+ end
end
end
end
diff --git a/app/models/clusters/applications/prometheus.rb b/app/models/clusters/applications/prometheus.rb
index 46d0388a464..e25be522d68 100644
--- a/app/models/clusters/applications/prometheus.rb
+++ b/app/models/clusters/applications/prometheus.rb
@@ -50,7 +50,8 @@ module Clusters
version: VERSION,
rbac: cluster.platform_kubernetes_rbac?,
chart: chart,
- files: files
+ files: files,
+ postinstall: install_knative_metrics
)
end
@@ -74,6 +75,10 @@ module Clusters
def kube_client
cluster&.kubeclient&.core_client
end
+
+ def install_knative_metrics
+ ["kubectl apply -f #{Clusters::Applications::Knative::METRICS_CONFIG}"] if cluster.application_knative_available?
+ end
end
end
end