diff options
-rw-r--r-- | app/models/clusters/applications/ingress.rb | 6 | ||||
-rw-r--r-- | changelogs/unreleased/39985-enable-prometheus-metrics-for-deployed-ingresses.yml | 5 | ||||
-rw-r--r-- | lib/gitlab/kubernetes/helm/pod.rb | 8 | ||||
-rw-r--r-- | spec/lib/gitlab/kubernetes/helm/pod_spec.rb | 4 | ||||
-rw-r--r-- | vendor/ingress/values.yaml | 8 |
5 files changed, 26 insertions, 5 deletions
diff --git a/app/models/clusters/applications/ingress.rb b/app/models/clusters/applications/ingress.rb index 9024f1df1cd..aa5cf97756f 100644 --- a/app/models/clusters/applications/ingress.rb +++ b/app/models/clusters/applications/ingress.rb @@ -17,8 +17,12 @@ module Clusters 'stable/nginx-ingress' end + def chart_values_file + "#{Rails.root}/vendor/#{name}/values.yaml" + end + def install_command - Gitlab::Kubernetes::Helm::InstallCommand.new(name, chart: chart) + Gitlab::Kubernetes::Helm::InstallCommand.new(name, chart: chart, chart_values_file: chart_values_file) end end end diff --git a/changelogs/unreleased/39985-enable-prometheus-metrics-for-deployed-ingresses.yml b/changelogs/unreleased/39985-enable-prometheus-metrics-for-deployed-ingresses.yml new file mode 100644 index 00000000000..5c45d0db602 --- /dev/null +++ b/changelogs/unreleased/39985-enable-prometheus-metrics-for-deployed-ingresses.yml @@ -0,0 +1,5 @@ +--- +title: Enable Prometheus metrics for deployed Ingresses +merge_request: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/16866 +author: joshlambert +type: changed diff --git a/lib/gitlab/kubernetes/helm/pod.rb b/lib/gitlab/kubernetes/helm/pod.rb index a3216759cae..ca5e06009fa 100644 --- a/lib/gitlab/kubernetes/helm/pod.rb +++ b/lib/gitlab/kubernetes/helm/pod.rb @@ -64,7 +64,7 @@ module Gitlab { name: 'configuration-volume', configMap: { - name: 'values-content-configuration', + name: "values-content-configuration-#{command.name}", items: [{ key: 'values', path: 'values.yaml' }] } } @@ -81,7 +81,11 @@ module Gitlab def create_config_map resource = ::Kubeclient::Resource.new - resource.metadata = { name: 'values-content-configuration', namespace: namespace_name, labels: { name: 'values-content-configuration' } } + resource.metadata = { + name: "values-content-configuration-#{command.name}", + namespace: namespace_name, + labels: { name: "values-content-configuration-#{command.name}" } + } resource.data = { values: File.read(command.chart_values_file) } kubeclient.create_config_map(resource) end diff --git a/spec/lib/gitlab/kubernetes/helm/pod_spec.rb b/spec/lib/gitlab/kubernetes/helm/pod_spec.rb index 0b8e97b8948..ebb6033f71e 100644 --- a/spec/lib/gitlab/kubernetes/helm/pod_spec.rb +++ b/spec/lib/gitlab/kubernetes/helm/pod_spec.rb @@ -63,14 +63,14 @@ describe Gitlab::Kubernetes::Helm::Pod do it 'should mount configMap specification in the volume' do spec = subject.generate.spec - expect(spec.volumes.first.configMap['name']).to eq('values-content-configuration') + expect(spec.volumes.first.configMap['name']).to eq("values-content-configuration-#{app.name}") expect(spec.volumes.first.configMap['items'].first['key']).to eq('values') expect(spec.volumes.first.configMap['items'].first['path']).to eq('values.yaml') end end context 'without a configuration file' do - let(:app) { create(:clusters_applications_ingress, cluster: cluster) } + let(:app) { create(:clusters_applications_helm, cluster: cluster) } it_behaves_like 'helm pod' diff --git a/vendor/ingress/values.yaml b/vendor/ingress/values.yaml new file mode 100644 index 00000000000..cdb7da77e86 --- /dev/null +++ b/vendor/ingress/values.yaml @@ -0,0 +1,8 @@ +controller: + image: + tag: "0.10.2" + repository: "quay.io/kubernetes-ingress-controller/nginx-ingress-controller" + stats.enabled: true + podAnnotations: + prometheus.io/scrape: "true" + prometheus.io/port: "10254" |