vagrant-openshift 2.0.3 → 2.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 06bbe8d087c19e8ec7af5e2c15ca9495f07f46d5
4
- data.tar.gz: 7e7d2e3742731456fdcbbf85b347f2395ae0e12e
3
+ metadata.gz: 80ee00f5ae807ab4d43099a4149aba767a24af57
4
+ data.tar.gz: f3d4576d80700025f1cb85ef64abefba02d58670
5
5
  SHA512:
6
- metadata.gz: 915e4260baa7ad853983df08219bb18036f5377b0e4efc658601d3a8edc8722c17700ca5316dc5e08a265bf5d05f1ae140825752c67926aeede01bd8fa57b52d
7
- data.tar.gz: dafc1a2eb27802cce734dadaed9fe9b2cb327306165aea57bb6e27aba1ba6be8838b1ff5db75db9cfab57570afd8d355a8c89c666334d24ae1bbe32e0a316c2a
6
+ metadata.gz: 1441657e3ee502608b67b01e9a5cd6d92cbe97186857edb79f0151f5ab59ee12c616b33939e1764831ab0c62c36fa74cd2633304825a1d8bda63080e501f3d95
7
+ data.tar.gz: 4fd81093a3134cfb35c5632b8702942bb357edad6efaf076d6686d17c876edffd742ac63054249d57070fd69e6b702cec71409bf2c41cdb3c7fcd9add1d1c132
data/README.asciidoc CHANGED
@@ -14,7 +14,7 @@ NOTE: Instructions below generally assume a Linux-like command line and may requ
14
14
  or link:https://github.com/tknerr/vagrant-managed-servers[managed] providers.
15
15
  * Provides commands to install build dependencies, sync repositories, and run tests
16
16
 
17
- ===== Using with Openshift v2
17
+ ===== Using with OpenShift v2
18
18
 
19
19
  v2 (aka M4) is no longer supported on the master branch or in the
20
20
  published rubygems.org version of this plugin. You must checkout the
@@ -51,7 +51,7 @@ Install the published version of this plugin:
51
51
  $ vagrant plugin install vagrant-openshift
52
52
  ----
53
53
 
54
- === Getting started with Openshift v3
54
+ === Getting started with OpenShift v3
55
55
 
56
56
  This plugin works in concert with the
57
57
  link:https://github.com/openshift/origin/blob/master/Vagrantfile[OpenShift Origin Vagrantfile]
@@ -228,14 +228,13 @@ OSTenant=<OpenStack Tenant Name>
228
228
  ----
229
229
 
230
230
  * Edit `.vagrant-openshift.json` and update the openstack provider
231
- section. You'll need to indicate at least the base image and host flavor
231
+ section. You'll need to indicate at least the base image
232
232
  you'd like to start, as well as the user to access with.
233
233
 
234
234
  .'.vagrant-openshift.json'
235
235
  ----
236
236
  "openstack": {
237
237
  "image": "Fedora-Cloud-Base-20141203-21.x86_64",
238
- "flavor": "m1.small",
239
238
  "ssh_user": "fedora"
240
239
  }
241
240
  ----
@@ -397,7 +396,7 @@ these stages, as the rate of change and amount of time to create each
397
396
  is different.
398
397
 
399
398
  After using `vagrant up --provider=<provider>` to start a host with only
400
- a basic operating system on it (Fedora 20+ or CentOS 7 should suffice),
399
+ a basic operating system on it (Fedora 21+ or CentOS 7 should suffice),
401
400
  you will need to install the build tools and other dependencies for
402
401
  building and running OpenShift. The following vagrant commands should
403
402
  help with this:
@@ -201,7 +201,6 @@ module Vagrant
201
201
  autoload :CloneUpstreamRepositories, action_root.join("clone_upstream_repositories")
202
202
  autoload :CreateYumRepositories, action_root.join("create_yum_repositories")
203
203
  autoload :CheckoutRepositories, action_root.join("checkout_repositories")
204
- autoload :SetupBindDnsKey, action_root.join("setup_bind_dns_key")
205
204
  autoload :SetHostName, action_root.join("set_host_name")
206
205
  autoload :YumUpdate, action_root.join("yum_update")
