Tomáš Kukrál | b9957b3 | 2017-02-28 14:49:00 +0100 | [diff] [blame] | 1 | /** |
| 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ál | 55357d0 | 2017-02-28 22:56:45 +0100 | [diff] [blame] | 7 | * TEST What should be tested (k8s, openstack, ...) |
Tomáš Kukrál | b9957b3 | 2017-02-28 14:49:00 +0100 | [diff] [blame] | 8 | * |
| 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 | |
| 38 | git = new com.mirantis.mk.Git() |
| 39 | openstack = new com.mirantis.mk.Openstack() |
| 40 | salt = new com.mirantis.mk.Salt() |
Tomáš Kukrál | 3e4029d | 2017-03-07 09:59:40 +0100 | [diff] [blame] | 41 | common = new com.mirantis.mk.Common() |
Tomáš Kukrál | b9957b3 | 2017-02-28 14:49:00 +0100 | [diff] [blame] | 42 | |
Tomáš Kukrál | e80680a | 2017-03-02 16:34:35 +0100 | [diff] [blame] | 43 | |
Tomáš Kukrál | 9e0fb73 | 2017-03-02 10:12:05 +0100 | [diff] [blame] | 44 | timestamps { |
| 45 | node { |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 46 | try { |
Tomáš Kukrál | e80680a | 2017-03-02 16:34:35 +0100 | [diff] [blame] | 47 | |
| 48 | |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 49 | // |
| 50 | // Prepare machines |
| 51 | // |
Tomáš Kukrál | b9957b3 | 2017-02-28 14:49:00 +0100 | [diff] [blame] | 52 | |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 53 | stage ('Create infrastructure') { |
| 54 | if (STACK_TYPE == 'heat') { |
| 55 | // value defaults |
| 56 | def openstackCloud |
| 57 | def openstackVersion = OPENSTACK_API_CLIENT ? OPENSTACK_API_CLIENT : 'liberty' |
| 58 | def openstackEnv = "${env.WORKSPACE}/venv" |
Tomáš Kukrál | b9957b3 | 2017-02-28 14:49:00 +0100 | [diff] [blame] | 59 | |
Filip Pytloun | 794ad95 | 2017-03-03 10:39:26 +0100 | [diff] [blame] | 60 | if (HEAT_STACK_REUSE.toBoolean() == true && HEAT_STACK_NAME == '') { |
| 61 | error("If you want to reuse existing stack you need to provide it's name") |
| 62 | } |
| 63 | |
| 64 | if (HEAT_STACK_REUSE.toBoolean() == false) { |
| 65 | // Don't allow to set custom heat stack name |
| 66 | wrap([$class: 'BuildUser']) { |
Tomáš Kukrál | 24d7fe6 | 2017-03-03 10:57:11 +0100 | [diff] [blame] | 67 | if (env.BUILD_USER_ID) { |
| 68 | HEAT_STACK_NAME = "${env.BUILD_USER_ID}-${JOB_NAME}-${BUILD_NUMBER}" |
| 69 | } else { |
| 70 | HEAT_STACK_NAME = "jenkins-${JOB_NAME}-${BUILD_NUMBER}" |
| 71 | } |
Filip Pytloun | 794ad95 | 2017-03-03 10:39:26 +0100 | [diff] [blame] | 72 | currentBuild.description = HEAT_STACK_NAME |
| 73 | } |
Tomáš Kukrál | 9e0fb73 | 2017-03-02 10:12:05 +0100 | [diff] [blame] | 74 | } |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 75 | |
Tomáš Kukrál | cbabec4 | 2017-03-02 16:24:04 +0100 | [diff] [blame] | 76 | // set description |
Tomáš Kukrál | aeb5c92 | 2017-03-02 17:00:48 +0100 | [diff] [blame] | 77 | currentBuild.description = "${HEAT_STACK_NAME}" |
Tomáš Kukrál | cbabec4 | 2017-03-02 16:24:04 +0100 | [diff] [blame] | 78 | |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 79 | // get templates |
| 80 | git.checkoutGitRepository('template', HEAT_TEMPLATE_URL, HEAT_TEMPLATE_BRANCH, HEAT_TEMPLATE_CREDENTIALS) |
| 81 | |
| 82 | // create openstack env |
| 83 | openstack.setupOpenstackVirtualenv(openstackEnv, openstackVersion) |
| 84 | openstackCloud = openstack.createOpenstackEnv(OPENSTACK_API_URL, OPENSTACK_API_CREDENTIALS, OPENSTACK_API_PROJECT) |
| 85 | openstack.getKeystoneToken(openstackCloud, openstackEnv) |
| 86 | |
| 87 | // launch stack |
Filip Pytloun | 794ad95 | 2017-03-03 10:39:26 +0100 | [diff] [blame] | 88 | if (HEAT_STACK_REUSE.toBoolean() == false) { |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 89 | stage('Launch new Heat stack') { |
| 90 | // create stack |
| 91 | envParams = [ |
| 92 | 'instance_zone': HEAT_STACK_ZONE, |
| 93 | 'public_net': HEAT_STACK_PUBLIC_NET |
| 94 | ] |
| 95 | openstack.createHeatStack(openstackCloud, HEAT_STACK_NAME, HEAT_STACK_TEMPLATE, envParams, HEAT_STACK_ENVIRONMENT, openstackEnv) |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | // get SALT_MASTER_URL |
| 100 | saltMasterHost = openstack.getHeatStackOutputParam(openstackCloud, HEAT_STACK_NAME, 'salt_master_ip', openstackEnv) |
Tomáš Kukrál | aeb5c92 | 2017-03-02 17:00:48 +0100 | [diff] [blame] | 101 | currentBuild.description = "${HEAT_STACK_NAME}: ${saltMasterHost}" |
Tomáš Kukrál | 615aa9c | 2017-03-04 15:29:08 +0100 | [diff] [blame] | 102 | |
| 103 | if (INSTALL.toLowerCase().contains('kvm')) { |
Tomáš Kukrál | 6150929 | 2017-03-04 16:27:07 +0100 | [diff] [blame] | 104 | saltPort = 8088 |
Tomáš Kukrál | 615aa9c | 2017-03-04 15:29:08 +0100 | [diff] [blame] | 105 | } else { |
Tomáš Kukrál | 6150929 | 2017-03-04 16:27:07 +0100 | [diff] [blame] | 106 | saltPort = 8000 |
Tomáš Kukrál | 615aa9c | 2017-03-04 15:29:08 +0100 | [diff] [blame] | 107 | } |
| 108 | |
Tomáš Kukrál | 6150929 | 2017-03-04 16:27:07 +0100 | [diff] [blame] | 109 | SALT_MASTER_URL = "http://${saltMasterHost}:${saltPort}" |
Tomáš Kukrál | 9e0fb73 | 2017-03-02 10:12:05 +0100 | [diff] [blame] | 110 | } |
Tomáš Kukrál | 9e0fb73 | 2017-03-02 10:12:05 +0100 | [diff] [blame] | 111 | } |
Tomáš Kukrál | 9e0fb73 | 2017-03-02 10:12:05 +0100 | [diff] [blame] | 112 | |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 113 | // |
| 114 | // Connect to Salt master |
| 115 | // |
Tomáš Kukrál | 9e0fb73 | 2017-03-02 10:12:05 +0100 | [diff] [blame] | 116 | |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 117 | def saltMaster |
| 118 | stage('Connect to Salt API') { |
| 119 | saltMaster = salt.connection(SALT_MASTER_URL, SALT_MASTER_CREDENTIALS) |
| 120 | } |
Tomáš Kukrál | 9e0fb73 | 2017-03-02 10:12:05 +0100 | [diff] [blame] | 121 | |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 122 | // |
| 123 | // Install |
| 124 | // |
Tomáš Kukrál | 9e0fb73 | 2017-03-02 10:12:05 +0100 | [diff] [blame] | 125 | |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 126 | if (INSTALL.toLowerCase().contains('core')) { |
| 127 | stage('Install core infrastructure') { |
| 128 | // salt.master, reclass |
| 129 | // refresh_pillar |
| 130 | // sync_all |
| 131 | // linux,openssh,salt.minion.ntp |
Tomáš Kukrál | 9e0fb73 | 2017-03-02 10:12:05 +0100 | [diff] [blame] | 132 | |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 133 | //orchestrate.installFoundationInfra(saltMaster) |
Tomáš Kukrál | cbdb1d0 | 2017-03-02 16:08:51 +0100 | [diff] [blame] | 134 | salt.enforceState(saltMaster, 'I@salt:master', ['salt.master', 'reclass'], true) |
Tomáš Kukrál | 01f284a | 2017-03-02 23:14:20 +0100 | [diff] [blame] | 135 | salt.runSaltProcessStep(saltMaster, 'I@linux:system', 'saltutil.refresh_pillar', [], null, true) |
| 136 | salt.runSaltProcessStep(saltMaster, 'I@linux:system', 'saltutil.sync_all', [], null, true) |
Tomáš Kukrál | cbdb1d0 | 2017-03-02 16:08:51 +0100 | [diff] [blame] | 137 | salt.enforceState(saltMaster, 'I@linux:system', ['linux', 'openssh', 'salt.minion', 'ntp'], true) |
Tomáš Kukrál | c265e35 | 2017-03-02 11:45:11 +0100 | [diff] [blame] | 138 | |
Tomáš Kukrál | c265e35 | 2017-03-02 11:45:11 +0100 | [diff] [blame] | 139 | |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 140 | if (INSTALL.toLowerCase().contains('kvm')) { |
| 141 | //orchestrate.installInfraKvm(saltMaster) |
Tomáš Kukrál | 01f284a | 2017-03-02 23:14:20 +0100 | [diff] [blame] | 142 | salt.runSaltProcessStep(saltMaster, 'I@linux:system', 'saltutil.refresh_pillar', [], null, true) |
| 143 | salt.runSaltProcessStep(saltMaster, 'I@linux:system', 'saltutil.sync_all', [], null, true) |
Tomáš Kukrál | c265e35 | 2017-03-02 11:45:11 +0100 | [diff] [blame] | 144 | |
Tomáš Kukrál | cbdb1d0 | 2017-03-02 16:08:51 +0100 | [diff] [blame] | 145 | salt.enforceState(saltMaster, 'I@salt:control', ['salt.minion', 'linux.system', 'linux.network', 'ntp'], true) |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 146 | salt.enforceState(saltMaster, 'I@salt:control', 'libvirt', true) |
| 147 | salt.enforceState(saltMaster, 'I@salt:control', 'salt.control', true) |
Tomáš Kukrál | c265e35 | 2017-03-02 11:45:11 +0100 | [diff] [blame] | 148 | |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 149 | sleep(300) |
| 150 | |
Tomáš Kukrál | 01f284a | 2017-03-02 23:14:20 +0100 | [diff] [blame] | 151 | salt.runSaltProcessStep(saltMaster, '* and not kvm*', 'saltutil.refresh_pillar', [], null, true) |
| 152 | salt.runSaltProcessStep(saltMaster, '* and not kvm*', 'saltutil.sync_all', [], null, true) |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 153 | |
| 154 | // workaround - install apt-transport-https |
Tomáš Kukrál | 5c83788 | 2017-03-03 00:54:13 +0100 | [diff] [blame] | 155 | salt.runSaltProcessStep(saltMaster, '* and not kvm*', 'cmd.run', ['apt-get update -y && apt-get install -y apt-transport-https'], null, true) |
Tomáš Kukrál | 677b423 | 2017-03-02 23:31:12 +0100 | [diff] [blame] | 156 | salt.runSaltProcessStep(saltMaster, '* and not kvm*', 'pkg.install', ['apt-transport-https', 'refresh=True'], null, true) |
Tomáš Kukrál | cbdb1d0 | 2017-03-02 16:08:51 +0100 | [diff] [blame] | 157 | salt.enforceState(saltMaster, 'I@linux:system', ['linux', 'openssh', 'salt.minion', 'ntp'], true) |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 158 | } |
| 159 | |
| 160 | //orchestrate.validateFoundationInfra(saltMaster) |
Tomáš Kukrál | cbdb1d0 | 2017-03-02 16:08:51 +0100 | [diff] [blame] | 161 | salt.runSaltProcessStep(saltMaster, 'I@salt:master', 'cmd.run', ['salt-key'], null, true) |
Tomáš Kukrál | 01f284a | 2017-03-02 23:14:20 +0100 | [diff] [blame] | 162 | salt.runSaltProcessStep(saltMaster, 'I@salt:minion', 'test.version', [], null, true) |
Tomáš Kukrál | cbdb1d0 | 2017-03-02 16:08:51 +0100 | [diff] [blame] | 163 | salt.runSaltProcessStep(saltMaster, 'I@salt:master', 'cmd.run', ['reclass-salt --top'], null, true) |
Tomáš Kukrál | 01f284a | 2017-03-02 23:14:20 +0100 | [diff] [blame] | 164 | salt.runSaltProcessStep(saltMaster, 'I@reclass:storage', 'reclass.inventory', [], null, true) |
| 165 | salt.runSaltProcessStep(saltMaster, 'I@salt:minion', 'state.show_top', [], null, true) |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 166 | } |
| 167 | } |
| 168 | |
| 169 | // install k8s |
| 170 | if (INSTALL.toLowerCase().contains('k8s')) { |
| 171 | stage('Install Kubernetes infra') { |
| 172 | //orchestrate.installOpenstackMcpInfra(saltMaster) |
| 173 | |
| 174 | // Comment nameserver |
| 175 | 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"]) |
| 176 | |
| 177 | // Install glusterfs |
| 178 | salt.runSaltProcessStep(saltMaster, 'I@glusterfs:server', 'state.sls', ['glusterfs.server.service']) |
| 179 | |
| 180 | // Install keepalived |
| 181 | salt.runSaltProcessStep(saltMaster, 'ctl01*', 'state.sls', ['keepalived']) |
| 182 | salt.runSaltProcessStep(saltMaster, 'I@keepalived:cluster', 'state.sls', ['keepalived']) |
| 183 | |
| 184 | // Check the keepalived VIPs |
| 185 | salt.runSaltProcessStep(saltMaster, 'I@keepalived:cluster', 'cmd.run', ['ip a | grep 172.16.10.2']) |
| 186 | |
| 187 | // Setup glusterfs |
| 188 | salt.runSaltProcessStep(saltMaster, 'ctl01*', 'state.sls', ['glusterfs.server.setup']) |
| 189 | salt.runSaltProcessStep(saltMaster, 'ctl02*', 'state.sls', ['glusterfs.server.setup']) |
| 190 | salt.runSaltProcessStep(saltMaster, 'ctl03*', 'state.sls', ['glusterfs.server.setup']) |
| 191 | salt.runSaltProcessStep(saltMaster, 'I@glusterfs:server', 'cmd.run', ['gluster peer status']) |
| 192 | salt.runSaltProcessStep(saltMaster, 'I@glusterfs:server', 'cmd.run', ['gluster volume status']) |
| 193 | |
| 194 | // Install haproxy |
| 195 | salt.runSaltProcessStep(saltMaster, 'I@haproxy:proxy', 'state.sls', ['haproxy']) |
| 196 | salt.runSaltProcessStep(saltMaster, 'I@haproxy:proxy', 'service.status', ['haproxy']) |
| 197 | |
| 198 | // Install docker |
| 199 | salt.runSaltProcessStep(saltMaster, 'I@docker:host', 'state.sls', ['docker.host']) |
| 200 | salt.runSaltProcessStep(saltMaster, 'I@docker:host', 'cmd.run', ['docker ps']) |
| 201 | |
| 202 | // Install bird |
| 203 | salt.runSaltProcessStep(saltMaster, 'I@bird:server', 'state.sls', ['bird']) |
| 204 | |
| 205 | // Install etcd |
| 206 | salt.runSaltProcessStep(saltMaster, 'I@etcd:server', 'state.sls', ['etcd.server.service']) |
| 207 | salt.runSaltProcessStep(saltMaster, 'I@etcd:server', 'cmd.run', ['etcdctl cluster-health']) |
| 208 | |
Tomáš Kukrál | c265e35 | 2017-03-02 11:45:11 +0100 | [diff] [blame] | 209 | } |
| 210 | |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 211 | stage('Install Kubernetes control') { |
| 212 | //orchestrate.installOpenstackMcpControl(saltMaster) |
Tomáš Kukrál | 06c27a9 | 2017-03-01 16:21:46 +0100 | [diff] [blame] | 213 | |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 214 | // Install Kubernetes pool and Calico |
| 215 | salt.runSaltProcessStep(saltMaster, 'I@kubernetes:pool', 'state.sls', ['kubernetes.pool']) |
| 216 | salt.runSaltProcessStep(saltMaster, 'I@kubernetes:pool', 'cmd.run', ['calicoctl node status']) |
Tomáš Kukrál | c265e35 | 2017-03-02 11:45:11 +0100 | [diff] [blame] | 217 | |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 218 | // Setup etcd server |
| 219 | salt.runSaltProcessStep(saltMaster, 'I@kubernetes:master', 'state.sls', ['etcd.server.setup']) |
Tomáš Kukrál | c265e35 | 2017-03-02 11:45:11 +0100 | [diff] [blame] | 220 | |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 221 | // Run k8s without master.setup |
| 222 | salt.runSaltProcessStep(saltMaster, 'I@kubernetes:master', 'state.sls', ['kubernetes', 'exclude=kubernetes.master.setup']) |
Tomáš Kukrál | c265e35 | 2017-03-02 11:45:11 +0100 | [diff] [blame] | 223 | |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 224 | // Run k8s master setup |
| 225 | salt.runSaltProcessStep(saltMaster, 'ctl01*', 'state.sls', ['kubernetes.master.setup']) |
Tomáš Kukrál | c265e35 | 2017-03-02 11:45:11 +0100 | [diff] [blame] | 226 | |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 227 | // Revert comment nameserver |
| 228 | 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ál | c265e35 | 2017-03-02 11:45:11 +0100 | [diff] [blame] | 229 | |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 230 | // Set route |
| 231 | salt.runSaltProcessStep(saltMaster, 'I@kubernetes:pool', 'cmd.run', ['ip r a 10.254.0.0/16 dev ens4']) |
Tomáš Kukrál | c265e35 | 2017-03-02 11:45:11 +0100 | [diff] [blame] | 232 | |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 233 | // Restart kubelet |
| 234 | salt.runSaltProcessStep(saltMaster, 'I@kubernetes:pool', 'service.restart', ['kubelet']) |
Tomáš Kukrál | c265e35 | 2017-03-02 11:45:11 +0100 | [diff] [blame] | 235 | } |
| 236 | |
Tomáš Kukrál | 9e0fb73 | 2017-03-02 10:12:05 +0100 | [diff] [blame] | 237 | } |
| 238 | |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 239 | // install openstack |
| 240 | if (INSTALL.toLowerCase().contains('openstack')) { |
| 241 | // install Infra and control, tests, ... |
Tomáš Kukrál | 9e0fb73 | 2017-03-02 10:12:05 +0100 | [diff] [blame] | 242 | |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 243 | stage('Install OpenStack infra') { |
| 244 | //orchestrate.installOpenstackMkInfra(saltMaster, physical) |
| 245 | |
| 246 | // Install keepaliveds |
| 247 | //runSaltProcessStep(master, 'I@keepalived:cluster', 'state.sls', ['keepalived'], 1) |
| 248 | salt.enforceState(saltMaster, 'ctl01*', 'keepalived', true) |
| 249 | salt.enforceState(saltMaster, 'I@keepalived:cluster', 'keepalived', true) |
| 250 | |
| 251 | // Check the keepalived VIPs |
| 252 | salt.runSaltProcessStep(saltMaster, 'I@keepalived:cluster', 'cmd.run', ['ip a | grep 172.16.10.2']) |
| 253 | |
| 254 | // Install glusterfs |
| 255 | salt.enforceState(saltMaster, 'I@glusterfs:server', 'glusterfs.server.service', true) |
| 256 | |
| 257 | //runSaltProcessStep(saltMaster, 'I@glusterfs:server', 'state.sls', ['glusterfs.server.setup'], 1) |
| 258 | if (INSTALL.toLowerCase().contains('kvm')) { |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 259 | salt.enforceState(saltMaster, 'kvm01*', 'glusterfs.server.setup', true) |
| 260 | salt.enforceState(saltMaster, 'kvm02*', 'glusterfs.server.setup', true) |
| 261 | salt.enforceState(saltMaster, 'kvm03*', 'glusterfs.server.setup', true) |
Tomáš Kukrál | bad54bb | 2017-03-02 15:46:20 +0100 | [diff] [blame] | 262 | } else { |
| 263 | salt.enforceState(saltMaster, 'ctl01*', 'glusterfs.server.setup', true) |
| 264 | salt.enforceState(saltMaster, 'ctl02*', 'glusterfs.server.setup', true) |
| 265 | salt.enforceState(saltMaster, 'ctl03*', 'glusterfs.server.setup', true) |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 266 | } |
| 267 | |
Tomáš Kukrál | cbdb1d0 | 2017-03-02 16:08:51 +0100 | [diff] [blame] | 268 | salt.runSaltProcessStep(saltMaster, 'I@glusterfs:server', 'cmd.run', ['gluster peer status'], null, true) |
| 269 | salt.runSaltProcessStep(saltMaster, 'I@glusterfs:server', 'cmd.run', ['gluster volume status'], null, true) |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 270 | |
| 271 | // Install rabbitmq |
| 272 | salt.enforceState(saltMaster, 'I@rabbitmq:server', 'rabbitmq', true) |
| 273 | |
| 274 | // Check the rabbitmq status |
Ales Komarek | 96ff9ed | 2017-03-02 18:37:51 +0100 | [diff] [blame] | 275 | salt.runSaltProcessStep(saltMaster, 'I@rabbitmq:server', 'cmd.run', ['rabbitmqctl cluster_status']) |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 276 | |
| 277 | // Install galera |
| 278 | salt.enforceState(saltMaster, 'I@galera:master', 'galera', true) |
| 279 | salt.enforceState(saltMaster, 'I@galera:slave', 'galera', true) |
| 280 | |
| 281 | // Check galera status |
Ales Komarek | 96ff9ed | 2017-03-02 18:37:51 +0100 | [diff] [blame] | 282 | salt.runSaltProcessStep(saltMaster, 'I@galera:master', 'mysql.status') |
| 283 | salt.runSaltProcessStep(saltMaster, 'I@galera:slave', 'mysql.status') |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 284 | |
Tomáš Kukrál | aa8f553 | 2017-03-07 13:34:39 +0100 | [diff] [blame^] | 285 | // Setup mysql client |
| 286 | salt.enforceState(saltMaster, 'I@galera:master', 'mysql.client', true) |
| 287 | |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 288 | // Install haproxy |
| 289 | salt.enforceState(saltMaster, 'I@haproxy:proxy', 'haproxy', true) |
Ales Komarek | 96ff9ed | 2017-03-02 18:37:51 +0100 | [diff] [blame] | 290 | salt.runSaltProcessStep(saltMaster, 'I@haproxy:proxy', 'service.status', ['haproxy']) |
| 291 | salt.runSaltProcessStep(saltMaster, 'I@haproxy:proxy', 'service.restart', ['rsyslog']) |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 292 | |
| 293 | // Install memcached |
| 294 | salt.enforceState(saltMaster, 'I@memcached:server', 'memcached', true) |
| 295 | |
Tomáš Kukrál | c265e35 | 2017-03-02 11:45:11 +0100 | [diff] [blame] | 296 | } |
| 297 | |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 298 | stage('Install OpenStack control') { |
| 299 | //orchestrate.installOpenstackMkControl(saltMaster) |
Tomáš Kukrál | b9957b3 | 2017-02-28 14:49:00 +0100 | [diff] [blame] | 300 | |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 301 | // setup keystone service |
| 302 | //runSaltProcessStep(saltMaster, 'I@keystone:server', 'state.sls', ['keystone.server'], 1) |
| 303 | salt.enforceState(saltMaster, 'ctl01*', 'keystone.server', true) |
| 304 | salt.enforceState(saltMaster, 'I@keystone:server', 'keystone.server', true) |
| 305 | // populate keystone services/tenants/roles/users |
Tomáš Kukrál | 9e0fb73 | 2017-03-02 10:12:05 +0100 | [diff] [blame] | 306 | |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 307 | // keystone:client must be called locally |
Tomáš Kukrál | cbdb1d0 | 2017-03-02 16:08:51 +0100 | [diff] [blame] | 308 | salt.runSaltProcessStep(saltMaster, 'I@keystone:client', 'cmd.run', ['salt-call state.sls keystone.client'], null, true) |
| 309 | salt.runSaltProcessStep(saltMaster, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; keystone service-list'], null, true) |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 310 | |
| 311 | // Install glance and ensure glusterfs clusters |
| 312 | //runSaltProcessStep(saltMaster, 'I@glance:server', 'state.sls', ['glance.server'], 1) |
| 313 | salt.enforceState(saltMaster, 'ctl01*', 'glance.server', true) |
| 314 | salt.enforceState(saltMaster, 'I@glance:server', 'glance.server', true) |
| 315 | salt.enforceState(saltMaster, 'I@glance:server', 'glusterfs.client', true) |
| 316 | |
| 317 | // Update fernet tokens before doing request on keystone server |
| 318 | salt.enforceState(saltMaster, 'I@keystone:server', 'keystone.server', true) |
| 319 | |
| 320 | // Check glance service |
Tomáš Kukrál | cbdb1d0 | 2017-03-02 16:08:51 +0100 | [diff] [blame] | 321 | salt.runSaltProcessStep(saltMaster, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; glance image-list'], null, true) |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 322 | |
| 323 | // Install and check nova service |
| 324 | //runSaltProcessStep(saltMaster, 'I@nova:controller', 'state.sls', ['nova'], 1) |
| 325 | salt.enforceState(saltMaster, 'ctl01*', 'nova', true) |
| 326 | salt.enforceState(saltMaster, 'I@nova:controller', 'nova', true) |
Tomáš Kukrál | cbdb1d0 | 2017-03-02 16:08:51 +0100 | [diff] [blame] | 327 | salt.runSaltProcessStep(saltMaster, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; nova service-list'], null, true) |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 328 | |
| 329 | // Install and check cinder service |
| 330 | //runSaltProcessStep(saltMaster, 'I@cinder:controller', 'state.sls', ['cinder'], 1) |
| 331 | salt.enforceState(saltMaster, 'ctl01*', 'cinder', true) |
| 332 | salt.enforceState(saltMaster, 'I@cinder:controller', 'cinder', true) |
Tomáš Kukrál | cbdb1d0 | 2017-03-02 16:08:51 +0100 | [diff] [blame] | 333 | salt.runSaltProcessStep(saltMaster, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; cinder list'], null, true) |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 334 | |
| 335 | // Install neutron service |
| 336 | //runSaltProcessStep(saltMaster, 'I@neutron:server', 'state.sls', ['neutron'], 1) |
Tomáš Kukrál | 575e38a | 2017-03-02 17:12:45 +0100 | [diff] [blame] | 337 | if (INSTALL.toLowerCase().contains('kvm')) { |
| 338 | salt.enforceState(saltMaster, 'ntw01*', 'neutron', true) |
| 339 | } else { |
| 340 | salt.enforceState(saltMaster, 'ctl01*', 'neutron', true) |
| 341 | } |
| 342 | |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 343 | salt.enforceState(saltMaster, 'I@neutron:server', 'neutron', true) |
Tomáš Kukrál | cbdb1d0 | 2017-03-02 16:08:51 +0100 | [diff] [blame] | 344 | salt.runSaltProcessStep(saltMaster, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; neutron agent-list'], null, true) |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 345 | |
| 346 | // Install heat service |
| 347 | //runSaltProcessStep(saltMaster, 'I@heat:server', 'state.sls', ['heat'], 1) |
| 348 | salt.enforceState(saltMaster, 'ctl01*', 'heat', true) |
| 349 | salt.enforceState(saltMaster, 'I@heat:server', 'heat', true) |
Tomáš Kukrál | cbdb1d0 | 2017-03-02 16:08:51 +0100 | [diff] [blame] | 350 | salt.runSaltProcessStep(saltMaster, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; heat resource-type-list'], null, true) |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 351 | |
| 352 | // Install horizon dashboard |
| 353 | salt.enforceState(saltMaster, 'I@horizon:server', 'horizon', true) |
| 354 | salt.enforceState(saltMaster, 'I@nginx:server', 'nginx', true) |
| 355 | |
| 356 | } |
| 357 | |
| 358 | stage('Install OpenStack network') { |
| 359 | //orchestrate.installOpenstackMkNetwork(saltMaster, physical) |
| 360 | |
| 361 | // Install opencontrail database services |
| 362 | //runSaltProcessStep(saltMaster, 'I@opencontrail:database', 'state.sls', ['opencontrail.database'], 1) |
| 363 | salt.enforceState(saltMaster, 'ntw01*', 'opencontrail.database', true) |
| 364 | salt.enforceState(saltMaster, 'I@opencontrail:database', 'opencontrail.database', true) |
| 365 | |
| 366 | // Install opencontrail control services |
| 367 | //runSaltProcessStep(saltMaster, 'I@opencontrail:control', 'state.sls', ['opencontrail'], 1) |
| 368 | salt.enforceState(saltMaster, 'ntw01*', 'opencontrail', true) |
| 369 | salt.enforceState(saltMaster, 'I@opencontrail:control', 'opencontrail', true) |
Tomáš Kukrál | 3b8ad5e | 2017-03-02 23:03:27 +0100 | [diff] [blame] | 370 | salt.enforceState(saltMaster, 'I@opencontrail:collector', 'opencontrail', true) |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 371 | |
| 372 | // Provision opencontrail control services |
| 373 | if (INSTALL.toLowerCase().contains('kvm')) { |
Tomáš Kukrál | 575e38a | 2017-03-02 17:12:45 +0100 | [diff] [blame] | 374 | salt.runSaltProcessStep(saltMaster, 'I@opencontrail:control:id:1', 'cmd.run', ['/usr/share/contrail-utils/provision_control.py --api_server_ip 10.167.4.20 --api_server_port 8082 --host_name ntw01 --host_ip 10.167.4.21 --router_asn 64512 --admin_password password --admin_user admin --admin_tenant_name admin --oper add'], null, true) |
| 375 | salt.runSaltProcessStep(saltMaster, 'I@opencontrail:control:id:1', 'cmd.run', ['/usr/share/contrail-utils/provision_control.py --api_server_ip 10.167.4.20 --api_server_port 8082 --host_name ntw02 --host_ip 10.167.4.22 --router_asn 64512 --admin_password password --admin_user admin --admin_tenant_name admin --oper add'], null, true) |
| 376 | salt.runSaltProcessStep(saltMaster, 'I@opencontrail:control:id:1', 'cmd.run', ['/usr/share/contrail-utils/provision_control.py --api_server_ip 10.167.4.20 --api_server_port 8082 --host_name ntw03 --host_ip 10.167.4.23 --router_asn 64512 --admin_password password --admin_user admin --admin_tenant_name admin --oper add'], null, true) |
| 377 | } else { |
Tomáš Kukrál | cbdb1d0 | 2017-03-02 16:08:51 +0100 | [diff] [blame] | 378 | 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'], null, true) |
| 379 | 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'], null, true) |
| 380 | 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'], null, true) |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 381 | } |
| 382 | |
| 383 | // Test opencontrail |
Tomáš Kukrál | cbdb1d0 | 2017-03-02 16:08:51 +0100 | [diff] [blame] | 384 | salt.runSaltProcessStep(saltMaster, 'I@opencontrail:control', 'cmd.run', ['contrail-status'], null, true) |
| 385 | salt.runSaltProcessStep(saltMaster, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; neutron net-list'], null, true) |
| 386 | salt.runSaltProcessStep(saltMaster, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; nova net-list'], null, true) |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 387 | } |
| 388 | |
| 389 | stage('Install OpenStack compute') { |
| 390 | //orchestrate.installOpenstackMkCompute(saltMaster, physical) |
| 391 | // Configure compute nodes |
Tomáš Kukrál | da26d90 | 2017-03-02 22:19:00 +0100 | [diff] [blame] | 392 | retry(2) { |
Tomáš Kukrál | 02cda9f | 2017-03-02 22:32:57 +0100 | [diff] [blame] | 393 | salt.runSaltProcessStep(saltMaster, 'I@nova:compute', 'state.apply', [], null, true) |
Tomáš Kukrál | da26d90 | 2017-03-02 22:19:00 +0100 | [diff] [blame] | 394 | } |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 395 | |
| 396 | // Provision opencontrail virtual routers |
| 397 | if (INSTALL.toLowerCase().contains('kvm')) { |
Tomáš Kukrál | 834fe21 | 2017-03-02 22:50:49 +0100 | [diff] [blame] | 398 | salt.runSaltProcessStep(saltMaster, 'I@opencontrail:control:id:1', 'cmd.run', ['/usr/share/contrail-utils/provision_vrouter.py --host_name cmp001 --host_ip 10.167.4.101 --api_server_ip 10.167.4.20 --oper add --admin_user admin --admin_password password --admin_tenant_name admin'], null, true) |
Tomáš Kukrál | 575e38a | 2017-03-02 17:12:45 +0100 | [diff] [blame] | 399 | } else { |
Tomáš Kukrál | cbdb1d0 | 2017-03-02 16:08:51 +0100 | [diff] [blame] | 400 | 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'], null, true) |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 401 | } |
| 402 | |
Tomáš Kukrál | d853c9b | 2017-03-06 14:35:07 +0100 | [diff] [blame] | 403 | salt.runSaltProcessStep(saltMaster, 'I@nova:compute', 'cmd.run', ['exec 0>&-; exec 1>&-; exec 2>&-; nohup bash -c "ip link | grep vhost && echo no_reboot || sleep 5 && reboot & "'], null, true) |
| 404 | sleep(120) |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 405 | } |
Tomáš Kukrál | 2b4c128 | 2017-03-03 17:25:26 +0100 | [diff] [blame] | 406 | |
Tomáš Kukrál | 00ed130 | 2017-03-03 17:38:40 +0100 | [diff] [blame] | 407 | } |
Tomáš Kukrál | 2b4c128 | 2017-03-03 17:25:26 +0100 | [diff] [blame] | 408 | |
Tomáš Kukrál | 00ed130 | 2017-03-03 17:38:40 +0100 | [diff] [blame] | 409 | |
| 410 | if (INSTALL.toLowerCase().contains('stacklight')) { |
Tomáš Kukrál | 2b4c128 | 2017-03-03 17:25:26 +0100 | [diff] [blame] | 411 | stage('Install StackLight') { |
| 412 | // infra install |
| 413 | // Install the StackLight backends |
| 414 | salt.enforceState(saltMaster, '*01* and I@elasticsearch:server', 'elasticsearch.server', true) |
| 415 | salt.enforceState(saltMaster, 'I@elasticsearch:server', 'elasticsearch.server', true) |
| 416 | |
| 417 | salt.enforceState(saltMaster, '*01* and I@influxdb:server', 'influxdb', true) |
| 418 | salt.enforceState(saltMaster, 'I@influxdb:server', 'influxdb', true) |
| 419 | |
| 420 | salt.enforceState(saltMaster, '*01* and I@kibana:server', 'kibana.server', true) |
| 421 | salt.enforceState(saltMaster, 'I@kibana:server', 'kibana.server', true) |
| 422 | |
| 423 | salt.enforceState(saltMaster, '*01* and I@grafana:server','grafana.server', true) |
| 424 | salt.enforceState(saltMaster, 'I@grafana:server','grafana.server', true) |
| 425 | |
| 426 | salt.enforceState(saltMaster, 'I@nagios:server', 'nagios.server', true) |
| 427 | salt.enforceState(saltMaster, 'I@elasticsearch:client', 'elasticsearch.client.service', true) |
| 428 | salt.enforceState(saltMaster, 'I@kibana:client', 'kibana.client.service', true) |
| 429 | // nw salt.enforceState('I@kibana:client or I@elasticsearch:client' --async service.restart salt-minion |
| 430 | |
| 431 | sleep(10) |
Tomáš Kukrál | 2b4c128 | 2017-03-03 17:25:26 +0100 | [diff] [blame] | 432 | |
Tomáš Kukrál | 2b4c128 | 2017-03-03 17:25:26 +0100 | [diff] [blame] | 433 | salt.enforceState(saltMaster, 'I@elasticsearch:client', 'elasticsearch.client', true) |
| 434 | salt.enforceState(saltMaster, 'I@kibana:client', 'kibana.client', true) |
| 435 | |
| 436 | // install monitor |
| 437 | // Restart salt-minion to make sure that it uses the latest Jinja library |
| 438 | // no way: salt '*' --async service.restart salt-minion; sleep 15 |
| 439 | |
| 440 | // Start by flusing Salt Mine to make sure it is clean |
| 441 | // Also clean-up the grains files to make sure that we start from a clean state |
| 442 | // nw salt "*" mine.flush |
| 443 | // nw salt "*" file.remove /etc/salt/grains.d/collectd |
| 444 | // nw salt "*" file.remove /etc/salt/grains.d/grafana |
| 445 | // nw salt "*" file.remove /etc/salt/grains.d/heka |
| 446 | // nw salt "*" file.remove /etc/salt/grains.d/sensu |
| 447 | // nw salt "*" file.remove /etc/salt/grains |
| 448 | |
| 449 | // Install collectd, heka and sensu services on the nodes, this will also |
| 450 | // generate the metadata that goes into the grains and eventually into Salt Mine |
Tomáš Kukrál | 2aa3c47 | 2017-03-03 17:47:08 +0100 | [diff] [blame] | 451 | salt.enforceState(saltMaster, '*', 'collectd', true) |
Tomáš Kukrál | 2b4c128 | 2017-03-03 17:25:26 +0100 | [diff] [blame] | 452 | salt.enforceState(saltMaster, '*', 'heka', true) |
Tomáš Kukrál | 2b4c128 | 2017-03-03 17:25:26 +0100 | [diff] [blame] | 453 | |
| 454 | // Gather the Grafana metadata as grains |
| 455 | salt.enforceState(saltMaster, 'I@grafana:collector', 'grafana.collector', true) |
| 456 | |
| 457 | // Update Salt Mine |
| 458 | salt.enforceState(saltMaster, '*', 'salt.minion.grains', true) |
| 459 | salt.runSaltProcessStep(saltMaster, '*', 'saltutil.refresh_modules', [], null, true) |
| 460 | salt.runSaltProcessStep(saltMaster, '*', 'mine.update', [], null, true) |
| 461 | |
| 462 | sleep(5) |
| 463 | |
| 464 | // Update Heka |
| 465 | salt.enforceState(saltMaster, 'I@heka:aggregator:enabled:True or I@heka:remote_collector:enabled:True', 'heka', true) |
| 466 | |
| 467 | // Update collectd |
| 468 | salt.enforceState(saltMaster, 'I@collectd:remote_client:enabled:True', 'collectd', true) |
| 469 | |
| 470 | // Update Nagios |
| 471 | salt.enforceState(saltMaster, 'I@nagios:server', 'nagios', true) |
| 472 | // Stop the Nagios service because the package starts it by default and it will |
| 473 | // started later only on the node holding the VIP address |
| 474 | salt.runSaltProcessStep(saltMaster, 'I@nagios:server', 'service.stop', ['nagios3'], null, true) |
| 475 | |
| 476 | // Update Sensu |
Tomáš Kukrál | 1ef3da7 | 2017-03-06 14:44:00 +0100 | [diff] [blame] | 477 | // TODO for stacklight team, should be fixed in model |
| 478 | //salt.enforceState(saltMaster, 'I@sensu:server', 'sensu', true) |
Tomáš Kukrál | 2b4c128 | 2017-03-03 17:25:26 +0100 | [diff] [blame] | 479 | |
| 480 | // Finalize the configuration of Grafana (add the dashboards...) |
| 481 | salt.enforceState(saltMaster, 'I@grafana:client', 'grafana.client.service', true) |
| 482 | // nw salt -C 'I@grafana:client' --async service.restart salt-minion; sleep 10 |
| 483 | salt.enforceState(saltMaster, 'I@grafana:client', 'grafana.client', true) |
| 484 | |
| 485 | // Get the StackLight monitoring VIP addres |
| 486 | // TODO |
| 487 | //vip=$(salt-call pillar.data _param:stacklight_monitor_address --out key|grep _param: |awk '{print $2}') |
| 488 | //vip=${vip:=172.16.10.253} |
Tomáš Kukrál | 3e4029d | 2017-03-07 09:59:40 +0100 | [diff] [blame] | 489 | //def pillar = salt.pillarGet(saltMaster, 'ctl01*', '_param:stacklight_monitor_address') |
| 490 | def pillar = salt.pillarGet(saltMaster, '') |
| 491 | print(pillar) |
| 492 | //def stacklight_vip = pillar['return'][0]['ctl01.nfv-lab.local'] |
Tomáš Kukrál | 2b4c128 | 2017-03-03 17:25:26 +0100 | [diff] [blame] | 493 | |
Tomáš Kukrál | 3e4029d | 2017-03-07 09:59:40 +0100 | [diff] [blame] | 494 | |
| 495 | //common.infoMsg("restart services on node with IP: ${stacklight_vip}") |
| 496 | |
| 497 | //// (re)Start manually the services that are bound to the monitoring VIP |
Tomáš Kukrál | 2b4c128 | 2017-03-03 17:25:26 +0100 | [diff] [blame] | 498 | //salt.runSaltProcessStep(saltMaster, "ipv4:${stacklight_vip}", 'service.restart', ['remote_collectd'], true) |
| 499 | //salt.runSaltProcessStep(saltMaster, "ipv4:${stacklight_vip}", 'service.restart', ['remote_collector'], true) |
| 500 | //salt.runSaltProcessStep(saltMaster, "ipv4:${stacklight_vip}", 'service.restart', ['aggregator'], true) |
Tomáš Kukrál | 3e4029d | 2017-03-07 09:59:40 +0100 | [diff] [blame] | 501 | //salt.runSaltProcessStep(saltMaster, "ipv4:${stacklight_vip}", 'service.restart', ['nagios3'], true) |
Tomáš Kukrál | 2b4c128 | 2017-03-03 17:25:26 +0100 | [diff] [blame] | 502 | } |
Tomáš Kukrál | 9e0fb73 | 2017-03-02 10:12:05 +0100 | [diff] [blame] | 503 | } |
| 504 | |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 505 | // |
| 506 | // Test |
| 507 | // |
| 508 | |
| 509 | if (TEST.toLowerCase().contains('k8s')) { |
| 510 | stage('Run k8s bootstrap tests') { |
| 511 | orchestrate.runConformanceTests(saltMaster, K8S_API_SERVER, 'tomkukral/k8s-scripts') |
| 512 | } |
| 513 | |
| 514 | stage('Run k8s conformance e2e tests') { |
| 515 | orchestrate.runConformanceTests(saltMaster, K8S_API_SERVER, K8S_CONFORMANCE_IMAGE) |
| 516 | } |
Tomáš Kukrál | 9e0fb73 | 2017-03-02 10:12:05 +0100 | [diff] [blame] | 517 | } |
Tomáš Kukrál | b9957b3 | 2017-02-28 14:49:00 +0100 | [diff] [blame] | 518 | |
Tomáš Kukrál | b9957b3 | 2017-02-28 14:49:00 +0100 | [diff] [blame] | 519 | |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 520 | } catch (Throwable e) { |
| 521 | currentBuild.result = 'FAILURE' |
| 522 | throw e |
Tomáš Kukrál | 65fb5fd | 2017-03-02 14:56:49 +0100 | [diff] [blame] | 523 | } finally { |
Tomáš Kukrál | b9957b3 | 2017-02-28 14:49:00 +0100 | [diff] [blame] | 524 | |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 525 | // |
| 526 | // Clean |
| 527 | // |
| 528 | |
Filip Pytloun | 794ad95 | 2017-03-03 10:39:26 +0100 | [diff] [blame] | 529 | if (HEAT_STACK_DELETE.toBoolean() == true && STACK_TYPE == 'heat') { |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 530 | stage('Trigger cleanup job') { |
Tomáš Kukrál | 3fee50a | 2017-03-03 00:46:30 +0100 | [diff] [blame] | 531 | build job: 'deploy-heat-cleanup', parameters: [[$class: 'StringParameterValue', name: 'HEAT_STACK_NAME', value: HEAT_STACK_NAME]] |
Tomáš Kukrál | a18de11 | 2017-03-02 13:57:47 +0100 | [diff] [blame] | 532 | } |
Tomáš Kukrál | 9e0fb73 | 2017-03-02 10:12:05 +0100 | [diff] [blame] | 533 | } |
Tomáš Kukrál | b9957b3 | 2017-02-28 14:49:00 +0100 | [diff] [blame] | 534 | } |
| 535 | } |
| 536 | } |