You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

823 lines
21 KiB

8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
contiv network support (#1914) * Add Contiv support Contiv is a network plugin for Kubernetes and Docker. It supports vlan/vxlan/BGP/Cisco ACI technologies. It support firewall policies, multiple networks and bridging pods onto physical networks. * Update contiv version to 1.1.4 Update contiv version to 1.1.4 and added SVC_SUBNET in contiv-config. * Load openvswitch module to workaround on CentOS7.4 * Set contiv cni version to 0.1.0 Correct contiv CNI version to 0.1.0. * Use kube_apiserver_endpoint for K8S_API_SERVER Use kube_apiserver_endpoint as K8S_API_SERVER to make contiv talks to a available endpoint no matter if there's a loadbalancer or not. * Make contiv use its own etcd Before this commit, contiv is using a etcd proxy mode to k8s etcd, this work fine when the etcd hosts are co-located with contiv etcd proxy, however the k8s peering certs are only in etcd group, as a result the etcd-proxy is not able to peering with the k8s etcd on etcd group, plus the netplugin is always trying to find the etcd endpoint on localhost, this will cause problem for all netplugins not runnign on etcd group nodes. This commit make contiv uses its own etcd, separate from k8s one. on kube-master nodes (where net-master runs), it will run as leader mode and on all rest nodes it will run as proxy mode. * Use cp instead of rsync to copy cni binaries Since rsync has been removed from hyperkube, this commit changes it to use cp instead. * Make contiv-etcd able to run on master nodes * Add rbac_enabled flag for contiv pods * Add contiv into CNI network plugin lists * migrate contiv test to tests/files Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> * Add required rules for contiv netplugin * Better handling json return of fwdMode * Make contiv etcd port configurable * Use default var instead of templating * roles/download/defaults/main.yml: use contiv 1.1.7 Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
7 years ago
contiv network support (#1914) * Add Contiv support Contiv is a network plugin for Kubernetes and Docker. It supports vlan/vxlan/BGP/Cisco ACI technologies. It support firewall policies, multiple networks and bridging pods onto physical networks. * Update contiv version to 1.1.4 Update contiv version to 1.1.4 and added SVC_SUBNET in contiv-config. * Load openvswitch module to workaround on CentOS7.4 * Set contiv cni version to 0.1.0 Correct contiv CNI version to 0.1.0. * Use kube_apiserver_endpoint for K8S_API_SERVER Use kube_apiserver_endpoint as K8S_API_SERVER to make contiv talks to a available endpoint no matter if there's a loadbalancer or not. * Make contiv use its own etcd Before this commit, contiv is using a etcd proxy mode to k8s etcd, this work fine when the etcd hosts are co-located with contiv etcd proxy, however the k8s peering certs are only in etcd group, as a result the etcd-proxy is not able to peering with the k8s etcd on etcd group, plus the netplugin is always trying to find the etcd endpoint on localhost, this will cause problem for all netplugins not runnign on etcd group nodes. This commit make contiv uses its own etcd, separate from k8s one. on kube-master nodes (where net-master runs), it will run as leader mode and on all rest nodes it will run as proxy mode. * Use cp instead of rsync to copy cni binaries Since rsync has been removed from hyperkube, this commit changes it to use cp instead. * Make contiv-etcd able to run on master nodes * Add rbac_enabled flag for contiv pods * Add contiv into CNI network plugin lists * migrate contiv test to tests/files Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> * Add required rules for contiv netplugin * Better handling json return of fwdMode * Make contiv etcd port configurable * Use default var instead of templating * roles/download/defaults/main.yml: use contiv 1.1.7 Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
7 years ago
6 years ago
6 years ago
8 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
  1. ---
  2. stages:
  3. - unit-tests
  4. - moderator
  5. - deploy-part1
  6. - deploy-part2
  7. - deploy-special
  8. variables:
  9. FAILFASTCI_NAMESPACE: 'kargo-ci'
  10. GITLAB_REPOSITORY: 'kargo-ci/kubernetes-sigs-kubespray'
  11. # DOCKER_HOST: tcp://localhost:2375
  12. ANSIBLE_FORCE_COLOR: "true"
  13. MAGIC: "ci check this"
  14. TEST_ID: "$CI_PIPELINE_ID-$CI_BUILD_ID"
  15. CI_TEST_VARS: "./tests/files/${CI_JOB_NAME}.yml"
  16. GS_ACCESS_KEY_ID: $GS_KEY
  17. GS_SECRET_ACCESS_KEY: $GS_SECRET
  18. CONTAINER_ENGINE: docker
  19. SSH_USER: root
  20. GCE_PREEMPTIBLE: "false"
  21. ANSIBLE_KEEP_REMOTE_FILES: "1"
  22. ANSIBLE_CONFIG: ./tests/ansible.cfg
  23. ANSIBLE_INVENTORY: ./inventory/sample/${CI_JOB_NAME}-${BUILD_NUMBER}.ini
  24. IDEMPOT_CHECK: "false"
  25. RESET_CHECK: "false"
  26. UPGRADE_TEST: "false"
  27. LOG_LEVEL: "-vv"
  28. # asia-east1-a
  29. # asia-northeast1-a
  30. # europe-west1-b
  31. # us-central1-a
  32. # us-east1-b
  33. # us-west1-a
  34. before_script:
  35. - /usr/bin/python -m pip install -r tests/requirements.txt
  36. - mkdir -p /.ssh
  37. .job: &job
  38. tags:
  39. - kubernetes
  40. - docker
  41. image: quay.io/kubespray/kubespray:v2.9.0
  42. .docker_service: &docker_service
  43. services:
  44. - docker:dind
  45. .create_cluster: &create_cluster
  46. <<: *job
  47. <<: *docker_service
  48. .gce_variables: &gce_variables
  49. GCE_USER: travis
  50. SSH_USER: $GCE_USER
  51. CLOUD_MACHINE_TYPE: "g1-small"
  52. CI_PLATFORM: "gce"
  53. PRIVATE_KEY: $GCE_PRIVATE_KEY
  54. .do_variables: &do_variables
  55. PRIVATE_KEY: $DO_PRIVATE_KEY
  56. CI_PLATFORM: "do"
  57. SSH_USER: root
  58. .ovh_variables: &ovh_variables
  59. OS_AUTH_URL: https://auth.cloud.ovh.net/v3
  60. OS_PROJECT_ID: 8d3cd5d737d74227ace462dee0b903fe
  61. OS_PROJECT_NAME: "9361447987648822"
  62. OS_USER_DOMAIN_NAME: Default
  63. OS_PROJECT_DOMAIN_ID: default
  64. OS_USERNAME: 8XuhBMfkKVrk
  65. OS_REGION_NAME: UK1
  66. OS_INTERFACE: public
  67. OS_IDENTITY_API_VERSION: "3"
  68. .testcases: &testcases
  69. <<: *job
  70. <<: *docker_service
  71. cache:
  72. key: "$CI_BUILD_REF_NAME"
  73. paths:
  74. - downloads/
  75. - $HOME/.cache
  76. before_script:
  77. - docker info
  78. - /usr/bin/python -m pip install -r requirements.txt
  79. - /usr/bin/python -m pip install -r tests/requirements.txt
  80. - mkdir -p /.ssh
  81. - mkdir -p $HOME/.ssh
  82. - ansible-playbook --version
  83. - export PYPATH=$([[ ! "$CI_JOB_NAME" =~ "coreos" ]] && echo /usr/bin/python || echo /opt/bin/python)
  84. - echo "CI_JOB_NAME is $CI_JOB_NAME"
  85. - echo "PYPATH is $PYPATH"
  86. script:
  87. - pwd
  88. - ls
  89. - echo ${PWD}
  90. - echo "${STARTUP_SCRIPT}"
  91. - cd tests && make create-${CI_PLATFORM} -s ; cd -
  92. # Check out latest tag if testing upgrade
  93. - test "${UPGRADE_TEST}" != "false" && git fetch --all && git checkout $(git describe --tags $(git rev-list --tags --max-count=1))
  94. # Checkout the CI vars file so it is available
  95. - test "${UPGRADE_TEST}" != "false" && git checkout "${CI_BUILD_REF}" tests/files/${CI_JOB_NAME}.yml
  96. # Workaround https://github.com/kubernetes-sigs/kubespray/issues/2021
  97. - 'sh -c "echo ignore_assert_errors: true | tee -a tests/files/${CI_JOB_NAME}.yml"'
  98. # Create cluster
  99. - >
  100. ansible-playbook
  101. -i ${ANSIBLE_INVENTORY}
  102. -b --become-user=root
  103. --private-key=${HOME}/.ssh/id_rsa
  104. -u $SSH_USER
  105. ${SSH_ARGS}
  106. ${LOG_LEVEL}
  107. -e @${CI_TEST_VARS}
  108. -e ansible_ssh_user=${SSH_USER}
  109. -e local_release_dir=${PWD}/downloads
  110. --limit "all:!fake_hosts"
  111. cluster.yml
  112. # Repeat deployment if testing upgrade
  113. - >
  114. if [ "${UPGRADE_TEST}" != "false" ]; then
  115. test "${UPGRADE_TEST}" == "basic" && PLAYBOOK="cluster.yml";
  116. test "${UPGRADE_TEST}" == "graceful" && PLAYBOOK="upgrade-cluster.yml";
  117. git checkout "${CI_BUILD_REF}";
  118. ansible-playbook
  119. -i ${ANSIBLE_INVENTORY}
  120. -b --become-user=root
  121. --private-key=${HOME}/.ssh/id_rsa
  122. -u $SSH_USER
  123. ${SSH_ARGS}
  124. ${LOG_LEVEL}
  125. -e @${CI_TEST_VARS}
  126. -e ansible_ssh_user=${SSH_USER}
  127. -e local_release_dir=${PWD}/downloads
  128. --limit "all:!fake_hosts"
  129. $PLAYBOOK;
  130. fi
  131. # Tests Cases
  132. ## Test Master API
  133. - ansible-playbook -i ${ANSIBLE_INVENTORY} -e ansible_python_interpreter=${PYPATH} -u $SSH_USER -e ansible_ssh_user=$SSH_USER $SSH_ARGS -b --become-user=root --limit "all:!fake_hosts" tests/testcases/010_check-apiserver.yml $LOG_LEVEL
  134. ## Ping the between 2 pod
  135. - ansible-playbook -i ${ANSIBLE_INVENTORY} -e ansible_python_interpreter=${PYPATH} -u $SSH_USER -e ansible_ssh_user=$SSH_USER $SSH_ARGS -b --become-user=root --limit "all:!fake_hosts" tests/testcases/030_check-network.yml $LOG_LEVEL
  136. ## Advanced DNS checks
  137. - ansible-playbook -i ${ANSIBLE_INVENTORY} -e ansible_python_interpreter=${PYPATH} -u $SSH_USER -e ansible_ssh_user=$SSH_USER $SSH_ARGS -b --become-user=root --limit "all:!fake_hosts" tests/testcases/040_check-network-adv.yml $LOG_LEVEL
  138. ## Idempotency checks 1/5 (repeat deployment)
  139. - >
  140. if [ "${IDEMPOT_CHECK}" = "true" ]; then
  141. ansible-playbook
  142. -i ${ANSIBLE_INVENTORY}
  143. -b --become-user=root
  144. --private-key=${HOME}/.ssh/id_rsa
  145. -u $SSH_USER
  146. ${SSH_ARGS}
  147. ${LOG_LEVEL}
  148. -e @${CI_TEST_VARS}
  149. -e ansible_python_interpreter=${PYPATH}
  150. -e local_release_dir=${PWD}/downloads
  151. --limit "all:!fake_hosts"
  152. cluster.yml;
  153. fi
  154. ## Idempotency checks 2/5 (Advanced DNS checks)
  155. - >
  156. if [ "${IDEMPOT_CHECK}" = "true" ]; then
  157. ansible-playbook
  158. -i ${ANSIBLE_INVENTORY}
  159. -b --become-user=root
  160. --private-key=${HOME}/.ssh/id_rsa
  161. -u $SSH_USER
  162. ${SSH_ARGS}
  163. ${LOG_LEVEL}
  164. -e @${CI_TEST_VARS}
  165. --limit "all:!fake_hosts"
  166. tests/testcases/040_check-network-adv.yml $LOG_LEVEL;
  167. fi
  168. ## Idempotency checks 3/5 (reset deployment)
  169. - >
  170. if [ "${IDEMPOT_CHECK}" = "true" -a "${RESET_CHECK}" = "true" ]; then
  171. ansible-playbook
  172. -i ${ANSIBLE_INVENTORY}
  173. -b --become-user=root
  174. --private-key=${HOME}/.ssh/id_rsa
  175. -u $SSH_USER
  176. ${SSH_ARGS}
  177. ${LOG_LEVEL}
  178. -e @${CI_TEST_VARS}
  179. -e ansible_python_interpreter=${PYPATH}
  180. -e reset_confirmation=yes
  181. --limit "all:!fake_hosts"
  182. reset.yml;
  183. fi
  184. ## Idempotency checks 4/5 (redeploy after reset)
  185. - >
  186. if [ "${IDEMPOT_CHECK}" = "true" -a "${RESET_CHECK}" = "true" ]; then
  187. ansible-playbook
  188. -i ${ANSIBLE_INVENTORY}
  189. -b --become-user=root
  190. --private-key=${HOME}/.ssh/id_rsa
  191. -u $SSH_USER
  192. ${SSH_ARGS}
  193. ${LOG_LEVEL}
  194. -e @${CI_TEST_VARS}
  195. -e ansible_python_interpreter=${PYPATH}
  196. -e local_release_dir=${PWD}/downloads
  197. --limit "all:!fake_hosts"
  198. cluster.yml;
  199. fi
  200. ## Idempotency checks 5/5 (Advanced DNS checks)
  201. - >
  202. if [ "${IDEMPOT_CHECK}" = "true" -a "${RESET_CHECK}" = "true" ]; then
  203. ansible-playbook -i ${ANSIBLE_INVENTORY} -e ansible_python_interpreter=${PYPATH}
  204. -u $SSH_USER -e ansible_ssh_user=$SSH_USER $SSH_ARGS -b --become-user=root
  205. --limit "all:!fake_hosts"
  206. tests/testcases/040_check-network-adv.yml $LOG_LEVEL;
  207. fi
  208. after_script:
  209. - cd tests && make delete-${CI_PLATFORM} -s ; cd -
  210. .gce: &gce
  211. <<: *testcases
  212. .do: &do
  213. <<: *testcases
  214. # Test matrix. Leave the comments for markup scripts.
  215. .coreos_calico_aio_variables: &coreos_calico_aio_variables
  216. # stage: deploy-part1
  217. MOVED_TO_GROUP_VARS: "true"
  218. .ubuntu18_flannel_aio_variables: &ubuntu18_flannel_aio_variables
  219. # stage: deploy-part1
  220. MOVED_TO_GROUP_VARS: "true"
  221. .centos_weave_kubeadm_variables: &centos_weave_kubeadm_variables
  222. # stage: deploy-part1
  223. UPGRADE_TEST: "graceful"
  224. .ubuntu_canal_kubeadm_variables: &ubuntu_canal_kubeadm_variables
  225. # stage: deploy-part1
  226. MOVED_TO_GROUP_VARS: "true"
  227. .ubuntu_canal_ha_variables: &ubuntu_canal_ha_variables
  228. # stage: deploy-special
  229. MOVED_TO_GROUP_VARS: "true"
  230. .ubuntu_contiv_sep_variables: &ubuntu_contiv_sep_variables
  231. # stage: deploy-special
  232. MOVED_TO_GROUP_VARS: "true"
  233. .coreos_cilium_variables: &coreos_cilium_variables
  234. # stage: deploy-special
  235. MOVED_TO_GROUP_VARS: "true"
  236. .ubuntu_cilium_sep_variables: &ubuntu_cilium_sep_variables
  237. # stage: deploy-special
  238. MOVED_TO_GROUP_VARS: "true"
  239. .rhel7_weave_variables: &rhel7_weave_variables
  240. # stage: deploy-part1
  241. MOVED_TO_GROUP_VARS: "true"
  242. .centos7_flannel_addons_variables: &centos7_flannel_addons_variables
  243. # stage: deploy-part2
  244. MOVED_TO_GROUP_VARS: "true"
  245. .debian9_calico_variables: &debian9_calico_variables
  246. # stage: deploy-part2
  247. MOVED_TO_GROUP_VARS: "true"
  248. .coreos_canal_variables: &coreos_canal_variables
  249. # stage: deploy-part2
  250. MOVED_TO_GROUP_VARS: "true"
  251. .rhel7_canal_sep_variables: &rhel7_canal_sep_variables
  252. # stage: deploy-special
  253. MOVED_TO_GROUP_VARS: "true"
  254. .ubuntu_weave_sep_variables: &ubuntu_weave_sep_variables
  255. # stage: deploy-special
  256. MOVED_TO_GROUP_VARS: "true"
  257. .centos7_calico_ha_variables: &centos7_calico_ha_variables
  258. # stage: deploy-special
  259. MOVED_TO_GROUP_VARS: "true"
  260. .centos7_kube_router_variables: &centos7_kube_router_variables
  261. # stage: deploy-special
  262. MOVED_TO_GROUP_VARS: "true"
  263. .centos7_multus_calico_variables: &centos7_multus_calico_variables
  264. # stage: deploy-part2
  265. UPGRADE_TEST: "graceful"
  266. .coreos_alpha_weave_ha_variables: &coreos_alpha_weave_ha_variables
  267. # stage: deploy-special
  268. MOVED_TO_GROUP_VARS: "true"
  269. .coreos_kube_router_variables: &coreos_kube_router_variables
  270. # stage: deploy-special
  271. MOVED_TO_GROUP_VARS: "true"
  272. .ubuntu_rkt_sep_variables: &ubuntu_rkt_sep_variables
  273. # stage: deploy-part1
  274. MOVED_TO_GROUP_VARS: "true"
  275. .ubuntu_flannel_variables: &ubuntu_flannel_variables
  276. # stage: deploy-part2
  277. MOVED_TO_GROUP_VARS: "true"
  278. .ubuntu_kube_router_variables: &ubuntu_kube_router_variables
  279. # stage: deploy-special
  280. MOVED_TO_GROUP_VARS: "true"
  281. .opensuse_canal_variables: &opensuse_canal_variables
  282. # stage: deploy-part2
  283. MOVED_TO_GROUP_VARS: "true"
  284. # Builds for PRs only (premoderated by unit-tests step) and triggers (auto)
  285. ### PR JOBS PART1
  286. gce_ubuntu18-flannel-aio:
  287. stage: deploy-part1
  288. <<: *gce
  289. variables:
  290. <<: *gce_variables
  291. <<: *ubuntu18_flannel_aio_variables
  292. when: on_success
  293. except: ['triggers']
  294. only: [/^pr-.*$/]
  295. ### PR JOBS PART2
  296. gce_coreos-calico-aio:
  297. stage: deploy-part2
  298. <<: *gce
  299. variables:
  300. <<: *gce_variables
  301. <<: *coreos_calico_aio_variables
  302. when: on_success
  303. except: ['triggers']
  304. only: [/^pr-.*$/]
  305. gce_centos7-flannel-addons:
  306. stage: deploy-part2
  307. <<: *gce
  308. variables:
  309. <<: *gce_variables
  310. <<: *centos7_flannel_addons_variables
  311. when: on_success
  312. except: ['triggers']
  313. only: [/^pr-.*$/]
  314. ### MANUAL JOBS
  315. gce_centos-weave-kubeadm-sep:
  316. stage: deploy-part2
  317. <<: *gce
  318. variables:
  319. <<: *gce_variables
  320. <<: *centos_weave_kubeadm_variables
  321. when: on_success
  322. only: ['triggers']
  323. gce_ubuntu-weave-sep:
  324. stage: deploy-part2
  325. <<: *gce
  326. variables:
  327. <<: *gce_variables
  328. <<: *ubuntu_weave_sep_variables
  329. when: manual
  330. only: ['triggers']
  331. gce_coreos-calico-sep-triggers:
  332. stage: deploy-part2
  333. <<: *gce
  334. variables:
  335. <<: *gce_variables
  336. <<: *coreos_calico_aio_variables
  337. when: on_success
  338. only: ['triggers']
  339. gce_ubuntu-canal-ha-triggers:
  340. stage: deploy-special
  341. <<: *gce
  342. variables:
  343. <<: *gce_variables
  344. <<: *ubuntu_canal_ha_variables
  345. when: on_success
  346. only: ['triggers']
  347. gce_centos7-flannel-addons-triggers:
  348. stage: deploy-part2
  349. <<: *gce
  350. variables:
  351. <<: *gce_variables
  352. <<: *centos7_flannel_addons_variables
  353. when: on_success
  354. only: ['triggers']
  355. gce_ubuntu-weave-sep-triggers:
  356. stage: deploy-part2
  357. <<: *gce
  358. variables:
  359. <<: *gce_variables
  360. <<: *ubuntu_weave_sep_variables
  361. when: on_success
  362. only: ['triggers']
  363. # More builds for PRs/merges (manual) and triggers (auto)
  364. do_ubuntu-canal-ha:
  365. stage: deploy-part2
  366. <<: *do
  367. variables:
  368. <<: *do_variables
  369. when: manual
  370. except: ['triggers']
  371. only: ['master', /^pr-.*$/]
  372. gce_ubuntu-canal-ha:
  373. stage: deploy-special
  374. <<: *gce
  375. variables:
  376. <<: *gce_variables
  377. <<: *ubuntu_canal_ha_variables
  378. when: manual
  379. except: ['triggers']
  380. only: ['master', /^pr-.*$/]
  381. gce_ubuntu-canal-kubeadm:
  382. stage: deploy-part2
  383. <<: *gce
  384. variables:
  385. <<: *gce_variables
  386. <<: *ubuntu_canal_kubeadm_variables
  387. when: manual
  388. except: ['triggers']
  389. only: ['master', /^pr-.*$/]
  390. gce_ubuntu-canal-kubeadm-triggers:
  391. stage: deploy-part2
  392. <<: *gce
  393. variables:
  394. <<: *gce_variables
  395. <<: *ubuntu_canal_kubeadm_variables
  396. when: on_success
  397. only: ['triggers']
  398. gce_ubuntu-flannel-ha:
  399. stage: deploy-part2
  400. <<: *gce
  401. variables:
  402. <<: *gce_variables
  403. <<: *ubuntu_flannel_variables
  404. when: manual
  405. except: ['triggers']
  406. gce_centos-weave-kubeadm-triggers:
  407. stage: deploy-part2
  408. <<: *gce
  409. variables:
  410. <<: *gce_variables
  411. <<: *centos_weave_kubeadm_variables
  412. when: on_success
  413. only: ['triggers']
  414. gce_ubuntu-contiv-sep:
  415. stage: deploy-special
  416. <<: *gce
  417. variables:
  418. <<: *gce_variables
  419. <<: *ubuntu_contiv_sep_variables
  420. when: manual
  421. except: ['triggers']
  422. only: ['master', /^pr-.*$/]
  423. gce_coreos-cilium:
  424. stage: deploy-special
  425. <<: *gce
  426. variables:
  427. <<: *gce_variables
  428. <<: *coreos_cilium_variables
  429. when: manual
  430. except: ['triggers']
  431. only: ['master', /^pr-.*$/]
  432. gce_ubuntu-cilium-sep:
  433. stage: deploy-special
  434. <<: *gce
  435. variables:
  436. <<: *gce_variables
  437. <<: *ubuntu_cilium_sep_variables
  438. when: manual
  439. except: ['triggers']
  440. only: ['master', /^pr-.*$/]
  441. gce_rhel7-weave:
  442. stage: deploy-part2
  443. <<: *gce
  444. variables:
  445. <<: *gce_variables
  446. <<: *rhel7_weave_variables
  447. when: manual
  448. except: ['triggers']
  449. only: ['master', /^pr-.*$/]
  450. gce_rhel7-weave-triggers:
  451. stage: deploy-part2
  452. <<: *gce
  453. variables:
  454. <<: *gce_variables
  455. <<: *rhel7_weave_variables
  456. when: on_success
  457. only: ['triggers']
  458. gce_debian9-calico-upgrade:
  459. stage: deploy-part2
  460. <<: *gce
  461. variables:
  462. <<: *gce_variables
  463. <<: *debian9_calico_variables
  464. when: manual
  465. except: ['triggers']
  466. only: ['master', /^pr-.*$/]
  467. gce_debian9-calico-triggers:
  468. stage: deploy-part2
  469. <<: *gce
  470. variables:
  471. <<: *gce_variables
  472. <<: *debian9_calico_variables
  473. when: on_success
  474. only: ['triggers']
  475. gce_coreos-canal:
  476. stage: deploy-part2
  477. <<: *gce
  478. variables:
  479. <<: *gce_variables
  480. <<: *coreos_canal_variables
  481. when: manual
  482. except: ['triggers']
  483. only: ['master', /^pr-.*$/]
  484. gce_coreos-canal-triggers:
  485. stage: deploy-part2
  486. <<: *gce
  487. variables:
  488. <<: *gce_variables
  489. <<: *coreos_canal_variables
  490. when: on_success
  491. only: ['triggers']
  492. gce_rhel7-canal-sep:
  493. stage: deploy-special
  494. <<: *gce
  495. variables:
  496. <<: *gce_variables
  497. <<: *rhel7_canal_sep_variables
  498. when: manual
  499. except: ['triggers']
  500. only: ['master', /^pr-.*$/]
  501. gce_rhel7-canal-sep-triggers:
  502. stage: deploy-part2
  503. <<: *gce
  504. variables:
  505. <<: *gce_variables
  506. <<: *rhel7_canal_sep_variables
  507. when: on_success
  508. only: ['triggers']
  509. gce_centos7-calico-ha:
  510. stage: deploy-special
  511. <<: *gce
  512. variables:
  513. <<: *gce_variables
  514. <<: *centos7_calico_ha_variables
  515. when: manual
  516. except: ['triggers']
  517. only: ['master', /^pr-.*$/]
  518. gce_centos7-calico-ha-triggers:
  519. stage: deploy-part2
  520. <<: *gce
  521. variables:
  522. <<: *gce_variables
  523. <<: *centos7_calico_ha_variables
  524. when: on_success
  525. only: ['triggers']
  526. gce_centos7-kube-router:
  527. stage: deploy-special
  528. <<: *gce
  529. variables:
  530. <<: *gce_variables
  531. <<: *centos7_kube_router_variables
  532. when: manual
  533. except: ['triggers']
  534. only: ['master', /^pr-.*$/]
  535. gce_centos7-multus-calico:
  536. stage: deploy-part2
  537. <<: *gce
  538. variables:
  539. <<: *gce_variables
  540. <<: *centos7_multus_calico_variables
  541. when: manual
  542. except: ['triggers']
  543. only: ['master', /^pr-.*$/]
  544. gce_opensuse-canal:
  545. stage: deploy-part2
  546. <<: *gce
  547. variables:
  548. <<: *gce_variables
  549. <<: *opensuse_canal_variables
  550. when: manual
  551. except: ['triggers']
  552. only: ['master', /^pr-.*$/]
  553. # no triggers yet https://github.com/kubernetes-incubator/kargo/issues/613
  554. gce_coreos-alpha-weave-ha:
  555. stage: deploy-special
  556. <<: *gce
  557. variables:
  558. <<: *gce_variables
  559. <<: *coreos_alpha_weave_ha_variables
  560. when: manual
  561. except: ['triggers']
  562. only: ['master', /^pr-.*$/]
  563. gce_coreos-kube-router:
  564. stage: deploy-special
  565. <<: *gce
  566. variables:
  567. <<: *gce_variables
  568. <<: *coreos_kube_router_variables
  569. when: manual
  570. except: ['triggers']
  571. only: ['master', /^pr-.*$/]
  572. gce_ubuntu-rkt-sep:
  573. stage: deploy-part2
  574. <<: *gce
  575. variables:
  576. <<: *gce_variables
  577. <<: *ubuntu_rkt_sep_variables
  578. when: manual
  579. except: ['triggers']
  580. only: ['master', /^pr-.*$/]
  581. gce_ubuntu-kube-router-sep:
  582. stage: deploy-special
  583. <<: *gce
  584. variables:
  585. <<: *gce_variables
  586. <<: *ubuntu_kube_router_variables
  587. when: manual
  588. except: ['triggers']
  589. only: ['master', /^pr-.*$/]
  590. # Premoderated with manual actions
  591. ci-authorized:
  592. <<: *job
  593. stage: moderator
  594. before_script:
  595. - apt-get -y install jq
  596. script:
  597. - /bin/sh scripts/premoderator.sh
  598. except: ['triggers', 'master']
  599. syntax-check:
  600. <<: *job
  601. stage: unit-tests
  602. script:
  603. - ansible-playbook -i inventory/local-tests.cfg -u root -e ansible_ssh_user=root -b --become-user=root cluster.yml -vvv --syntax-check
  604. - ansible-playbook -i inventory/local-tests.cfg -u root -e ansible_ssh_user=root -b --become-user=root upgrade-cluster.yml -vvv --syntax-check
  605. - ansible-playbook -i inventory/local-tests.cfg -u root -e ansible_ssh_user=root -b --become-user=root reset.yml -vvv --syntax-check
  606. - ansible-playbook -i inventory/local-tests.cfg -u root -e ansible_ssh_user=root -b --become-user=root extra_playbooks/upgrade-only-k8s.yml -vvv --syntax-check
  607. except: ['triggers', 'master']
  608. yamllint:
  609. <<: *job
  610. stage: unit-tests
  611. script:
  612. - yamllint .
  613. except: ['triggers', 'master']
  614. ansible-lint:
  615. <<: *job
  616. stage: unit-tests
  617. # lint every yml/yaml file that looks like it contains Ansible plays
  618. script: |-
  619. grep -Rl '^- hosts: \|^ hosts: \|^- name: ' --include \*.yml --include \*.yaml . | xargs ansible-lint -v
  620. except: ['triggers', 'master']
  621. tox-inventory-builder:
  622. stage: unit-tests
  623. <<: *job
  624. script:
  625. - pip install tox
  626. - cd contrib/inventory_builder && tox
  627. when: manual
  628. except: ['triggers', 'master']
  629. # Tests for contrib/terraform/
  630. .terraform_install: &terraform_install
  631. <<: *job
  632. before_script:
  633. # Set Ansible config
  634. - cp ansible.cfg ~/.ansible.cfg
  635. # Install Terraform
  636. - apt-get install -y unzip
  637. - curl https://releases.hashicorp.com/terraform/${TF_VERSION}/terraform_${TF_VERSION}_linux_amd64.zip > /tmp/terraform.zip
  638. - unzip /tmp/terraform.zip && mv ./terraform /usr/local/bin/ && terraform --version
  639. # Prepare inventory
  640. - cp -LRp contrib/terraform/$PROVIDER/sample-inventory inventory/$CLUSTER
  641. - cd inventory/$CLUSTER
  642. - ln -s ../../contrib/terraform/$PROVIDER/hosts
  643. - terraform init ../../contrib/terraform/$PROVIDER
  644. # Copy SSH keypair
  645. - mkdir -p ~/.ssh
  646. - echo "$PACKET_PRIVATE_KEY" | base64 -d > ~/.ssh/id_rsa
  647. - chmod 400 ~/.ssh/id_rsa
  648. - echo "$PACKET_PUBLIC_KEY" | base64 -d > ~/.ssh/id_rsa.pub
  649. only: ['master', /^pr-.*$/]
  650. .terraform_validate: &terraform_validate
  651. <<: *terraform_install
  652. stage: unit-tests
  653. script:
  654. - terraform validate -var-file=cluster.tf ../../contrib/terraform/$PROVIDER
  655. - terraform fmt -check -diff ../../contrib/terraform/$PROVIDER
  656. .terraform_apply: &terraform_apply
  657. <<: *terraform_install
  658. stage: deploy-part2
  659. when: manual
  660. script:
  661. - terraform apply -auto-approve ../../contrib/terraform/$PROVIDER
  662. - ansible-playbook -i hosts ../../cluster.yml --become
  663. after_script:
  664. # Cleanup regardless of exit code
  665. - cd inventory/$CLUSTER
  666. - terraform destroy -auto-approve ../../contrib/terraform/$PROVIDER
  667. tf-validate-openstack:
  668. <<: *terraform_validate
  669. variables:
  670. TF_VERSION: 0.11.11
  671. PROVIDER: openstack
  672. CLUSTER: $CI_COMMIT_REF_NAME
  673. tf-validate-packet:
  674. <<: *terraform_validate
  675. variables:
  676. TF_VERSION: 0.11.11
  677. PROVIDER: packet
  678. CLUSTER: $CI_COMMIT_REF_NAME
  679. tf-validate-aws:
  680. <<: *terraform_validate
  681. variables:
  682. TF_VERSION: 0.11.11
  683. PROVIDER: aws
  684. CLUSTER: $CI_COMMIT_REF_NAME
  685. tf-apply-packet:
  686. <<: *terraform_apply
  687. variables:
  688. TF_VERSION: 0.11.11
  689. PROVIDER: packet
  690. CLUSTER: $CI_COMMIT_REF_NAME
  691. TF_VAR_cluster_name: $CI_COMMIT_REF_NAME
  692. TF_VAR_number_of_k8s_masters: "1"
  693. TF_VAR_number_of_k8s_nodes: "1"
  694. TF_VAR_plan_k8s_masters: t1.small.x86
  695. TF_VAR_plan_k8s_nodes: t1.small.x86
  696. TF_VAR_facility: "ewr1"
  697. TF_VAR_public_key_path: ""
  698. tf-apply-ovh:
  699. <<: *terraform_apply
  700. variables:
  701. <<: *ovh_variables
  702. TF_VERSION: 0.11.11
  703. PROVIDER: openstack
  704. CLUSTER: $CI_COMMIT_REF_NAME
  705. ANSIBLE_TIMEOUT: "60"
  706. TF_VAR_cluster_name: $CI_COMMIT_REF_NAME
  707. TF_VAR_number_of_k8s_masters: "0"
  708. TF_VAR_number_of_k8s_masters_no_floating_ip: "1"
  709. TF_VAR_number_of_k8s_masters_no_floating_ip_no_etcd: "0"
  710. TF_VAR_number_of_etcd: "0"
  711. TF_VAR_number_of_k8s_nodes: "0"
  712. TF_VAR_number_of_k8s_nodes_no_floating_ip: "1"
  713. TF_VAR_number_of_gfs_nodes_no_floating_ip: "0"
  714. TF_VAR_number_of_bastions: "0"
  715. TF_VAR_number_of_k8s_masters_no_etcd: "0"
  716. TF_VAR_use_neutron: "0"
  717. TF_VAR_floatingip_pool: "Ext-Net"
  718. TF_VAR_external_net: "6011fbc9-4cbf-46a4-8452-6890a340b60b"
  719. TF_VAR_network_name: "Ext-Net"
  720. TF_VAR_flavor_k8s_master: "defa64c3-bd46-43b4-858a-d93bbae0a229" #s1-8
  721. TF_VAR_flavor_k8s_node: "defa64c3-bd46-43b4-858a-d93bbae0a229" #s1-8
  722. TF_VAR_image: "Ubuntu 18.04"