diff options
author | Mayra Cabrera <mcabrera@gitlab.com> | 2018-01-11 13:11:22 -0600 |
---|---|---|
committer | Mayra Cabrera <mcabrera@gitlab.com> | 2018-01-11 13:11:22 -0600 |
commit | 0a69f49050d9d573fdc9f067875084d7c73ad85b (patch) | |
tree | 4705f235a8a1dd0fc22706cba27dad15fbf167f6 | |
parent | 37d96e7db1aaf5b0f94f85c274368706f0f1dc17 (diff) | |
download | gitlab-ce-41799-managed-prometheus-deployment-install-a-lot-of-extra-stuff.tar.gz |
Fixes suggestions on MR41799-managed-prometheus-deployment-install-a-lot-of-extra-stuff
-rw-r--r-- | lib/gitlab/kubernetes/helm/install_command.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/kubernetes/helm/pod.rb | 11 | ||||
-rw-r--r-- | spec/lib/gitlab/kubernetes/helm/install_command_spec.rb | 2 | ||||
-rw-r--r-- | spec/lib/gitlab/kubernetes/helm/pod_spec.rb | 2 |
4 files changed, 8 insertions, 9 deletions
diff --git a/lib/gitlab/kubernetes/helm/install_command.rb b/lib/gitlab/kubernetes/helm/install_command.rb index faf802726fd..bf6981035f4 100644 --- a/lib/gitlab/kubernetes/helm/install_command.rb +++ b/lib/gitlab/kubernetes/helm/install_command.rb @@ -37,7 +37,7 @@ module Gitlab return unless chart if chart_values_file - "helm install #{chart} --name #{name} --namespace #{namespace_name} -f /etc/prometheus/config/values.yaml >/dev/null" + "helm install #{chart} --name #{name} --namespace #{namespace_name} -f /data/helm/#{name}/config/values.yaml >/dev/null" else "helm install #{chart} --name #{name} --namespace #{namespace_name} >/dev/null" end diff --git a/lib/gitlab/kubernetes/helm/pod.rb b/lib/gitlab/kubernetes/helm/pod.rb index 17f289634ab..a3216759cae 100644 --- a/lib/gitlab/kubernetes/helm/pod.rb +++ b/lib/gitlab/kubernetes/helm/pod.rb @@ -9,14 +9,13 @@ module Gitlab end def generate - spec = {} + spec = { containers: [container_specification], restartPolicy: 'Never' } if command.chart_values_file - generate_config_map - spec = { volumes: volumes_specification } + create_config_map + spec[:volumes] = volumes_specification end - spec.merge!({ containers: [container_specification], restartPolicy: 'Never' }) ::Kubeclient::Resource.new(metadata: metadata, spec: spec) end @@ -55,7 +54,7 @@ module Gitlab [ { name: 'configuration-volume', - mountPath: "/etc/#{command.name}/config" + mountPath: "/data/helm/#{command.name}/config" } ] end @@ -80,7 +79,7 @@ module Gitlab }.map { |key, value| { name: key, value: value } } end - def generate_config_map + def create_config_map resource = ::Kubeclient::Resource.new resource.metadata = { name: 'values-content-configuration', namespace: namespace_name, labels: { name: 'values-content-configuration' } } resource.data = { values: File.read(command.chart_values_file) } diff --git a/spec/lib/gitlab/kubernetes/helm/install_command_spec.rb b/spec/lib/gitlab/kubernetes/helm/install_command_spec.rb index 6d1b723e649..63997a40d52 100644 --- a/spec/lib/gitlab/kubernetes/helm/install_command_spec.rb +++ b/spec/lib/gitlab/kubernetes/helm/install_command_spec.rb @@ -111,7 +111,7 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do mv /tmp/linux-amd64/helm /usr/bin/ helm init --client-only >/dev/null - helm install #{prometheus.chart} --name #{prometheus.name} --namespace #{namespace.name} -f /etc/prometheus/config/values.yaml >/dev/null + helm install #{prometheus.chart} --name #{prometheus.name} --namespace #{namespace.name} -f /data/helm/#{prometheus.name}/config/values.yaml >/dev/null MSG end diff --git a/spec/lib/gitlab/kubernetes/helm/pod_spec.rb b/spec/lib/gitlab/kubernetes/helm/pod_spec.rb index 303168e2584..0b8e97b8948 100644 --- a/spec/lib/gitlab/kubernetes/helm/pod_spec.rb +++ b/spec/lib/gitlab/kubernetes/helm/pod_spec.rb @@ -53,7 +53,7 @@ describe Gitlab::Kubernetes::Helm::Pod do it 'should include volumes for the container' do container = subject.generate.spec.containers.first expect(container.volumeMounts.first['name']).to eq('configuration-volume') - expect(container.volumeMounts.first['mountPath']).to eq("/etc/#{app.name}/config") + expect(container.volumeMounts.first['mountPath']).to eq("/data/helm/#{app.name}/config") end it 'should include a volume inside the specification' do |