Introduce a facility to maintain kubernetes_api. Gitlab::Kubernetes::Client
The only change is to move all Kubernetes-related-kubeclient-methods into separate class
Gitlab::Kubernetes::Client
to hide a way how we interact with kubeclient and handle errors.
https://gitlab.com/gitlab-org/gitlab-ce/issues/38668#note_47928828
We introduced a FetchKubernetesTokenService
(app/services/ci/fetch_kubernetes_token_service.rb) in https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/14470. This class is almost copied from KuberntesService
(app/models/project_services/kubernetes_service.rb). This is not dry. We should introduce a facility to maintain kubernetes_api and points it from KuberntesService
. And we can remove FetchKubernetesTokenService
.
The following discussion from gitlab-ce!14470 should be addressed:
-
@dosuken123 started a discussion: (+1 comment) @ayufan @nick.thomas This is a class to remove
attr_accessor :username, :password
fromKubernetesService
. Previously, we discussed at https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/14470#note_41830601. I know this is ugly but I don't want to tweakKubernetesService
in this MR. I'll create a follow-up MR as gitlab-ce~3011693. Then, we can have time to check if the new facility doesn't break any lagacyKubernetesService
functionality. What do you think?
/cc @ayufan