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.

161 lines
5.4 KiB

8 years ago
8 years ago
  1. sudo: required
  2. services:
  3. - docker
  4. git:
  5. depth: 5
  6. env:
  7. global:
  8. GCE_USER=travis
  9. SSH_USER=$GCE_USER
  10. TEST_ID=$TRAVIS_JOB_NUMBER
  11. CONTAINER_ENGINE=docker
  12. PRIVATE_KEY=$GCE_PRIVATE_KEY
  13. GS_ACCESS_KEY_ID=$GS_KEY
  14. GS_SECRET_ACCESS_KEY=$GS_SECRET
  15. ANSIBLE_KEEP_REMOTE_FILES=1
  16. CLUSTER_MODE=default
  17. BOOTSTRAP_OS=none
  18. matrix:
  19. # Debian Jessie
  20. - >-
  21. KUBE_NETWORK_PLUGIN=canal
  22. CLOUD_IMAGE=debian-8-kubespray
  23. CLOUD_REGION=asia-east1-a
  24. CLUSTER_MODE=ha
  25. - >-
  26. KUBE_NETWORK_PLUGIN=calico
  27. CLOUD_IMAGE=debian-8-kubespray
  28. CLOUD_REGION=europe-west1-c
  29. CLUSTER_MODE=default
  30. # Centos 7
  31. - >-
  32. KUBE_NETWORK_PLUGIN=flannel
  33. CLOUD_IMAGE=centos-7
  34. CLOUD_REGION=asia-northeast1-c
  35. CLUSTER_MODE=default
  36. - >-
  37. KUBE_NETWORK_PLUGIN=calico
  38. CLOUD_IMAGE=centos-7
  39. CLOUD_REGION=us-central1-b
  40. CLUSTER_MODE=ha
  41. # Redhat 7
  42. - >-
  43. KUBE_NETWORK_PLUGIN=weave
  44. CLOUD_IMAGE=rhel-7
  45. CLOUD_REGION=us-east1-c
  46. CLUSTER_MODE=default
  47. # CoreOS stable
  48. #- >-
  49. # KUBE_NETWORK_PLUGIN=weave
  50. # CLOUD_IMAGE=coreos-stable
  51. # CLOUD_REGION=europe-west1-b
  52. # CLUSTER_MODE=ha
  53. # BOOTSTRAP_OS=coreos
  54. - >-
  55. KUBE_NETWORK_PLUGIN=canal
  56. CLOUD_IMAGE=coreos-stable
  57. CLOUD_REGION=us-west1-b
  58. CLUSTER_MODE=default
  59. BOOTSTRAP_OS=coreos
  60. # Extra cases for separated roles
  61. - >-
  62. KUBE_NETWORK_PLUGIN=canal
  63. CLOUD_IMAGE=rhel-7
  64. CLOUD_REGION=asia-northeast1-b
  65. CLUSTER_MODE=separate
  66. - >-
  67. KUBE_NETWORK_PLUGIN=weave
  68. CLOUD_IMAGE=ubuntu-1604-xenial
  69. CLOUD_REGION=europe-west1-d
  70. CLUSTER_MODE=separate
  71. - >-
  72. KUBE_NETWORK_PLUGIN=calico
  73. CLOUD_IMAGE=coreos-stable
  74. CLOUD_REGION=us-central1-f
  75. CLUSTER_MODE=separate
  76. BOOTSTRAP_OS=coreos
  77. matrix:
  78. allow_failures:
  79. - env: KUBE_NETWORK_PLUGIN=weave CLOUD_IMAGE=coreos-stable CLOUD_REGION=europe-west1-b CLUSTER_MODE=ha BOOTSTRAP_OS=coreos
  80. before_install:
  81. # Install Ansible.
  82. - pip install --user ansible
  83. - pip install --user netaddr
  84. # W/A https://github.com/ansible/ansible-modules-core/issues/5196#issuecomment-253766186
  85. - pip install --user apache-libcloud==0.20.1
  86. - pip install --user boto==2.9.0 -U
  87. # Load cached docker images
  88. - if [ -d /var/tmp/releases ]; then find /var/tmp/releases -type f -name "*.tar" | xargs -I {} sh -c "zcat {} | docker load"; fi
  89. cache:
  90. - directories:
  91. - $HOME/.cache/pip
  92. - $HOME/.local
  93. - /var/tmp/releases
  94. before_script:
  95. - echo "RUN $TRAVIS_JOB_NUMBER $KUBE_NETWORK_PLUGIN $CONTAINER_ENGINE "
  96. - mkdir -p $HOME/.ssh
  97. - echo $PRIVATE_KEY | base64 -d > $HOME/.ssh/id_rsa
  98. - echo $GCE_PEM_FILE | base64 -d > $HOME/.ssh/gce
  99. - chmod 400 $HOME/.ssh/id_rsa
  100. - chmod 755 $HOME/.local/bin/ansible-playbook
  101. - $HOME/.local/bin/ansible-playbook --version
  102. - cp tests/ansible.cfg .
  103. - export PYPATH=$([ $BOOTSTRAP_OS = none ] && echo /usr/bin/python || echo /opt/bin/python)
  104. # - "echo $HOME/.local/bin/ansible-playbook -i inventory.ini -u $SSH_USER -e ansible_ssh_user=$SSH_USER $SSH_ARGS -b --become-user=root -e '{\"cloud_provider\": true}' $LOG_LEVEL -e kube_network_plugin=${KUBE_NETWORK_PLUGIN} setup-kubernetes/cluster.yml"
  105. script:
  106. - >
  107. $HOME/.local/bin/ansible-playbook tests/cloud_playbooks/create-gce.yml -i tests/local_inventory/hosts.cfg -c local $LOG_LEVEL
  108. -e mode=${CLUSTER_MODE}
  109. -e test_id=${TEST_ID}
  110. -e kube_network_plugin=${KUBE_NETWORK_PLUGIN}
  111. -e gce_project_id=${GCE_PROJECT_ID}
  112. -e gce_service_account_email=${GCE_ACCOUNT}
  113. -e gce_pem_file=${HOME}/.ssh/gce
  114. -e cloud_image=${CLOUD_IMAGE}
  115. -e inventory_path=${PWD}/inventory/inventory.ini
  116. -e cloud_region=${CLOUD_REGION}
  117. # Create cluster with netchecker app deployed
  118. - >
  119. $HOME/.local/bin/ansible-playbook -i inventory/inventory.ini -u $SSH_USER -e ansible_ssh_user=$SSH_USER $SSH_ARGS
  120. -b --become-user=root -e cloud_provider=gce $LOG_LEVEL -e kube_network_plugin=${KUBE_NETWORK_PLUGIN}
  121. -e bootstrap_os=${BOOTSTRAP_OS}
  122. -e ansible_python_interpreter=${PYPATH}
  123. -e download_run_once=true
  124. -e download_localhost=true
  125. -e local_release_dir=/var/tmp/releases
  126. -e deploy_netchecker=true
  127. cluster.yml
  128. # Tests Cases
  129. ## Test Master API
  130. - $HOME/.local/bin/ansible-playbook -i inventory/inventory.ini -e ansible_python_interpreter=${PYPATH} -u $SSH_USER -e ansible_ssh_user=$SSH_USER $SSH_ARGS -b --become-user=root tests/testcases/010_check-apiserver.yml $LOG_LEVEL
  131. ## Ping the between 2 pod
  132. - $HOME/.local/bin/ansible-playbook -i inventory/inventory.ini -e ansible_python_interpreter=${PYPATH} -u $SSH_USER -e ansible_ssh_user=$SSH_USER $SSH_ARGS -b --become-user=root tests/testcases/030_check-network.yml $LOG_LEVEL
  133. ## Advanced DNS checks
  134. - $HOME/.local/bin/ansible-playbook -i inventory/inventory.ini -e ansible_python_interpreter=${PYPATH} -u $SSH_USER -e ansible_ssh_user=$SSH_USER $SSH_ARGS -b --become-user=root tests/testcases/040_check-network-adv.yml $LOG_LEVEL
  135. after_script:
  136. - >
  137. $HOME/.local/bin/ansible-playbook -i inventory/inventory.ini tests/cloud_playbooks/delete-gce.yml -c local $LOG_LEVEL
  138. -e mode=${CLUSTER_MODE}
  139. -e test_id=${TEST_ID}
  140. -e kube_network_plugin=${KUBE_NETWORK_PLUGIN}
  141. -e gce_project_id=${GCE_PROJECT_ID}
  142. -e gce_service_account_email=${GCE_ACCOUNT}
  143. -e gce_pem_file=${HOME}/.ssh/gce
  144. -e cloud_image=${CLOUD_IMAGE}
  145. -e inventory_path=${PWD}/inventory/inventory.ini
  146. -e cloud_region=${CLOUD_REGION}