diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2019-01-03 21:47:46 +0000 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2019-01-03 21:47:46 +0000 |
commit | 5a9808651b728628257545554743cdb2abba4cc3 (patch) | |
tree | 7b46e5c55b065c789c1354db6fc12344c91d173c /app/models/clusters | |
parent | 0e20c8eb8b71eaa71fbfd5dedf6ccd6492531e14 (diff) | |
parent | da873584afaaa87ee993df8114f4097bde25be8b (diff) | |
download | gitlab-ce-5a9808651b728628257545554743cdb2abba4cc3.tar.gz |
Merge branch 'knative-prometheus' into 'master'
Add Knative metrics to Prometheus
See merge request gitlab-org/gitlab-ce!23972
Diffstat (limited to 'app/models/clusters')
-rw-r--r-- | app/models/clusters/applications/knative.rb | 9 | ||||
-rw-r--r-- | app/models/clusters/applications/prometheus.rb | 7 | ||||
-rw-r--r-- | app/models/clusters/cluster.rb | 1 |
3 files changed, 14 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 diff --git a/app/models/clusters/cluster.rb b/app/models/clusters/cluster.rb index 7fe43cd2de0..6050955fbd8 100644 --- a/app/models/clusters/cluster.rb +++ b/app/models/clusters/cluster.rb @@ -63,6 +63,7 @@ module Clusters delegate :available?, to: :application_helm, prefix: true, allow_nil: true delegate :available?, to: :application_ingress, prefix: true, allow_nil: true delegate :available?, to: :application_prometheus, prefix: true, allow_nil: true + delegate :available?, to: :application_knative, prefix: true, allow_nil: true enum cluster_type: { instance_type: 1, |