• R/O
  • HTTP
  • SSH
  • HTTPS

grid-chef-repo: コミット

Grid環境構築用のChefリポジトリです。


コミットメタ情報

リビジョンc46f2bb8ccd96e9a10862225b9aadd7afcfee07a (tree)
日時2018-07-16 12:34:29
作者whitestar <whitestar@user...>
コミッターwhitestar

ログメッセージ

add kata-containers cookbook.

変更サマリ

差分

--- /dev/null
+++ b/cookbooks/kata-containers/.foodcritic
@@ -0,0 +1 @@
1+~FC001
--- /dev/null
+++ b/cookbooks/kata-containers/.rubocop.yml
@@ -0,0 +1,53 @@
1+AllCops:
2+ Exclude:
3+ - vendor/**/*
4+
5+AlignParameters:
6+ Enabled: false
7+LineLength:
8+ Enabled: false
9+Lint/UnusedBlockArgument:
10+ Enabled: false
11+Metrics/AbcSize:
12+ Enabled: false
13+Style/BlockComments:
14+ Enabled: false
15+Style/BlockDelimiters:
16+ Enabled: false
17+Style/ExtraSpacing:
18+ Enabled: false
19+Style/FileName:
20+ Enabled: false
21+Style/LeadingCommentSpace:
22+ Enabled: false
23+Style/RescueModifier:
24+ Enabled: false
25+Style/SpaceAroundOperators:
26+ Enabled: false
27+Style/SpaceBeforeFirstArg:
28+ Enabled: false
29+Style/SpaceInsideBlockBraces:
30+ Enabled: false
31+Style/SpaceInsidePercentLiteralDelimiters:
32+ Enabled: false
33+Style/TrailingCommaInLiteral:
34+ EnforcedStyleForMultiline: consistent_comma
35+Style/WordArray:
36+ Enabled: false
37+
38+#Lint/ShadowingOuterLocalVariable:
39+# Enabled: false
40+#Metrics/MethodLength:
41+# Max: 10
42+#Metrics/ModuleLength:
43+# Max: 100
44+#Metrics/CyclomaticComplexity:
45+# Max: 6
46+#Metrics/PerceivedComplexity:
47+# Max: 7
48+#Style/AccessorMethodName:
49+# Enabled: false
50+#Style/MultilineOperationIndentation:
51+# Enabled: false
52+#Style/PerlBackrefs:
53+# Enabled: false
--- /dev/null
+++ b/cookbooks/kata-containers/Berksfile
@@ -0,0 +1,19 @@
1+#
2+# Copyright 2018 whitestar
3+#
4+# Licensed under the Apache License, Version 2.0 (the "License");
5+# you may not use this file except in compliance with the License.
6+# You may obtain a copy of the License at
7+#
8+# http://www.apache.org/licenses/LICENSE-2.0
9+#
10+# Unless required by applicable law or agreed to in writing, software
11+# distributed under the License is distributed on an "AS IS" BASIS,
12+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+# See the License for the specific language governing permissions and
14+# limitations under the License.
15+#
16+
17+source 'https://supermarket.chef.io'
18+
19+metadata
--- /dev/null
+++ b/cookbooks/kata-containers/CHANGELOG.md
@@ -0,0 +1,5 @@
1+# kata-containers CHANGELOG
2+
3+0.1.0
4+-----
5+- Initial release of kata-containers
--- /dev/null
+++ b/cookbooks/kata-containers/Gemfile
@@ -0,0 +1,4 @@
1+source 'https://rubygems.org'
2+
3+# with Chef DK
4+gem 'stove'
--- /dev/null
+++ b/cookbooks/kata-containers/README.md
@@ -0,0 +1,71 @@
1+kata-containers Cookbook
2+===================
3+
4+This cookbook installs Kata Containers.
5+
6+## Contents
7+
8+- [Requirements](#requirements)
9+ - [platforms](#platforms)
10+ - [packages](#packages)
11+- [Attributes](#attributes)
12+- [Usage](#usage)
13+ - [Recipes](#recipes)
14+ - [kata-containers::default](#kata-containersdefault)
15+ - [Role Examples](#role-examples)
16+- [License and Authors](#license-and-authors)
17+
18+## Requirements
19+
20+### platforms
21+
22+- Ubuntu >= 16.04
23+
24+### packages
25+- none.
26+
27+## Attributes
28+
29+|Key|Type|Description, example|Default|
30+|:--|:--|:--|:--|
31+
32+## Usage
33+
34+### Recipes
35+
36+#### kata-containers::default
37+
38+This recipe installs Kata Containers.
39+
40+### Role Examples
41+
42+- `roles/kata-containers.rb`
43+
44+```ruby
45+name 'kata-containers'
46+description 'Kata Containers'
47+
48+run_list(
49+ 'recipe[kata-containers::default]',
50+)
51+```
52+
53+## License and Authors
54+
55+- Author:: whitestar at osdn.jp
56+
57+```text
58+Copyright 2018, whitestar
59+
60+Licensed under the Apache License, Version 2.0 (the "License");
61+you may not use this file except in compliance with the License.
62+You may obtain a copy of the License at
63+
64+ http://www.apache.org/licenses/LICENSE-2.0
65+
66+Unless required by applicable law or agreed to in writing, software
67+distributed under the License is distributed on an "AS IS" BASIS,
68+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
69+See the License for the specific language governing permissions and
70+limitations under the License.
71+```
--- /dev/null
+++ b/cookbooks/kata-containers/Rakefile
@@ -0,0 +1,41 @@
1+require 'rspec/core/rake_task'
2+require 'rubocop/rake_task'
3+require 'foodcritic'
4+require 'stove/rake_task'
5+
6+namespace :style do
7+ desc 'Run Ruby style checks'
8+ RuboCop::RakeTask.new(:ruby) do |t|
9+ t.options = [
10+ '--auto-gen-config', # creates .rubocop_todo.yml
11+ ]
12+ end
13+
14+ desc 'Run Chef style checks'
15+ FoodCritic::Rake::LintTask.new(:chef) do |t|
16+ t.options = {
17+ fail_tags: ['any'],
18+ }
19+ end
20+end
21+
22+desc 'Run all style checks'
23+task style: ['style:chef', 'style:ruby']
24+
25+desc 'Run ChefSpec examples'
26+RSpec::Core::RakeTask.new(:spec)
27+
28+desc 'Publish cookbook'
29+Stove::RakeTask.new(:publish) do |t|
30+ t.stove_opts = [
31+ # `--username` and `--key` are set in ~/.stove typically.
32+ #'--username', 'somebody',
33+ #'--key', '~/chef/chef.io.example.com/somebody.pem',
34+ #'--endpoint', 'https://supermarket.io.example.com/api/v1', # default: supermarket.chef.io
35+ #'--no-ssl-verify',
36+ '--no-git',
37+ '--log-level', 'info',
38+ ]
39+end
40+
41+task default: ['style', 'spec']
--- /dev/null
+++ b/cookbooks/kata-containers/concourse.yml
@@ -0,0 +1,100 @@
1+---
2+# $ fly -t $CC_TARGET sp -p kata-containers-cookbook -c concourse.yml -l fly-vars.yml -l ~/sec/credentials-prod.yml
3+resources:
4+- name: src-git
5+ type: git
6+ source:
7+ uri: ((git-id-osdn))@git.osdn.net:/gitroot/metasearch/grid-chef-repo.git
8+ branch: master
9+ paths:
10+ - cookbooks/((cookbook-name))
11+ private_key: ((git-private-key))
12+ git_user: ((git-user-osdn))
13+ #check_every: 1h # default: 1m
14+- name: chefdk-cache
15+ type: docker-image
16+ source:
17+ repository: chef/chefdk
18+ tag: ((chefdk-version))
19+ # ((param)) style: fly >= 3.2.0
20+ registry_mirror: https://((registry-mirror-domain)) # e.g. https://registry.docker.example.com:5000
21+ ca_certs:
22+ - domain: ((registry-mirror-domain)) # e.g. registry.docker.example.com:5000
23+ cert: ((docker-reg-ca-cert))
24+ check_every: 6h # default: 1m
25+
26+jobs:
27+- name: test-cookbook
28+ plan:
29+ - aggregate:
30+ - get: src-git
31+ params:
32+ depth: 5
33+ trigger: true
34+ - get: chefdk-cache
35+ - task: ci-build
36+ image: chefdk-cache
37+ params:
38+ http_proxy: ((http-proxy)) # e.g. http://proxy.example.com:3128
39+ #HTTP_PROXY: ((http-proxy))
40+ config:
41+ platform: linux
42+ #image_resource:
43+ # type: docker-image
44+ # source:
45+ # repository: chef/chefdk
46+ # tag: ((chefdk-version))
47+ # NG, setting disable
48+ #registry_mirror: https://((registry-mirror-domain))
49+ #ca_certs:
50+ #- domain: ((registry-mirror-domain))
51+ # cert: ((docker-reg-ca-cert))
52+ inputs:
53+ - name: src-git
54+ run:
55+ #dir: ./src-git/cookbooks/((cookbook-name))
56+ #path: rake
57+ path: /bin/bash
58+ args:
59+ - -c
60+ - |
61+ cd ./src-git/cookbooks/((cookbook-name))
62+ bundle install
63+ rake
64+- name: publish-cookbook
65+ plan:
66+ - aggregate:
67+ - get: src-git
68+ params:
69+ depth: 5
70+ trigger: false
71+ passed: [test-cookbook]
72+ - get: chefdk-cache
73+ passed: [test-cookbook]
74+ - task: publish
75+ image: chefdk-cache
76+ params:
77+ http_proxy: ((http-proxy))
78+ chef_username: ((chef-username))
79+ chef_client_key: ((chef-client-key))
80+ config:
81+ platform: linux
82+ inputs:
83+ - name: src-git
84+ run:
85+ path: /bin/bash
86+ args:
87+ - -c
88+ - |
89+ echo '{"username":"((chef-username))","key":"/root/chef-client-key.pem"}' > /root/.stove
90+ echo "$chef_client_key" > /root/chef-client-key.pem
91+ cd ./src-git/cookbooks/((cookbook-name))
92+ bundle install
93+ rake publish
94+ - put: src-git
95+ params:
96+ repository: src-git
97+ tag_prefix: ((cookbook-name))-
98+ tag: src-git/cookbooks/((cookbook-name))/version
99+ only_tag: true
100+ annotate: src-git/cookbooks/((cookbook-name))/version
--- /dev/null
+++ b/cookbooks/kata-containers/fly-vars.yml
@@ -0,0 +1,3 @@
1+---
2+cookbook-name: kata-containers
3+chefdk-version: 1.4.3
--- /dev/null
+++ b/cookbooks/kata-containers/metadata.rb
@@ -0,0 +1,15 @@
1+name 'kata-containers'
2+maintainer 'whitestar'
3+maintainer_email ''
4+license 'Apache 2.0'
5+description 'Installs/Configures kata-containers'
6+long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
7+version IO.read(File.join(File.dirname(__FILE__), 'version')).chomp
8+source_url 'http://scm.osdn.jp/gitroot/metasearch/grid-chef-repo.git'
9+issues_url 'https://osdn.jp/projects/metasearch/ticket'
10+
11+chef_version '>= 12'
12+# %w( centos redhat ).each do |os|
13+# supports os, '>= 7.0'
14+# end
15+supports 'ubuntu', '>= 16.04'
--- /dev/null
+++ b/cookbooks/kata-containers/recipes/default.rb
@@ -0,0 +1,59 @@
1+#
2+# Cookbook Name:: kata-containers
3+# Recipe:: default
4+#
5+# Copyright 2018, whitestar
6+#
7+# Licensed under the Apache License, Version 2.0 (the "License");
8+# you may not use this file except in compliance with the License.
9+# You may obtain a copy of the License at
10+#
11+# http://www.apache.org/licenses/LICENSE-2.0
12+#
13+# Unless required by applicable law or agreed to in writing, software
14+# distributed under the License is distributed on an "AS IS" BASIS,
15+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+# See the License for the specific language governing permissions and
17+# limitations under the License.
18+#
19+
20+platform = node['platform']
21+
22+case platform
23+# when 'centos'
24+when 'ubuntu'
25+ apt_get_update = 'apt-get_update'
26+ resources(execute: apt_get_update) rescue execute apt_get_update do
27+ command 'apt-get update'
28+ action :nothing
29+ end
30+
31+ bash 'add_kata-containers_apt_key' do
32+ code <<-"EOH"
33+ curl -sL http://download.opensuse.org/repositories/home:/katacontainers:/release/xUbuntu_$(lsb_release -rs)/Release.key | apt-key add -
34+ EOH
35+ action :nothing
36+ not_if "apt-key list | grep 'katacontainers'"
37+ end
38+
39+ bash 'add_kata-containers_apt_line' do
40+ code <<-"EOH"
41+ echo "deb http://download.opensuse.org/repositories/home:/katacontainers:/release/xUbuntu_$(lsb_release -rs)/ /" > /etc/apt/sources.list.d/kata-containers.list
42+ EOH
43+ action :nothing
44+ not_if { File.exist?('/etc/apt/sources.list.d/kata-containers.list') }
45+ notifies :run, 'bash[add_kata-containers_apt_key]', :before
46+ notifies :run, "execute[#{apt_get_update}]", :immediately
47+ end
48+
49+ [
50+ 'kata-runtime',
51+ 'kata-proxy',
52+ 'kata-shim',
53+ ].each {|pkg_name|
54+ resources(package: pkg_name) rescue package pkg_name do
55+ action :install
56+ notifies :run, 'bash[add_kata-containers_apt_line]', :before
57+ end
58+ }
59+end
--- /dev/null
+++ b/cookbooks/kata-containers/spec/recipes/default_spec.rb
@@ -0,0 +1,9 @@
1+require_relative '../spec_helper'
2+
3+describe 'kata-containers::default' do
4+ let(:chef_run) { ChefSpec::SoloRunner.new.converge(described_recipe) }
5+
6+ #it 'does something' do
7+ # expect(chef_run).to do_something('...')
8+ #end
9+end
--- /dev/null
+++ b/cookbooks/kata-containers/spec/spec_helper.rb
@@ -0,0 +1,25 @@
1+# Added by ChefSpec
2+require 'chefspec'
3+
4+# Uncomment to use ChefSpec's Berkshelf extension
5+# require 'chefspec/berkshelf'
6+
7+RSpec.configure do |config|
8+ # Specify the path for Chef Solo to find cookbooks
9+ # config.cookbook_path = '/var/cookbooks'
10+
11+ # Specify the path for Chef Solo to find roles
12+ # config.role_path = '/var/roles'
13+
14+ # Specify the Chef log_level (default: :warn)
15+ # config.log_level = :debug
16+
17+ # Specify the path to a local JSON file with Ohai data
18+ # config.path = 'ohai.json'
19+
20+ # Specify the operating platform to mock Ohai data from
21+ # config.platform = 'ubuntu'
22+
23+ # Specify the operating version to mock Ohai data from
24+ # config.version = '12.04'
25+end
--- /dev/null
+++ b/cookbooks/kata-containers/version
@@ -0,0 +1 @@
1+0.1.0
旧リポジトリブラウザで表示