Class: Ci::GenerateKubeconfigService
- Inherits:
-
Object
- Object
- Ci::GenerateKubeconfigService
- Defined in:
- app/services/ci/generate_kubeconfig_service.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(pipeline, token:, environment:) ⇒ GenerateKubeconfigService
constructor
A new instance of GenerateKubeconfigService.
Constructor Details
#initialize(pipeline, token:, environment:) ⇒ GenerateKubeconfigService
Returns a new instance of GenerateKubeconfigService.
5 6 7 8 9 10 11 |
# File 'app/services/ci/generate_kubeconfig_service.rb', line 5 def initialize(pipeline, token:, environment:) @pipeline = pipeline @token = token @environment = environment @template = Gitlab::Kubernetes::Kubeconfig::Template.new end |
Instance Method Details
#execute ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/services/ci/generate_kubeconfig_service.rb', line 13 def execute template.add_cluster( name: cluster_name, url: Gitlab::Kas.tunnel_url ) .each do || agent = .agent user = user_name(agent) template.add_user( name: user, token: agent_token(agent) ) template.add_context( name: context_name(agent), namespace: context_namespace(), cluster: cluster_name, user: user ) end template end |