207
206
  autoload :InstallOpenshiftBaseDependencies, action_root.join("install_openshift_base_dependencies")
@@ -228,7 +227,6 @@ module Vagrant
228
227
  autoload :DownloadArtifactsSti, action_root.join("download_artifacts_sti")
229
228
  autoload :TestExitCode, action_root.join("test_exit_code")
230
229
  autoload :CleanNetworkSetup, action_root.join("clean_network_setup")
231
- autoload :SetupBindHost, action_root.join("setup_bind_host")
232
230
  autoload :RunSystemctl, action_root.join("run_systemctl")
233
231
  end
234
232
  end
@@ -31,6 +31,7 @@ module Vagrant
31
31
  def call(env)
32
32
  os = @options[:os].to_sym
33
33
  stage = @options[:stage].to_sym
34
+ instance_type = @options[:instance_type].to_sym
34
35
  inst_ts = Time.now.getutc.strftime('%Y%m%d_%H%M')
35
36
 
36
37
  box_info_path = Pathname.new(File.expand_path("#{__FILE__}/../../templates/command/init-openshift/box_info.yaml"))
@@ -66,7 +67,8 @@ module Vagrant
66
67
  'num_minions' => 2,
67
68
  'cpus' => 2,
68
69
  'memory' => 2048,
69
- 'rebuild_yum_cache' => false
70
+ 'rebuild_yum_cache' => false,
71
+ 'instance_type' => instance_type
70
72
  }
71
73
 
72
74
  vagrant_openshift_config['no_synced_folders'] = @options[:no_synced_folders]
@@ -96,7 +98,6 @@ module Vagrant
96
98
  } if box_info[:aws]
97
99
  vagrant_openshift_config['openstack'] = {
98
100
  'image' => box_info[:openstack][:image],
99
- 'flavor' => box_info[:openstack][:flavor],
100
101
  'ssh_user' => box_info[:openstack][:ssh_user]
101
102
  } if box_info[:openstack]
102
103
 
@@ -85,6 +85,8 @@ else
85
85
  GOPATH=/data go get code.google.com/p/go.tools/cmd/cover
86
86
  fi
87
87
 
88
+ GOPATH=/data go get golang.org/x/tools/cmd/vet
89
+
88
90
  chown -R #{ssh_user}:#{ssh_user} /data
89
91
 
90
92
  systemctl daemon-reload
@@ -44,23 +44,65 @@ pushd /data/src/github/openshift/#{image_name}
44
44
  git checkout #{git_ref}
45
45
  git_ref=$(git rev-parse --short HEAD)
46
46
  echo "Pushing image #{image_name}:$git_ref..."
47
+
47
48
  docker tag -f #{image_name}-centos7 #{registry}#{image_name}-centos7:$git_ref
48
49
  docker tag -f #{image_name}-centos7 #{registry}#{image_name}-centos7:latest
49
50
  docker tag -f #{image_name}-centos7 docker.io/#{image_name}-centos7:latest
50
51
  docker tag -f #{image_name}-rhel7 #{registry}#{image_name}-rhel7:$git_ref
51
52
  docker tag -f #{image_name}-rhel7 #{registry}#{image_name}-rhel7:latest
