diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2017-07-06 16:05:50 +0300 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2017-07-06 16:05:50 +0300 |
commit | e0b3257b36396a43495a148b7642435c6cae82a5 (patch) | |
tree | bdee0e945bcacf24709daaf7299375dd359621cc /app/models/project_services | |
parent | a33fb2132cc9c1924fe986ce562cd7bea084a5c9 (diff) | |
parent | dbb313c26f79e5bebf197af8eba24411fced51bb (diff) |
Merge branch '33360-generate-kubeconfig' into 'master'
Generate KUBECONFIG in KubernetesService#predefined_variables
Closes #33360
See merge request !12223
Diffstat (limited to 'app/models/project_services')
-rw-r--r-- | app/models/project_services/kubernetes_service.rb | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/app/models/project_services/kubernetes_service.rb b/app/models/project_services/kubernetes_service.rb index 48e7802c557..62f7c057c5b 100644 --- a/app/models/project_services/kubernetes_service.rb +++ b/app/models/project_services/kubernetes_service.rb @@ -96,10 +96,13 @@ class KubernetesService < DeploymentService end def predefined_variables + config = YAML.dump(kubeconfig) + variables = [ { key: 'KUBE_URL', value: api_url, public: true }, { key: 'KUBE_TOKEN', value: token, public: false }, - { key: 'KUBE_NAMESPACE', value: actual_namespace, public: true } + { key: 'KUBE_NAMESPACE', value: actual_namespace, public: true }, + { key: 'KUBECONFIG', value: config, public: false, file: true } ] if ca_pem.present? @@ -135,6 +138,14 @@ class KubernetesService < DeploymentService private + def kubeconfig + to_kubeconfig( + url: api_url, + namespace: actual_namespace, + token: token, + ca_pem: ca_pem) + end + def namespace_placeholder default_namespace || TEMPLATE_PLACEHOLDER end |