blob: 50349a8328d13322c4238d63c61aeca6e1301480 [file] [log] [blame]
Tomáš Kukrál2712be72017-02-23 10:24:31 +01001/**
2 *
3 * Run states on K8s
4 *
5 * Expected parameters:
6 * SALT_MASTER_CREDENTIALS Credentials used to access Salt API
7 * SALT_URL URL usedd to connect to Salt API
8 */
9
10common = new com.mirantis.mk.Common()
11salt = new com.mirantis.mk.Salt()
12orchestrate = new com.mirantis.mk.Orchestrate()
13
14node {
15
16 // connection objects
17 def master
18
19 stage("Connect to Salt master") {
20 master = salt.connection(SALT_URL, SALT_MASTER_CREDENTIALS)
21 }
22
23
24 stage("Enforce kubernetes.control") {
25 common.infoMsg('Enforcing kubernetes.control on I@kubernetes:master')
26
Tomáš Kukrál38dddbd2017-02-23 11:14:02 +010027 salt.runSaltProcessStep(
Tomáš Kukrál2712be72017-02-23 10:24:31 +010028 master,
Tomáš Kukrál38dddbd2017-02-23 11:14:02 +010029 'I@kubernetes:master',
30 'state.sls',
Tomáš Kukrál2712be72017-02-23 10:24:31 +010031 ['kubernetes.control'],
Tomáš Kukrál2712be72017-02-23 10:24:31 +010032 )
33 }
34
35 stage("setup-components") {
36 common.infoMsg('Setting up components')
37
38 salt.runSaltProcessStep(
39 master,
40 'I@kubernetes:master',
41 'cmd.run',
Tomáš Kukráld8328cd2017-02-23 14:38:33 +010042 ['/bin/bash -c \'find /srv/kubernetes/ -type d | grep -v jobs | while read i; do ls $i/*.yml &>/dev/null && (set -x; hyperkube kubectl apply -f $i || echo Command failed; set +x); done;\'']
Tomáš Kukrál2712be72017-02-23 10:24:31 +010043 )
44
45 }
46
47}