52
- # FIXME: Paralelize this
53
- docker push -f #{registry}#{image_name}-centos7:$git_ref
54
- docker push -f #{registry}#{image_name}-centos7:latest
55
- docker push -f docker.io/#{image_name}-centos7:latest
56
- docker push -f #{registry}#{image_name}-rhel7:$git_ref
57
- docker push -f #{registry}#{image_name}-rhel7:latest
53
+
54
+ #docker push -f #{registry}#{image_name}-centos7:$git_ref
55
+ #docker push -f docker.io/#{image_name}-centos7:latest
56
+ #docker push -f #{registry}#{image_name}-rhel7:$git_ref
57
+ #docker push -f #{registry}#{image_name}-centos7:latest
58
+ #docker push -f #{registry}#{image_name}-rhel7:latest
59
+
60
+ # We can't fully parallelize this because docker fails when you push to the same repo at the
61
+ # same time (using different tags), so we do two groups of push operations.
62
+ procs[0]="docker push -f #{registry}#{image_name}-centos7:$git_ref"
63
+ procs[1]="docker push -f docker.io/#{image_name}-centos7:latest"
64
+ procs[2]="docker push -f #{registry}#{image_name}-rhel7:$git_ref"
65
+
66
+ # Run pushes in parallel
67
+ for i in {0..2}; do
68
+ echo "pushing ${procs[${i}]}"
69
+ ${procs[${i}]} &
70
+ pids[${i}]=$!
71
+ echo "push ${procs[${i}]} is pid ${pids[${i}]}"
72
+ done
73
+
74
+ # Wait for all pushes. "wait" will check the return code of each process also.
75
+ for pid in ${pids[*]}; do
76
+ echo "checking $pid"
77
+ wait $pid
78
+ done
79
+
80
+ procs[0]="docker push -f #{registry}#{image_name}-centos7:latest"
81
+ procs[1]="docker push -f #{registry}#{image_name}-rhel7:latest"
82
+
83
+ # Run pushes in parallel
84
+ for i in {0..1}; do
85
+ ${procs[${i}]} &
86
+ pids[${i}]=$!
87
+ done
88
+
89
+ # Wait for all pushes. "wait" will check the return code of each process also.
90
+ for pid in ${pids[*]}; do
91
+ wait $pid
92
+ done
93
+
58
94
  popd
59
95
  set +e
60
96
  }
61
97
  end
62
98
 
63
- def build_image(image_name, git_ref, repo_url, registry)
99
+ # Note that this only invokes "make test" on the image, if the tests
100
+ # succeed the candidate produced by "make test" will be pushed. There
101
+ # is an implicit assumption here that the image produced by make test
102
+ # is identical to what would be produced by a subsequent "make build"
103
+ # call, so there's no point in explicitly calling "make build" after
104
+ # "make test"
105
+ def build_image(image_name, version, git_ref, repo_url)
64
106
  %{
65
107
  dest_dir="/data/src/github/openshift/#{image_name}"
66
108
  rm -rf ${dest_dir}; mkdir -p ${dest_dir}
@@ -70,11 +112,9 @@ git init && git remote add -t master origin #{repo_url}
70
112
  git fetch && git checkout #{git_ref}
71
113
  git_ref=$(git rev-parse --short HEAD)
72
114
  echo "Building and testing #{image_name}-centos7:$git_ref ..."
73
- make test TARGET=centos7
74
- make build TARGET=centos7
115
+ make test TARGET=centos7 VERSION=#{version} TAG_ON_SUCCESS=true
75
116
  echo "Building and testing #{image_name}-rhel7:$git_ref ..."
76
- make test TARGET=rhel7
77
- make build TARGET=rhel7
117
+ make test TARGET=rhel7 VERSION=#{version} TAG_ON_SUCCESS=true
78
118
  popd
79
119
  set +e
80
120
  }
@@ -108,9 +148,9 @@ set -x
108
148
  set +e
109
149
  echo "Pre-pulling base images ..."
110
150
  docker pull #{@options[:registry]}openshift/base-centos7
111
- [[ "$?" == "0" ]] && docker tag #{@options[:registry]}openshift/base-centos7 openshift/base-centos7
151
+ [[ "$?" == "0" ]] && docker tag -f #{@options[:registry]}openshift/base-centos7 openshift/base-centos7
112
152
  docker pull #{@options[:registry]}openshift/base-rhel7
113
- [[ "$?" == "0" ]] && docker tag #{@options[:registry]}openshift/base-rhel7 openshift/base-rhel7
153
+ [[ "$?" == "0" ]] && docker tag -f #{@options[:registry]}openshift/base-rhel7 openshift/base-rhel7
114
154
  }
115
155
 
