Commit c7d50ddf authored by Thong Kuah's avatar Thong Kuah

Fix connection to Tiller error while uninstalling

Both the `install-<app>` and `uninstall-<app>` pods loads the
`values-content-configuration-<app>` configmap into the pod
(see `#volume_specification`). This configmap contains the cert
necessary to connect to Tiller. The cert though is only valid for 30
minutes.

So this fixes the bug where the configmap when uninstalling should be
updated as well.
parent aa6b8c8c
---
title: Fix connection to Tiller error while uninstalling
merge_request: 29131
author:
type: fixed
...@@ -24,6 +24,7 @@ module Gitlab ...@@ -24,6 +24,7 @@ module Gitlab
def uninstall(command) def uninstall(command)
namespace.ensure_exists! namespace.ensure_exists!
create_config_map(command)
delete_pod!(command.pod_name) delete_pod!(command.pod_name)
kubeclient.create_pod(command.pod_resource) kubeclient.create_pod(command.pod_resource)
......
...@@ -36,6 +36,8 @@ describe Gitlab::Kubernetes::Helm::Api do ...@@ -36,6 +36,8 @@ describe Gitlab::Kubernetes::Helm::Api do
describe '#uninstall' do describe '#uninstall' do
before do before do
allow(client).to receive(:create_pod).and_return(nil) allow(client).to receive(:create_pod).and_return(nil)
allow(client).to receive(:get_config_map).and_return(nil)
allow(client).to receive(:create_config_map).and_return(nil)
allow(client).to receive(:delete_pod).and_return(nil) allow(client).to receive(:delete_pod).and_return(nil)
allow(namespace).to receive(:ensure_exists!).once allow(namespace).to receive(:ensure_exists!).once
end end
...@@ -53,6 +55,28 @@ describe Gitlab::Kubernetes::Helm::Api do ...@@ -53,6 +55,28 @@ describe Gitlab::Kubernetes::Helm::Api do
subject.uninstall(command) subject.uninstall(command)
end end
context 'with a ConfigMap' do
let(:resource) { Gitlab::Kubernetes::ConfigMap.new(application_name, files).generate }
it 'creates a ConfigMap on kubeclient' do
expect(client).to receive(:create_config_map).with(resource).once
subject.install(command)
end
context 'config map already exists' do
before do
expect(client).to receive(:get_config_map).with("values-content-configuration-#{application_name}", gitlab_namespace).and_return(resource)
end
it 'updates the config map' do
expect(client).to receive(:update_config_map).with(resource).once
subject.install(command)
end
end
end
end end
describe '#install' do describe '#install' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment