blob: d426d3e3f94a77298e41ebfe310d0f509fad547b [file] [log] [blame]
Tomáš Kukrálb9957b32017-02-28 14:49:00 +01001/**
2 *
3 * Launch heat stack with basic k8s
4 * Flow parameters:
5 * STACK_TYPE Orchestration engine: heat, ''
6 * INSTALL What should be installed (k8s, openstack, ...)
Tomáš Kukrál55357d02017-02-28 22:56:45 +01007 * TEST What should be tested (k8s, openstack, ...)
Tomáš Kukrálb9957b32017-02-28 14:49:00 +01008 *
9 * Expected parameters:
10 *
11 * required for STACK_TYPE=heat
12 * HEAT_TEMPLATE_URL URL to git repo with Heat templates
13 * HEAT_TEMPLATE_CREDENTIALS Credentials to the Heat templates repo
14 * HEAT_TEMPLATE_BRANCH Heat templates repo branch
15 * HEAT_STACK_TEMPLATE Heat stack HOT template
16 * HEAT_STACK_ENVIRONMENT Heat stack environmental parameters
17 * HEAT_STACK_ZONE Heat stack availability zone
18 * HEAT_STACK_PUBLIC_NET Heat stack floating IP pool
19 * HEAT_STACK_DELETE Delete Heat stack when finished (bool)
20 * HEAT_STACK_CLEANUP_JOB Name of job for deleting Heat stack
21 * HEAT_STACK_REUSE Reuse Heat stack (don't create one)
22 * OPENSTACK_API_URL OpenStack API address
23 * OPENSTACK_API_CREDENTIALS Credentials to the OpenStack API
24 * OPENSTACK_API_PROJECT OpenStack project to connect to
25 * OPENSTACK_API_CLIENT Versions of OpenStack python clients
26 * OPENSTACK_API_VERSION Version of the OpenStack API (2/3)
27 *
28 * SALT_MASTER_CREDENTIALS Credentials to the Salt API
29 *
30 * required for STACK_TYPE=NONE or empty string
31 * SALT_MASTER_URL URL of Salt-API
32
33 * K8S_API_SERVER Kubernetes API address
34 * K8S_CONFORMANCE_IMAGE Path to docker image with conformance e2e tests
35 *
36 */
37
38git = new com.mirantis.mk.Git()
39openstack = new com.mirantis.mk.Openstack()
40salt = new com.mirantis.mk.Salt()
Tomáš Kukrálb9957b32017-02-28 14:49:00 +010041
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +010042timestamps {
43 node {
Tomáš Kukrálb9957b32017-02-28 14:49:00 +010044
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +010045 //
46 // Prepare machines
47 //
Tomáš Kukrálb9957b32017-02-28 14:49:00 +010048
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +010049 stage ('Create infrastructure') {
50 if (STACK_TYPE == 'heat') {
51 // value defaults
52 def openstackCloud
53 def openstackVersion = OPENSTACK_API_CLIENT ? OPENSTACK_API_CLIENT : 'liberty'
54 def openstackEnv = "${env.WORKSPACE}/venv"
Tomáš Kukrálb9957b32017-02-28 14:49:00 +010055
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +010056 if (HEAT_STACK_NAME == '') {
57 HEAT_STACK_NAME = BUILD_TAG
Tomáš Kukrálb9957b32017-02-28 14:49:00 +010058 }
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +010059
60 // get templates
61 git.checkoutGitRepository('template', HEAT_TEMPLATE_URL, HEAT_TEMPLATE_BRANCH, HEAT_TEMPLATE_CREDENTIALS)
62
63 // create openstack env
64 openstack.setupOpenstackVirtualenv(openstackEnv, openstackVersion)
65 openstackCloud = openstack.createOpenstackEnv(OPENSTACK_API_URL, OPENSTACK_API_CREDENTIALS, OPENSTACK_API_PROJECT)
66 openstack.getKeystoneToken(openstackCloud, openstackEnv)
67
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +010068 // launch stack
69 if (HEAT_STACK_REUSE == 'false') {
70 stage('Launch new Heat stack') {
71 // create stack
72 envParams = [
73 'instance_zone': HEAT_STACK_ZONE,
74 'public_net': HEAT_STACK_PUBLIC_NET
75 ]
76 openstack.createHeatStack(openstackCloud, HEAT_STACK_NAME, HEAT_STACK_TEMPLATE, envParams, HEAT_STACK_ENVIRONMENT, openstackEnv)
77 }
78 }
79
80 // get SALT_MASTER_URL
81 saltMasterHost = openstack.getHeatStackOutputParam(openstackCloud, HEAT_STACK_NAME, 'salt_master_ip', openstackEnv)
82 SALT_MASTER_URL = "http://${saltMasterHost}:8088"
83 }
84 }
85
86 //
87 // Connect to Salt master
88 //
89
90 def saltMaster
91 stage('Connect to Salt API') {
92 saltMaster = salt.connection(SALT_MASTER_URL, SALT_MASTER_CREDENTIALS)
93 }
94
95 //
96 // Install
97 //
98
Tomáš Kukrálc265e352017-03-02 11:45:11 +010099 if (INSTALL.toLowerCase().contains('core')) {
100 stage('Install core infrastructure') {
101 // salt.master, reclass
102 // refresh_pillar
103 // sync_all
104 // linux,openssh,salt.minion.ntp
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +0100105
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100106 //orchestrate.installFoundationInfra(saltMaster)
Tomáš Kukrál97ab40b2017-03-02 11:55:55 +0100107 salt.runSaltProcessStep(saltMaster, 'I@salt:master', 'state.sls', ['salt.master,reclass'])
108 salt.runSaltProcessStep(saltMaster, 'I@linux:system', 'saltutil.refresh_pillar')
109 salt.runSaltProcessStep(saltMaster, 'I@linux:system', 'saltutil.sync_all')
110 salt.runSaltProcessStep(saltMaster, 'I@linux:system', 'state.sls', ['linux,openssh,salt.minion,ntp'])
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +0100111
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100112
113 if (INSTALL.toLowerCase().contains('kvm')) {
114 //orchestrate.installInfraKvm(saltMaster)
Tomáš Kukrál97ab40b2017-03-02 11:55:55 +0100115 salt.runSaltProcessStep(saltMaster, 'I@linux:system', 'saltutil.refresh_pillar')
116 salt.runSaltProcessStep(saltMaster, 'I@linux:system', 'saltutil.sync_all')
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100117
Tomáš Kukrál97ab40b2017-03-02 11:55:55 +0100118 salt.runSaltProcessStep(saltMaster, 'I@salt:control', 'state.sls', ['salt.minion,linux.system,linux.network,ntp'])
119 salt.enforceState(saltMaster, 'I@salt:control', 'libvirt', true)
120 salt.enforceState(saltMaster, 'I@salt:control', 'salt.control', true)
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100121
122 sleep(300)
123
Tomáš Kukrál97ab40b2017-03-02 11:55:55 +0100124 salt.runSaltProcessStep(saltMaster, '* and not kvm*', 'saltutil.refresh_pillar')
125 salt.runSaltProcessStep(saltMaster, '* and not kvm*', 'saltutil.sync_all')
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100126
127 // workaround - install apt-transport-https
Tomáš Kukrál97ab40b2017-03-02 11:55:55 +0100128 salt.runSaltProcessStep(saltMaster, '* and not kvm*', 'pkg.install', ['apt-transport-https'])
129 salt.runSaltProcessStep(saltMaster, '* and not kvm*', 'state.sls', ['linux,openssh,salt.minion,ntp'])
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100130 }
131
132 //orchestrate.validateFoundationInfra(saltMaster)
Tomáš Kukrál97ab40b2017-03-02 11:55:55 +0100133 salt.runSaltProcessStep(saltMaster, 'I@salt:master', 'cmd.run', ['salt-key'])
134 salt.runSaltProcessStep(saltMaster, 'I@salt:minion', 'test.version')
135 salt.runSaltProcessStep(saltMaster, 'I@salt:master', 'cmd.run', ['reclass-salt --top'])
136 salt.runSaltProcessStep(saltMaster, 'I@reclass:storage', 'reclass.inventory')
137 salt.runSaltProcessStep(saltMaster, 'I@salt:minion', 'state.show_top')
Tomáš Kukrálb9957b32017-02-28 14:49:00 +0100138 }
Tomáš Kukrál06c27a92017-03-01 16:21:46 +0100139 }
140
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +0100141 // install k8s
142 if (INSTALL.toLowerCase().contains('k8s')) {
143 stage('Install Kubernetes infra') {
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100144 //orchestrate.installOpenstackMcpInfra(saltMaster)
145
146 // Comment nameserver
Tomáš Kukrál97ab40b2017-03-02 11:55:55 +0100147 salt.runSaltProcessStep(saltMaster, 'I@kubernetes:master', 'cmd.run', ["sed -i 's/nameserver 10.254.0.10/#nameserver 10.254.0.10/g' /etc/resolv.conf"])
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100148
149 // Install glusterfs
Tomáš Kukrál97ab40b2017-03-02 11:55:55 +0100150 salt.runSaltProcessStep(saltMaster, 'I@glusterfs:server', 'state.sls', ['glusterfs.server.service'])
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100151
152 // Install keepalived
Tomáš Kukrál97ab40b2017-03-02 11:55:55 +0100153 salt.runSaltProcessStep(saltMaster, 'ctl01*', 'state.sls', ['keepalived'])
154 salt.runSaltProcessStep(saltMaster, 'I@keepalived:cluster', 'state.sls', ['keepalived'])
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100155
156 // Check the keepalived VIPs
Tomáš Kukrál97ab40b2017-03-02 11:55:55 +0100157 salt.runSaltProcessStep(saltMaster, 'I@keepalived:cluster', 'cmd.run', ['ip a | grep 172.16.10.2'])
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100158
159 // Setup glusterfs
Tomáš Kukrál97ab40b2017-03-02 11:55:55 +0100160 salt.runSaltProcessStep(saltMaster, 'ctl01*', 'state.sls', ['glusterfs.server.setup'])
161 salt.runSaltProcessStep(saltMaster, 'ctl02*', 'state.sls', ['glusterfs.server.setup'])
162 salt.runSaltProcessStep(saltMaster, 'ctl03*', 'state.sls', ['glusterfs.server.setup'])
163 salt.runSaltProcessStep(saltMaster, 'I@glusterfs:server', 'cmd.run', ['gluster peer status'])
164 salt.runSaltProcessStep(saltMaster, 'I@glusterfs:server', 'cmd.run', ['gluster volume status'])
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100165
166 // Install haproxy
Tomáš Kukrál97ab40b2017-03-02 11:55:55 +0100167 salt.runSaltProcessStep(saltMaster, 'I@haproxy:proxy', 'state.sls', ['haproxy'])
168 salt.runSaltProcessStep(saltMaster, 'I@haproxy:proxy', 'service.status', ['haproxy'])
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100169
170 // Install docker
Tomáš Kukrál97ab40b2017-03-02 11:55:55 +0100171 salt.runSaltProcessStep(saltMaster, 'I@docker:host', 'state.sls', ['docker.host'])
172 salt.runSaltProcessStep(saltMaster, 'I@docker:host', 'cmd.run', ['docker ps'])
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100173
174 // Install bird
Tomáš Kukrál97ab40b2017-03-02 11:55:55 +0100175 salt.runSaltProcessStep(saltMaster, 'I@bird:server', 'state.sls', ['bird'])
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100176
177 // Install etcd
Tomáš Kukrál97ab40b2017-03-02 11:55:55 +0100178 salt.runSaltProcessStep(saltMaster, 'I@etcd:server', 'state.sls', ['etcd.server.service'])
179 salt.runSaltProcessStep(saltMaster, 'I@etcd:server', 'cmd.run', ['etcdctl cluster-health'])
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100180
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +0100181 }
182
183 stage('Install Kubernetes control') {
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100184 //orchestrate.installOpenstackMcpControl(saltMaster)
185
186 // Install Kubernetes pool and Calico
Tomáš Kukrál97ab40b2017-03-02 11:55:55 +0100187 salt.runSaltProcessStep(saltMaster, 'I@kubernetes:pool', 'state.sls', ['kubernetes.pool'])
188 salt.runSaltProcessStep(saltMaster, 'I@kubernetes:pool', 'cmd.run', ['calicoctl node status'])
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100189
190 // Setup etcd server
Tomáš Kukrál97ab40b2017-03-02 11:55:55 +0100191 salt.runSaltProcessStep(saltMaster, 'I@kubernetes:master', 'state.sls', ['etcd.server.setup'])
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100192
193 // Run k8s without master.setup
Tomáš Kukrál97ab40b2017-03-02 11:55:55 +0100194 salt.runSaltProcessStep(saltMaster, 'I@kubernetes:master', 'state.sls', ['kubernetes', 'exclude=kubernetes.master.setup'])
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100195
196 // Run k8s master setup
Tomáš Kukrál97ab40b2017-03-02 11:55:55 +0100197 salt.runSaltProcessStep(saltMaster, 'ctl01*', 'state.sls', ['kubernetes.master.setup'])
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100198
199 // Revert comment nameserver
Tomáš Kukrál97ab40b2017-03-02 11:55:55 +0100200 salt.runSaltProcessStep(saltMaster, 'I@kubernetes:master', 'cmd.run', ["sed -i 's/nameserver 10.254.0.10/#nameserver 10.254.0.10/g' /etc/resolv.conf"])
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100201
202 // Set route
Tomáš Kukrál97ab40b2017-03-02 11:55:55 +0100203 salt.runSaltProcessStep(saltMaster, 'I@kubernetes:pool', 'cmd.run', ['ip r a 10.254.0.0/16 dev ens4'])
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100204
205 // Restart kubelet
Tomáš Kukrál97ab40b2017-03-02 11:55:55 +0100206 salt.runSaltProcessStep(saltMaster, 'I@kubernetes:pool', 'service.restart', ['kubelet'])
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +0100207 }
208
Tomáš Kukrálb9957b32017-02-28 14:49:00 +0100209 }
210
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +0100211 // install openstack
212 if (INSTALL.toLowerCase().contains('openstack')) {
213 // install Infra and control, tests, ...
214
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +0100215 stage('Install OpenStack infra') {
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100216 //orchestrate.installOpenstackMkInfra(saltMaster, physical)
217
218 // Install keepaliveds
219 //runSaltProcessStep(master, 'I@keepalived:cluster', 'state.sls', ['keepalived'], 1)
Tomáš Kukrál97ab40b2017-03-02 11:55:55 +0100220 salt.enforceState(saltMaster, 'ctl01*', 'keepalived', true)
221 salt.enforceState(saltMaster, 'I@keepalived:cluster', 'keepalived', true)
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100222
223 // Check the keepalived VIPs
Tomáš Kukrál97ab40b2017-03-02 11:55:55 +0100224 salt.runSaltProcessStep(saltMaster, 'I@keepalived:cluster', 'cmd.run', ['ip a | grep 172.16.10.2'])
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100225
226 // Install glusterfs
Tomáš Kukrál97ab40b2017-03-02 11:55:55 +0100227 salt.enforceState(saltMaster, 'I@glusterfs:server', 'glusterfs.server.service', true)
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100228
Tomáš Kukrál97ab40b2017-03-02 11:55:55 +0100229 //runSaltProcessStep(saltMaster, 'I@glusterfs:server', 'state.sls', ['glusterfs.server.setup'], 1)
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100230 if (INSTALL.toLowerCase().contains('kvm')) {
Tomáš Kukrál97ab40b2017-03-02 11:55:55 +0100231 salt.enforceState(saltMaster, 'ctl01*', 'glusterfs.server.setup', true)
232 salt.enforceState(saltMaster, 'ctl02*', 'glusterfs.server.setup', true)
233 salt.enforceState(saltMaster, 'ctl03*', 'glusterfs.server.setup', true)
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100234 } else {
Tomáš Kukrál97ab40b2017-03-02 11:55:55 +0100235 salt.enforceState(saltMaster, 'kvm01*', 'glusterfs.server.setup', true)
236 salt.enforceState(saltMaster, 'kvm02*', 'glusterfs.server.setup', true)
237 salt.enforceState(saltMaster, 'kvm03*', 'glusterfs.server.setup', true)
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100238 }
Tomáš Kukrál97ab40b2017-03-02 11:55:55 +0100239 salt.runSaltProcessStep(saltMaster, 'I@glusterfs:server', 'cmd.run', ['gluster peer status'])
240 salt.runSaltProcessStep(saltMaster, 'I@glusterfs:server', 'cmd.run', ['gluster volume status'])
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100241
242 // Install rabbitmq
Tomáš Kukrál97ab40b2017-03-02 11:55:55 +0100243 salt.enforceState(saltMaster, 'I@rabbitmq:server', 'rabbitmq', true)
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100244
245 // Check the rabbitmq status
Tomáš Kukrál97ab40b2017-03-02 11:55:55 +0100246 salt.runSaltProcessStep(saltMaster, 'I@rabbitmq:server', 'cmd.run', ['rabbitmqctl cluster_status'])
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100247
248 // Install galera
Tomáš Kukrál97ab40b2017-03-02 11:55:55 +0100249 salt.enforceState(saltMaster, 'I@galera:master', 'galera', true)
250 salt.enforceState(saltMaster, 'I@galera:slave', 'galera', true)
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100251
252 // Check galera status
Tomáš Kukrál97ab40b2017-03-02 11:55:55 +0100253 salt.runSaltProcessStep(saltMaster, 'I@galera:master', 'mysql.status')
254 salt.runSaltProcessStep(saltMaster, 'I@galera:slave', 'mysql.status')
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100255
256 // Install haproxy
Tomáš Kukrál97ab40b2017-03-02 11:55:55 +0100257 salt.enforceState(saltMaster, 'I@haproxy:proxy', 'haproxy', true)
258 salt.runSaltProcessStep(saltMaster, 'I@haproxy:proxy', 'service.status', ['haproxy'])
259 salt.runSaltProcessStep(saltMaster, 'I@haproxy:proxy', 'service.restart', ['rsyslog'])
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100260
261 // Install memcached
Tomáš Kukrál97ab40b2017-03-02 11:55:55 +0100262 salt.enforceState(saltMaster, 'I@memcached:server', 'memcached', true)
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100263
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +0100264 }
265
266 stage('Install OpenStack control') {
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100267 //orchestrate.installOpenstackMkControl(saltMaster)
268
269 // setup keystone service
Tomáš Kukrál97ab40b2017-03-02 11:55:55 +0100270 //runSaltProcessStep(saltMaster, 'I@keystone:server', 'state.sls', ['keystone.server'], 1)
271 salt.enforceState(saltMaster, 'ctl01*', 'keystone.server', true)
272 salt.enforceState(saltMaster, 'I@keystone:server', 'keystone.server', true)
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100273 // populate keystone services/tenants/roles/users
274
275 // keystone:client must be called locally
Tomáš Kukrál97ab40b2017-03-02 11:55:55 +0100276 salt.runSaltProcessStep(saltMaster, 'I@keystone:client', 'cmd.run', ['salt-call state.sls keystone.client'])
277 salt.runSaltProcessStep(saltMaster, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; keystone service-list'])
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100278
279 // Install glance and ensure glusterfs clusters
Tomáš Kukrál97ab40b2017-03-02 11:55:55 +0100280 //runSaltProcessStep(saltMaster, 'I@glance:server', 'state.sls', ['glance.server'], 1)
281 salt.enforceState(saltMaster, 'ctl01*', 'glance.server', true)
282 salt.enforceState(saltMaster, 'I@glance:server', 'glance.server', true)
283 salt.enforceState(saltMaster, 'I@glance:server', 'glusterfs.client', true)
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100284
285 // Update fernet tokens before doing request on keystone server
Tomáš Kukrál97ab40b2017-03-02 11:55:55 +0100286 salt.enforceState(saltMaster, 'I@keystone:server', 'keystone.server', true)
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100287
288 // Check glance service
Tomáš Kukrál97ab40b2017-03-02 11:55:55 +0100289 salt.runSaltProcessStep(saltMaster, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; glance image-list'])
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100290
291 // Install and check nova service
Tomáš Kukrál97ab40b2017-03-02 11:55:55 +0100292 //runSaltProcessStep(saltMaster, 'I@nova:controller', 'state.sls', ['nova'], 1)
293 salt.enforceState(saltMaster, 'ctl01*', 'nova', true)
294 salt.enforceState(saltMaster, 'I@nova:controller', 'nova', true)
295 salt.runSaltProcessStep(saltMaster, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; nova service-list'])
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100296
297 // Install and check cinder service
Tomáš Kukrál97ab40b2017-03-02 11:55:55 +0100298 //runSaltProcessStep(saltMaster, 'I@cinder:controller', 'state.sls', ['cinder'], 1)
299 salt.enforceState(saltMaster, 'ctl01*', 'cinder', true)
300 salt.enforceState(saltMaster, 'I@cinder:controller', 'cinder', true)
301 salt.runSaltProcessStep(saltMaster, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; cinder list'])
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100302
303 // Install neutron service
Tomáš Kukrál97ab40b2017-03-02 11:55:55 +0100304 //runSaltProcessStep(saltMaster, 'I@neutron:server', 'state.sls', ['neutron'], 1)
305 salt.enforceState(saltMaster, 'ctl01*', 'neutron', true)
306 salt.enforceState(saltMaster, 'I@neutron:server', 'neutron', true)
307 salt.runSaltProcessStep(saltMaster, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; neutron agent-list'])
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100308
309 // Install heat service
Tomáš Kukrál97ab40b2017-03-02 11:55:55 +0100310 //runSaltProcessStep(saltMaster, 'I@heat:server', 'state.sls', ['heat'], 1)
311 salt.enforceState(saltMaster, 'ctl01*', 'heat', true)
312 salt.enforceState(saltMaster, 'I@heat:server', 'heat', true)
313 salt.runSaltProcessStep(saltMaster, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; heat resource-type-list'])
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100314
315 // Install horizon dashboard
Tomáš Kukrál97ab40b2017-03-02 11:55:55 +0100316 salt.enforceState(saltMaster, 'I@horizon:server', 'horizon', true)
317 salt.enforceState(saltMaster, 'I@nginx:server', 'nginx', true)
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100318
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +0100319 }
320
321 stage('Install OpenStack network') {
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100322 //orchestrate.installOpenstackMkNetwork(saltMaster, physical)
323
324 // Install opencontrail database services
Tomáš Kukrál97ab40b2017-03-02 11:55:55 +0100325 //runSaltProcessStep(saltMaster, 'I@opencontrail:database', 'state.sls', ['opencontrail.database'], 1)
326 salt.enforceState(saltMaster, 'ntw01*', 'opencontrail.database', true)
327 salt.enforceState(saltMaster, 'I@opencontrail:database', 'opencontrail.database', true)
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100328
329 // Install opencontrail control services
Tomáš Kukrál97ab40b2017-03-02 11:55:55 +0100330 //runSaltProcessStep(saltMaster, 'I@opencontrail:control', 'state.sls', ['opencontrail'], 1)
331 salt.enforceState(saltMaster, 'ntw01*', 'opencontrail', true)
332 salt.enforceState(saltMaster, 'I@opencontrail:control', 'opencontrail', true)
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100333
334 // Provision opencontrail control services
335 if (INSTALL.toLowerCase().contains('kvm')) {
Tomáš Kukrál97ab40b2017-03-02 11:55:55 +0100336 salt.runSaltProcessStep(saltMaster, 'I@opencontrail:control:id:1', 'cmd.run', ['/usr/share/contrail-utils/provision_control.py --api_server_ip 172.16.10.254 --api_server_port 8082 --host_name ctl01 --host_ip 172.16.10.101 --router_asn 64512 --admin_password workshop --admin_user admin --admin_tenant_name admin --oper add'])
337 salt.runSaltProcessStep(saltMaster, 'I@opencontrail:control:id:1', 'cmd.run', ['/usr/share/contrail-utils/provision_control.py --api_server_ip 172.16.10.254 --api_server_port 8082 --host_name ctl02 --host_ip 172.16.10.102 --router_asn 64512 --admin_password workshop --admin_user admin --admin_tenant_name admin --oper add'])
338 salt.runSaltProcessStep(saltMaster, 'I@opencontrail:control:id:1', 'cmd.run', ['/usr/share/contrail-utils/provision_control.py --api_server_ip 172.16.10.254 --api_server_port 8082 --host_name ctl03 --host_ip 172.16.10.103 --router_asn 64512 --admin_password workshop --admin_user admin --admin_tenant_name admin --oper add'])
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100339 }
340
341 // Test opencontrail
Tomáš Kukrál97ab40b2017-03-02 11:55:55 +0100342 salt.runSaltProcessStep(saltMaster, 'I@opencontrail:control', 'cmd.run', ['contrail-status'])
343 salt.runSaltProcessStep(saltMaster, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; neutron net-list'])
344 salt.runSaltProcessStep(saltMaster, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; nova net-list'])
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +0100345 }
346
347 stage('Install OpenStack compute') {
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100348 //orchestrate.installOpenstackMkCompute(saltMaster, physical)
349 // Configure compute nodes
Tomáš Kukrál97ab40b2017-03-02 11:55:55 +0100350 salt.runSaltProcessStep(saltMaster, 'I@nova:compute', 'state.apply')
351 salt.runSaltProcessStep(saltMaster, 'I@nova:compute', 'state.apply')
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +0100352
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100353 // Provision opencontrail virtual routers
354 if (INSTALL.toLowerCase().contains('kvm')) {
Tomáš Kukrál97ab40b2017-03-02 11:55:55 +0100355 salt.runSaltProcessStep(saltMaster, 'I@opencontrail:control:id:1', 'cmd.run', ['/usr/share/contrail-utils/provision_vrouter.py --host_name cmp01 --host_ip 172.16.10.105 --api_server_ip 172.16.10.254 --oper add --admin_user admin --admin_password workshop --admin_tenant_name admin'])
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100356 }
357
Tomáš Kukrál97ab40b2017-03-02 11:55:55 +0100358 salt.runSaltProcessStep(saltMaster, 'I@nova:compute', 'system.reboot')
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100359 }
Tomáš Kukrálb9957b32017-02-28 14:49:00 +0100360 }
361
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +0100362 //
363 // Test
364 //
365
366 if (TEST.toLowerCase().contains('k8s')) {
367 stage('Run k8s bootstrap tests') {
368 orchestrate.runConformanceTests(saltMaster, K8S_API_SERVER, 'tomkukral/k8s-scripts')
369 }
370
371 stage('Run k8s conformance e2e tests') {
372 orchestrate.runConformanceTests(saltMaster, K8S_API_SERVER, K8S_CONFORMANCE_IMAGE)
373 }
Tomáš Kukrálb9957b32017-02-28 14:49:00 +0100374 }
375
Tomáš Kukrálb9957b32017-02-28 14:49:00 +0100376
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +0100377 //
378 // Clean
379 //
Tomáš Kukrálb9957b32017-02-28 14:49:00 +0100380
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +0100381 if (HEAT_STACK_DELETE == 'true' && STACK_TYPE == 'heat') {
382 stage('Trigger cleanup job') {
383 build job: 'deploy_heat_cleanup', parameters: [[$class: 'StringParameterValue', name: 'HEAT_STACK_NAME', value: HEAT_STACK_NAME]]
384 }
Tomáš Kukrálb9957b32017-02-28 14:49:00 +0100385 }
386 }
387}