diff options
author | Thong Kuah <tkuah@gitlab.com> | 2018-11-28 23:31:28 +1300 |
---|---|---|
committer | Thong Kuah <tkuah@gitlab.com> | 2018-12-04 15:46:46 +1300 |
commit | dc1827209147de977b229269a0e52b1a348ed804 (patch) | |
tree | 145e657b536ef3325fda90f8406980939423ea8f /app/services | |
parent | 28b0b9c144a0869e218728d1d056607d1a7a7a8a (diff) | |
download | gitlab-ce-dc1827209147de977b229269a0e52b1a348ed804.tar.gz |
Modify service so that it can be re-run
If the service fails mid-point, then we should be able to re-run this
service. So, detect presence of any previously created Kubernetes
resource and update or create accordingly.
Fix specs accordingly. In the case of finalize_creation_service_spec.rb,
I decided to stub out the async worker rather than maintaining
individual stubs for various kubeclient calls for that worker.
Also add test cases for group clusters
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/clusters/gcp/kubernetes/create_service_account_service.rb | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/app/services/clusters/gcp/kubernetes/create_service_account_service.rb b/app/services/clusters/gcp/kubernetes/create_service_account_service.rb index dfc4bf7a358..f2d7cc05552 100644 --- a/app/services/clusters/gcp/kubernetes/create_service_account_service.rb +++ b/app/services/clusters/gcp/kubernetes/create_service_account_service.rb @@ -38,8 +38,9 @@ module Clusters def execute ensure_project_namespace_exists if namespace_creator - kubeclient.create_service_account(service_account_resource) - kubeclient.create_secret(service_account_token_resource) + + kubeclient.create_or_update_service_account(service_account_resource) + kubeclient.create_or_update_secret(service_account_token_resource) create_role_or_cluster_role_binding if rbac end @@ -56,9 +57,9 @@ module Clusters def create_role_or_cluster_role_binding if namespace_creator - kubeclient.create_role_binding(role_binding_resource) + kubeclient.create_or_update_role_binding(role_binding_resource) else - kubeclient.create_cluster_role_binding(cluster_role_binding_resource) + kubeclient.create_or_update_cluster_role_binding(cluster_role_binding_resource) end end |