summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZ.J. van de Weg <zegerjan@gitlab.com>2016-09-28 22:14:33 +0200
committerZ.J. van de Weg <zegerjan@gitlab.com>2016-09-28 22:16:06 +0200
commit912d34a5016a15084f59b5568e329875e377bdcb (patch)
treeb9a9ded827970dbf5a1445c810e4efdae1c287e1
parente8cce313a11198e65b8b7c1091ffe485a95bc627 (diff)
downloadgitlab-ce-zj-kubernetes-config-templates.tar.gz
Ground work for Kubernetes config files dropdownzj-kubernetes-config-templates
Fixes, at least partially #21486. TODO: - [ ] Frontend - [ ] Create a project containing all the configuration files - [ ] Add tests [ci skip]
-rw-r--r--lib/api/templates.rb5
-rw-r--r--lib/gitlab/template/kubernetes_config_template.rb25
-rw-r--r--lib/tasks/gitlab/update_templates.rake5
3 files changed, 32 insertions, 3 deletions
diff --git a/lib/api/templates.rb b/lib/api/templates.rb
index b9e718147e1..a64730b0715 100644
--- a/lib/api/templates.rb
+++ b/lib/api/templates.rb
@@ -1,8 +1,9 @@
module API
class Templates < Grape::API
GLOBAL_TEMPLATE_TYPES = {
- gitignores: Gitlab::Template::GitignoreTemplate,
- gitlab_ci_ymls: Gitlab::Template::GitlabCiYmlTemplate
+ gitignores: Gitlab::Template::GitignoreTemplate,
+ gitlab_ci_ymls: Gitlab::Template::GitlabCiYmlTemplate,
+ kubernetes_config: Gitlab::Template::KubernetesConfigTemplate
}.freeze
helpers do
diff --git a/lib/gitlab/template/kubernetes_config_template.rb b/lib/gitlab/template/kubernetes_config_template.rb
new file mode 100644
index 00000000000..a70550f31f4
--- /dev/null
+++ b/lib/gitlab/template/kubernetes_config_template.rb
@@ -0,0 +1,25 @@
+module Gitlab
+ module Template
+ class KubernetesConfigTemplate < BaseTemplate
+ class << self
+ def extension
+ '_pod.yaml'
+ end
+
+ def categories
+ {
+ "Default" => ''
+ }
+ end
+
+ def base_dir
+ Rails.root.join('vendor/kubernetes')
+ end
+
+ def finder(project = nil)
+ Gitlab::Template::Finders::GlobalTemplateFinder.new(self.base_dir, self.extension, self.categories)
+ end
+ end
+ end
+ end
+end
diff --git a/lib/tasks/gitlab/update_templates.rake b/lib/tasks/gitlab/update_templates.rake
index 4f76dad7286..7459cc82b19 100644
--- a/lib/tasks/gitlab/update_templates.rake
+++ b/lib/tasks/gitlab/update_templates.rake
@@ -45,7 +45,10 @@ namespace :gitlab do
Template.new(
"https://gitlab.com/gitlab-org/gitlab-ci-yml.git",
/(\.{1,2}|LICENSE|Pages|\.gitlab-ci.yml)\z/
- )
+ ),
+ Template.new(
+ "https://gitlab.com/gitlab-org/to-be-determined.git",
+ /(\.{1,2}|_pod.yaml)\z/
]
def vendor_directory