-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from adidenko/master
Calico support added
- Loading branch information
Showing
34 changed files
with
598 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,5 @@ | |
.build | ||
*.pyc | ||
deployment_scripts/puppet/modules/docker | ||
.utils/skip-debs | ||
Gemfile.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
class { '::plugin_k8s::calico_master': } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
class { '::plugin_k8s::calico_node': } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
fixtures: | ||
forge_modules: | ||
stdlib: "puppetlabs/stdlib" | ||
symlinks: | ||
calico: "#{source_dir}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Gemfile.lock | ||
spec/fixtures |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
source ENV['GEM_SOURCE'] || 'https://rubygems.org' | ||
|
||
puppetversion = ENV.key?('PUPPET_VERSION') ? "#{ENV['PUPPET_VERSION']}" : ['>= 3.3'] | ||
gem 'metadata-json-lint' | ||
gem 'puppet', puppetversion | ||
gem 'puppetlabs_spec_helper', '>= 1.0.0' | ||
gem 'puppet-lint', '>= 1.0.0' | ||
gem 'facter', '>= 1.7.0' | ||
gem 'rspec-puppet' | ||
|
||
# rspec must be v2 for ruby 1.8.7 | ||
if RUBY_VERSION >= '1.8.7' and RUBY_VERSION < '1.9' | ||
gem 'rspec', '~> 2.0' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# calico |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
require 'puppetlabs_spec_helper/rake_tasks' | ||
require 'puppet-lint/tasks/puppet-lint' | ||
PuppetLint.configuration.send('disable_80chars') | ||
PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"] | ||
|
||
desc "Validate manifests, templates, and ruby files" | ||
task :validate do | ||
Dir['manifests/**/*.pp'].each do |manifest| | ||
sh "puppet parser validate --noop #{manifest}" | ||
end | ||
Dir['spec/**/*.rb','lib/**/*.rb'].each do |ruby_file| | ||
sh "ruby -c #{ruby_file}" unless ruby_file =~ /spec\/fixtures/ | ||
end | ||
Dir['templates/**/*.erb'].each do |template| | ||
sh "erb -P -x -T '-' #{template} | ruby -c" | ||
end | ||
end |
37 changes: 37 additions & 0 deletions
37
deployment_scripts/puppet/modules/calico/manifests/calicoctl.pp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Class: calico::calicoctl | ||
# =========================== | ||
# | ||
# Full description of class calico here. | ||
# | ||
# Parameters | ||
# ---------- | ||
# | ||
# * `etcd_servers` | ||
# Specify list of etcd_servers. | ||
# | ||
# Examples | ||
# -------- | ||
# | ||
# @example | ||
# class { 'calico': | ||
# etcd_servers => 'http://127.0.0.1:4001' | ||
# } | ||
# | ||
# Authors | ||
# ------- | ||
# | ||
# Author Name <[email protected]> | ||
# | ||
# Copyright | ||
# --------- | ||
# | ||
# Copyright 2016 Your name here, unless otherwise noted. | ||
# | ||
class calico::calicoctl ( | ||
$etcd_servers = 'http://127.0.0.1:2379', | ||
) { | ||
package {'calicoctl': | ||
ensure => installed, | ||
tag => ['calico'], | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# Class: calico::cni | ||
# =========================== | ||
# | ||
# Full description of class calico here. | ||
# | ||
# Parameters | ||
# ---------- | ||
# | ||
# * `etcd_servers` | ||
# Specify list of etcd_servers. | ||
# | ||
# Examples | ||
# -------- | ||
# | ||
# @example | ||
# class { 'calico': | ||
# etcd_servers => 'http://127.0.0.1:4001' | ||
# } | ||
# | ||
# Authors | ||
# ------- | ||
# | ||
# Author Name <[email protected]> | ||
# | ||
# Copyright | ||
# --------- | ||
# | ||
# Copyright 2016 Your name here, unless otherwise noted. | ||
# | ||
class calico::cni ( | ||
$etcd_servers = 'http://127.0.0.1:2379', | ||
$confdir = '/etc/cni/net.d', | ||
$log_level = 'info', | ||
) { | ||
|
||
package {['calico', 'calico-ipam']: | ||
ensure => installed, | ||
tag => ['calico'], | ||
} | ||
|
||
# TODO: (adidenko) figure out how to specify path to CNI bin | ||
# and remove this symlink workaround. Or update package. | ||
exec {"cni-workaround-dir": | ||
command => "mkdir -p /opt/cni/bin", | ||
unless => "test -d /opt/cni/bin" | ||
} -> | ||
file {"/opt/cni/bin/calico": | ||
ensure => "/usr/bin/calico", | ||
} -> | ||
file {"/opt/cni/bin/calico-ipam": | ||
ensure => "/usr/bin/calico-ipam", | ||
} | ||
|
||
exec {"create $confdir": | ||
command => "mkdir -p $confdir", | ||
unless => "test -d $confdir", | ||
path => [ '/bin', '/usr/bin', '/usr/local/bin'], | ||
} -> | ||
file {"$confdir/10-calico.conf": | ||
ensure => file, | ||
content => template("${module_name}/cni.conf.erb"), | ||
tag => ['calico'], | ||
} | ||
|
||
Package<| tag == 'calico' |> -> | ||
File<| tag == 'calico' |> | ||
} |
53 changes: 53 additions & 0 deletions
53
deployment_scripts/puppet/modules/calico/manifests/init.pp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Class: calico | ||
# =========================== | ||
# | ||
# Full description of class calico here. | ||
# | ||
# Parameters | ||
# ---------- | ||
# | ||
# * `etcd_servers` | ||
# Specify list of etcd_servers. | ||
# | ||
# Examples | ||
# -------- | ||
# | ||
# @example | ||
# class { 'calico': | ||
# etcd_servers => 'http://127.0.0.1:4001' | ||
# } | ||
# | ||
# Authors | ||
# ------- | ||
# | ||
# Author Name <[email protected]> | ||
# | ||
# Copyright | ||
# --------- | ||
# | ||
# Copyright 2016 Your name here, unless otherwise noted. | ||
# | ||
class calico ( | ||
$etcd_servers = 'http://127.0.0.1:2379', | ||
$cni_conf_dir = '/etc/cni/net.d', | ||
) { | ||
|
||
include ::calico::calicoctl | ||
|
||
# class {'::calico::node': | ||
# etcd_servers => $etcd_servers, | ||
# } | ||
# | ||
# class {'::calico::cni': | ||
# etcd_servers => $etcd_servers, | ||
# confdir => $cni_conf_dir, | ||
# } | ||
# | ||
# class {'::calico::rcfile': | ||
# etcd_servers => $etcd_servers, | ||
# } | ||
# | ||
# Class['::calico::calicoctl'] -> | ||
# Class['::calico::node'] | ||
|
||
} |
51 changes: 51 additions & 0 deletions
51
deployment_scripts/puppet/modules/calico/manifests/node.pp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Class: calico::node | ||
# =========================== | ||
# | ||
# Full description of class calico here. | ||
# | ||
# Parameters | ||
# ---------- | ||
# | ||
# * `etcd_servers` | ||
# Specify list of etcd_servers. | ||
# | ||
# Examples | ||
# -------- | ||
# | ||
# @example | ||
# class { 'calico': | ||
# etcd_servers => 'http://127.0.0.1:4001' | ||
# } | ||
# | ||
# Authors | ||
# ------- | ||
# | ||
# Author Name <[email protected]> | ||
# | ||
# Copyright | ||
# --------- | ||
# | ||
# Copyright 2016 Your name here, unless otherwise noted. | ||
# | ||
class calico::node ( | ||
$etcd_servers = 'http://127.0.0.1:2379', | ||
) { | ||
|
||
# Setup node | ||
exec {'setup-calico-node': | ||
command => 'calicoctl node', | ||
environment => "ETCD_ENDPOINTS=$etcd_servers", | ||
unless => "calicoctl node show | grep ' $::fqdn '", | ||
tag => ['calico'], | ||
# it's going to pull calico/node container, which may | ||
# take some time | ||
timeout => 900, | ||
tries => 2, | ||
} | ||
|
||
#TODO: (adidenko) configure service | ||
|
||
Exec<||> { | ||
path => [ '/bin', '/usr/bin', '/usr/local/bin'], | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
deployment_scripts/puppet/modules/calico/manifests/rcfile.pp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Class: calico::rcfile | ||
# =========================== | ||
# | ||
# Full description of class calico here. | ||
# | ||
# Parameters | ||
# ---------- | ||
# | ||
# * `etcd_servers` | ||
# Specify list of etcd_servers. | ||
# | ||
# Examples | ||
# -------- | ||
# | ||
# @example | ||
# class { 'calico': | ||
# etcd_servers => 'http://127.0.0.1:4001' | ||
# } | ||
# | ||
# Authors | ||
# ------- | ||
# | ||
# Author Name <[email protected]> | ||
# | ||
# Copyright | ||
# --------- | ||
# | ||
# Copyright 2016 Your name here, unless otherwise noted. | ||
# | ||
class calico::rcfile ( | ||
$etcd_servers = 'http://127.0.0.1:2379', | ||
$rcfile = '/root/calicorc', | ||
) { | ||
file {$rcfile: | ||
ensure => 'file', | ||
content => " | ||
export ETCD_ENDPOINTS='$etcd_servers' | ||
", | ||
tag => ['calico'], | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "fuel-calico", | ||
"version": "0.1.0", | ||
"author": "fuel", | ||
"summary": null, | ||
"license": "Apache-2.0", | ||
"source": "", | ||
"project_page": null, | ||
"issues_url": null, | ||
"dependencies": [ | ||
{"name":"puppetlabs-stdlib","version_requirement":">= 1.0.0"} | ||
], | ||
"data_provider": null | ||
} | ||
|
12 changes: 12 additions & 0 deletions
12
deployment_scripts/puppet/modules/calico/spec/classes/calicoctl_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
require 'spec_helper' | ||
describe 'calico::calicoctl' do | ||
|
||
context 'with default values for all parameters' do | ||
it { | ||
should contain_package('calicoctl').with( | ||
'ensure' => 'installed', | ||
'tag' => ['calico'] | ||
) | ||
} | ||
end | ||
end |
Oops, something went wrong.