diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2018-11-15 12:33:40 +0000 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2018-11-15 12:33:40 +0000 |
commit | 5059c15d060a5fab68d1a7a9aa2fd39646540fdb (patch) | |
tree | c7e0e28b4f785d597fbda23b1b923b54977318ba /lib | |
parent | ed156528abfb71ca67eb10ad94e8b5cfb4443463 (diff) | |
parent | 429d3e49520d018258460782a5f456125e5610af (diff) | |
download | gitlab-ce-5059c15d060a5fab68d1a7a9aa2fd39646540fdb.tar.gz |
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')
-rw-r--r-- | lib/gitlab/kubernetes/helm/api.rb | 12 |
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 |