116
156
  cmd += %{
@@ -121,20 +161,20 @@ PATH=/data/src/github.com/openshift/source-to-image/_output/go/bin:/data/src/git
121
161
  # FIXME: We always need to make sure we have the latest base image
122
162
  # FIXME: This is because the internal registry is pruned once per month
123
163
  if !@options[:build_images].include?("openshift/base")
124
- @options[:build_images] = "openshift/base:master,#{@options[:build_images]}"
164
+ @options[:build_images] = "openshift/base:1:master,#{@options[:build_images]}"
125
165
  end
126
166
 
127
167
  build_images = @options[:build_images].split(",").map { |i| i.strip }
128
168
 
129
169
  push_cmd = ""
130
170
  build_images.each do |image|
131
- name, git_ref = image.split(':')
171
+ name, version, git_ref = image.split(':')
132
172
  repo_url = Vagrant::Openshift::Constants.openshift_images[name]
133
173
  if repo_url == nil
134
174
  puts "Unregistered image: #{name}, skipping"
135
175
  next
136
176
  end
137
- cmd += build_image(name, git_ref, repo_url, @options[:registry])
177
+ cmd += build_image(name, version, git_ref, repo_url)
138
178
  push_cmd += push_image(name, git_ref, @options[:registry])
139
179
  end
140
180
 
@@ -92,6 +92,12 @@ popd >/dev/null
92
92
  cmd = cmd_env.join(' ') + ' ' + build_targets.join(' ')
93
93
  env[:test_exit_code] = run_tests(env, [cmd], true)
94
94
 
95
+ if env[:test_exit_code] == 0 && @options[:extended_test_packages].length > 0
96
+ extended_cmd = 'hack/test-extended.sh ' + Shellwords.escape(@options[:extended_test_packages])
97
+ env[:test_exit_code] = run_tests(env, [extended_cmd], true)
98
+ end
99
+
100
+
95
101
  # any other tests that should not be run as sudo
96
102
  if env[:test_exit_code] == 0 && @options[:all]
97
103
  cmds = ['hack/test-assets.sh']
@@ -30,6 +30,7 @@ module Vagrant
30
30
  :no_base => false,
31
31
  :os => 'centos7',
32
32
  :stage => 'inst',
33
+ :instance_type => 'c3.large',
33
34
  :port_mappings => [],
34
35
  :no_synced_folders => false,
35
36
  :no_insert_key => false
@@ -61,6 +62,10 @@ module Vagrant
61
62
  o.on('--no-insert-key', 'Insert a secure ssh key on vagrant up') do |f|
62
63
  options[:no_insert_key] = true
63
64
  end
65
+
66
+ o.on('--instance-type', "--instance-type [type]", String, "Specify what type of instance to launch") do |f|
67
+ options[:instance_type] = f
68
+ end
64
69
  end
65
70
 
66
71
  # Parse the options
@@ -35,7 +35,7 @@ module Vagrant
35
35
  o.on("--registry [url]", String, "Docker Registry to push images to.") do |c|
36
36
  options[:registry] = c
37
37
  end
38
- o.on("--build_images [list]", String, "List of IMAGE:REF pairs, delimited by ','") do |i|
38
+ o.on("--build_images [list]", String, "List of IMAGE:VERSION:REF pairs, delimited by ','") do |i|
39
39
  options[:build_images] = i
40
40
  end
41
41
  o.separator ""
@@ -29,6 +29,7 @@ module Vagrant
29
29
  options = {}
30
30
  options[:download] = false
31
31
  options[:all] = false
32
+ options[:extended_test_packages] = ""
32
33
 
33
34
  opts = OptionParser.new do |o|
34
35
  o.banner = "Usage: vagrant test-openshift [machine-name]"
@@ -38,6 +39,10 @@ module Vagrant
38
39
  options[:all] = true
39
40
  end
40
41
 
42
+ o.on("-e", "--extended TEST_BUCKETS", String, "Comma delimited list of extended test packages to run") do |f|
43
+ options[:extended_test_packages] = f
44
+ end
45
+
41
46
  o.on("-d","--artifacts", String, "Download logs") do |f|
42
47
  options[:download] = true
43
48
  end
@@ -17,20 +17,14 @@
17
17
  module Vagrant
18
18
  module Openshift
19
19
  class Config < Vagrant.plugin(2, :config)
20
- attr_accessor :cloud_domain
21
20
 
22
21
  def initialize
23
22
  super
24
-
25
- @cloud_domain = UNSET_VALUE
26
23
  end
27
24
 
28
25
  def finalize!
29
26
  super
30
-
31
- @cloud_domain = "example.com" if @cloud_domain == UNSET_VALUE
32
27
  end
33
28
  end
34
29
  end
35
- end
36
-
30
+ end
@@ -33,14 +33,22 @@ module Vagrant
33
33
  def self.openshift_images
34
34
  {
35
35
  'openshift/base' => 'https://github.com/openshift/sti-base.git',
36
+ 'openshift/jenkins-16' => 'https://github.com/openshift/jenkins.git',
36
37
  'openshift/nodejs-010' => 'https://github.com/openshift/sti-nodejs.git',
38
+ 'openshift/openldap-2441' => 'https://github.com/openshift/openldap.git',
37
39
  'openshift/perl-516' => 'https://github.com/openshift/sti-perl.git',
40
+ 'openshift/perl-520' => 'https://github.com/openshift/sti-perl.git',
38
41
  'openshift/php-55' => 'https://github.com/openshift/sti-php.git',
42
+ 'openshift/python-27' => 'https://github.com/openshift/sti-python.git',
39
43
  'openshift/python-33' => 'https://github.com/openshift/sti-python.git',
44
+ 'openshift/python-34' => 'https://github.com/openshift/sti-python.git',
40
45
  'openshift/ruby-20' => 'https://github.com/openshift/sti-ruby.git',
46
+ 'openshift/ruby-22' => 'https://github.com/openshift/sti-ruby.git',
41
47
  'openshift/mysql-55' => 'https://github.com/openshift/mysql.git',
48
+ 'openshift/mysql-56' => 'https://github.com/openshift/mysql.git',
42
49
  'openshift/mongodb-24' => 'https://github.com/openshift/mongodb.git',
43
- 'openshift/postgresql-92' => 'https://github.com/openshift/postgresql.git'
50
+ 'openshift/postgresql-92' => 'https://github.com/openshift/postgresql.git',
51
+ 'openshift/wildfly-81' => 'https://github.com/openshift/sti-wildfly.git'
44
52
  }
45
53
  end
46
54
 
@@ -16,7 +16,6 @@
16
16
  :ami_tag_prefix: openshift-centos7_
17
17
  :openstack:
18
18
  :image: <CentOS 7>
19
- :flavor: m1.small
20
19
  :ssh_user: centos
21
20
  :deps:
22
21
  :virtualbox:
@@ -34,7 +33,6 @@
34
33
  :ami_tag_prefix: devenv-centos7-base_
35
34
  :openstack:
36
35
  :image: <CentOS 7>
37
- :flavor: m1.small
38
36
  :ssh_user: centos
39
37
  :inst:
40
38
  :virtualbox:
@@ -52,7 +50,6 @@
52
50
  :ami_tag_prefix: devenv-centos7_
53
51
  :openstack:
54
52
  :image: <CentOS 7>
55
- :flavor: m1.small
56
53
  :ssh_user: centos
57
54
  :bootstrap:
58
55
  :virtualbox:
@@ -82,7 +79,6 @@
82
79
  :ami_tag_prefix: openshift-fedora_
83
80
  :openstack:
84
81
  :image: <Fedora>
85
- :flavor: m1.small
86
82
  :ssh_user: fedora
87
83
  :libvirt:
88
84
  :box_name: fedora_base
@@ -100,7 +96,6 @@
100
96
  :ami_tag_prefix: devenv-fedora-base_
101
97
  :openstack:
102
98
  :image: <Fedora>
103
- :flavor: m1.small
104
99
  :ssh_user: fedora
105
100
  :libvirt:
106
101
  :box_name: fedora_deps
@@ -118,7 +113,6 @@
118
113
  :ami_tag_prefix: devenv-fedora_
119
114
  :openstack:
120
115
  :image: <Fedora>
121
- :flavor: m1.small
122
116
  :ssh_user: fedora
123
117
  :libvirt:
124
118
  :box_name: fedora_inst
@@ -148,7 +142,6 @@
148
142
  :ami_tag_prefix: openshift-rhel7_
149
143
  :openstack:
150
144
  :image: <RHEL 7>
151
- :flavor: m1.small
152
145
  :ssh_user: root
153
146
  :deps:
154
147
  :aws:
@@ -160,7 +153,6 @@
160
153
  :ami_tag_prefix: devenv-rhel7-base_
161
154
  :openstack:
162
155
  :image: <RHEL 7>
163
- :flavor: m1.small
164
156
  :ssh_user: root
165
157
  :inst:
166
158
  :aws:
@@ -172,7 +164,6 @@
172
164
  :ami_tag_prefix: devenv-rhel7_
173
165
  :openstack:
174
166
  :image: <RHEL 7>
175
- :flavor: m1.small
176
167
  :ssh_user: root
177
168
  :bootstrap:
178
169
  :aws:
@@ -184,5 +175,4 @@
184
175
  :ami_tag_prefix: devenv-rhel7-bootstrap_
185
176
  :openstack:
186
177
  :image: <RHEL 7>
187
- :flavor: m1.small
188
178
  :ssh_user: root
@@ -16,6 +16,6 @@
16
16
 
17
17
  module Vagrant
18
18
  module Openshift
19
- VERSION = "2.0.3"
19
+ VERSION = "2.0.4"
20
20
  end
21
21
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-openshift
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3
4
+ version: 2.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Red Hat
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-26 00:00:00.000000000 Z
11
+ date: 2015-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -150,8 +150,6 @@ files:
150
150
  - lib/vagrant-openshift/action/run_sti_tests.rb
151
151
  - lib/vagrant-openshift/action/run_systemctl.rb
152
152
  - lib/vagrant-openshift/action/set_host_name.rb
153
- - lib/vagrant-openshift/action/setup_bind_dns_key.rb
154
- - lib/vagrant-openshift/action/setup_bind_host.rb
155
153
  - lib/vagrant-openshift/action/sync_local_repository.rb
156
154
  - lib/vagrant-openshift/action/sync_upstream_repository.rb
157
155
  - lib/vagrant-openshift/action/test_exit_code.rb
@@ -207,7 +205,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
207
205
  version: '0'
208
206
  requirements: []
209
207
  rubyforge_project:
210
- rubygems_version: 2.4.5
208
+ rubygems_version: 2.4.8
211
209
  signing_key:
212
210
  specification_version: 4
213
211
  summary: Vagrant plugin to manage OpenShift Origin environments
@@ -1,38 +0,0 @@
1
- #--
2
- # Copyright 2013 Red Hat, Inc.
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
- module Vagrant
18
- module Openshift
19
- module Action
20
- class SetupBindDnsKey
21
- include CommandHelper
22
-
23
- def initialize(app, env)
24
- @app = app
25
- @env = env
26
- end
27
-
28
- def call(env)
29
- domain = env[:machine].config.openshift.cloud_domain
30
-
31
- sudo(env[:machine], "rm -rf /var/named/K*.*.*")
32
- sudo(env[:machine], "/usr/sbin/dnssec-keygen -a HMAC-MD5 -b 512 -n USER -r /dev/urandom -K /var/named #{domain}")
33
- @app.call(env)
34
- end
35
- end
36
- end
37
- end
38
- end
@@ -1,141 +0,0 @@
1
- #--
2
- # Copyright 2014 Red Hat, Inc.
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
- module Vagrant
18
- module Openshift
19
- module Action
20
- class SetupBindHost
21
- include CommandHelper
22
-
23
- def initialize(app, env)
24
- @app = app
25
- @env = env
26
- end
27
-
28
- def call(env)
29
- domain = env[:machine].config.openshift.cloud_domain
30
- sudo(env[:machine], %{
31
- yum install -y bind bind-utils
32
- NAMESERVERS=$(cat /etc/resolv.conf | grep -w nameserver | cut -d' ' -f 2 )
33
- FORWARDERS=$(echo $NAMESERVERS | sed 's/ /; /g')
34
- pushd /var/named
35
- rm -rf K*.*.*
36
- /usr/sbin/dnssec-keygen -a HMAC-MD5 -b 512 -n USER -r /dev/urandom -K /var/named #{domain}
37
- KEYSTRING=$(grep Key: K#{domain}.*.private | cut -d' ' -f 2)
38
- echo 'forwarders { '$FORWARDERS'; };' > forwarders.conf
39
- echo $'key #{domain} {\n algorithm HMAC-MD5;\n secret "'$KEYSTRING$'";\n};' > #{domain}.key
40
- cat <<EOF> #{domain}.zones
41
- zone "#{domain}" IN {
42
- type master;
43
- file "dynamic/#{domain}.db";
44
- allow-update { key #{domain}; };
45
- };
46
- EOF
47
- touch dynamic/#{domain}.db
48
- cat <<EOF> dynamic/#{domain}.db
49
- \\$ORIGIN .
50
- \\$TTL 1 ; 1 seconds (for testing only)
51
- #{domain} IN SOA ns1.#{domain}. hostmaster.#{domain}. (
52
- 2011112904 ; serial
53
- 60 ; refresh (1 minute)
54
- 15 ; retry (15 seconds)
55
- 1800 ; expire (30 minutes)
56
- 10 ; minimum (10 seconds)
57
- )
58
- NS ns1.#{domain}.
59
- MX 10 mail.#{domain}.
60
- \\$ORIGIN #{domain}.
61
- mail A 127.0.0.1
62
- master A 192.168.1.1
63
- ns1 A 127.0.0.1
64
- node A 192.168.1.10
65
- ; test records
66
- testns1 TXT "reserved namespace testns1"
67
- ;testns2 TXT "to be added by tests"
68
- testns3 TXT "reserved to add apps"
69
- testns4 TXT "reserved to delete apps"
70
- testapp4-testns4 CNAME node.#{domain}.com.
71
- EOF
72
- popd
73
- pushd /etc/
74
- mv named.conf named.conf.old
75
- cat <<EOF> named.conf
76
- options {
77
- listen-on port 53 { 127.0.0.1; 172.17.42.1; };
78
- listen-on-v6 port 53 { ::1; };
79
- directory "/var/named";
80
- dump-file "/var/named/data/cache_dump.db";
81
- statistics-file "/var/named/data/named_stats.txt";
82
- memstatistics-file "/var/named/data/named_mem_stats.txt";
83
- allow-query { any; };
84
- recursion yes;
85
- dnssec-enable yes;
86
- dnssec-validation no;
87
- dnssec-lookaside auto;
88
- bindkeys-file "/etc/named.iscdlv.key";
89
- managed-keys-directory "/var/named/dynamic";
90
- pid-file "/run/named/named.pid";
91
- session-keyfile "/run/named/session.key";
92
- forward only;
93
- include "forwarders.conf";
94
- };
95
- logging {
96
- channel default_debug {
97
- file "data/named.run";
98
- severity dynamic;
99
- };
100
- };
101
- include "/etc/named.rfc1912.zones";
102
- include "/etc/named.root.key";
103
- include "/var/named/#{domain}.zones";
104
- include "#{domain}.key";
105
- EOF
106
- if ! cat /etc/dhcp/dhclient.conf | grep 'prepend domain-name-servers 172.17.42.1;' 2>&1 > /dev/null ; then
107
- echo "$(cat /etc/dhcp/dhclient.conf)\nprepend domain-name-servers 172.17.42.1;" > /etc/dhcp/dhclient.conf;
108
- fi
109
- systemctl enable named
110
- systemctl restart named
111
- service network restart
112
- systemctl restart docker
113
- BIND_CONF=#{Vagrant::Openshift::Constants.plugins_conf_dir}/dns/bind/conf
114
- mkdir -p $BIND_CONF
115
- pushd $BIND_CONF
116
- cat <<EOF> openshift-origin-dns-bind.conf
117
- # Settings related to the bind variant of an OpenShift DNS plugin
118
-
119
- # The DNS server
120
- BIND_SERVER="172.17.42.1"
121
-
122
- # The DNS server's port
123
- BIND_PORT=53
124
-
125
- # The key name for your zone
126
- BIND_KEYNAME="#{domain}"
127
-
128
- # base64-encoded key, most likely from /var/named/example.com.key.
129
- BIND_KEYVALUE="$KEYSTRING"
130
-
131
- # The base zone for the DNS server
132
- BIND_ZONE="#{domain}"
133
- EOF
134
- popd
135
- })
136
- @app.call(env)
137
- end
138
- end
139
- end
140
- end
141
- end