Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2018-11-15 15:33:40 +0300
committerKamil Trzciński <ayufan@ayufan.eu>2018-11-15 15:33:40 +0300
commit5059c15d060a5fab68d1a7a9aa2fd39646540fdb (patch)
treec7e0e28b4f785d597fbda23b1b923b54977318ba /lib/gitlab/kubernetes
parented156528abfb71ca67eb10ad94e8b5cfb4443463 (diff)
parent429d3e49520d018258460782a5f456125e5610af (diff)
Merge branch '53626-update-config-map-on-install-retry' into 'master'
Update config map if already present on install Closes #53626 See merge request gitlab-org/gitlab-ce!22969
Diffstat (limited to 'lib/gitlab/kubernetes')
-rw-r--r--lib/gitlab/kubernetes/helm/api.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/gitlab/kubernetes/helm/api.rb b/lib/gitlab/kubernetes/helm/api.rb
index 06841ec7b76..7c026ac9e68 100644
--- a/lib/gitlab/kubernetes/helm/api.rb
+++ b/lib/gitlab/kubernetes/helm/api.rb
@@ -54,7 +54,11 @@ module Gitlab
def create_config_map(command)
command.config_map_resource.tap do |config_map_resource|
- kubeclient.create_config_map(config_map_resource)
+ if config_map_exists?(config_map_resource)
+ kubeclient.update_config_map(config_map_resource)
+ else
+ kubeclient.create_config_map(config_map_resource)
+ end
end
end
@@ -88,6 +92,12 @@ module Gitlab
end
end
+ def config_map_exists?(resource)
+ kubeclient.get_config_map(resource.metadata.name, resource.metadata.namespace)
+ rescue ::Kubeclient::ResourceNotFoundError
+ false
+ end
+
def service_account_exists?(resource)
kubeclient.get_service_account(resource.metadata.name, resource.metadata.namespace)
rescue ::Kubeclient::ResourceNotFoundError