2019-04-17 23:32:03 +08:00
|
|
|
---
|
2019-04-16 20:35:05 +08:00
|
|
|
# Tests for contrib/terraform/
|
|
|
|
.terraform_install:
|
|
|
|
extends: .job
|
|
|
|
before_script:
|
2019-12-11 16:10:05 +08:00
|
|
|
- update-alternatives --install /usr/bin/python python /usr/bin/python3 1
|
2019-04-24 16:38:01 +08:00
|
|
|
- ./tests/scripts/rebase.sh
|
2019-05-03 03:26:19 +08:00
|
|
|
- ./tests/scripts/testcases_prepare.sh
|
|
|
|
- ./tests/scripts/terraform_install.sh
|
2019-04-16 20:35:05 +08:00
|
|
|
# Set Ansible config
|
|
|
|
- cp ansible.cfg ~/.ansible.cfg
|
|
|
|
# Prepare inventory
|
2019-12-04 23:20:58 +08:00
|
|
|
- cp contrib/terraform/$PROVIDER/sample-inventory/cluster.tfvars .
|
2019-05-09 14:40:49 +08:00
|
|
|
- ln -s contrib/terraform/$PROVIDER/hosts
|
|
|
|
- terraform init contrib/terraform/$PROVIDER
|
2019-04-16 20:35:05 +08:00
|
|
|
# Copy SSH keypair
|
|
|
|
- mkdir -p ~/.ssh
|
|
|
|
- echo "$PACKET_PRIVATE_KEY" | base64 -d > ~/.ssh/id_rsa
|
|
|
|
- chmod 400 ~/.ssh/id_rsa
|
|
|
|
- echo "$PACKET_PUBLIC_KEY" | base64 -d > ~/.ssh/id_rsa.pub
|
|
|
|
|
|
|
|
.terraform_validate:
|
|
|
|
extends: .terraform_install
|
|
|
|
stage: unit-tests
|
2020-03-14 01:29:22 +08:00
|
|
|
tags: [light]
|
2019-05-03 03:20:20 +08:00
|
|
|
only: ['master', /^pr-.*$/]
|
2019-04-16 20:35:05 +08:00
|
|
|
script:
|
2019-12-04 23:20:58 +08:00
|
|
|
- terraform validate -var-file=cluster.tfvars contrib/terraform/$PROVIDER
|
2019-05-09 14:40:49 +08:00
|
|
|
- terraform fmt -check -diff contrib/terraform/$PROVIDER
|
2019-04-16 20:35:05 +08:00
|
|
|
|
|
|
|
.terraform_apply:
|
|
|
|
extends: .terraform_install
|
2020-03-14 01:29:22 +08:00
|
|
|
tags: [light]
|
2020-04-16 00:24:03 +08:00
|
|
|
stage: deploy-part3
|
2019-04-16 20:35:05 +08:00
|
|
|
when: manual
|
2019-05-03 03:20:20 +08:00
|
|
|
only: [/^pr-.*$/]
|
2020-04-01 22:23:29 +08:00
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- cluster-dump/
|
2019-04-25 15:40:46 +08:00
|
|
|
variables:
|
|
|
|
ANSIBLE_INVENTORY_UNPARSED_FAILED: "true"
|
2019-05-03 03:26:19 +08:00
|
|
|
ANSIBLE_INVENTORY: hosts
|
|
|
|
CI_PLATFORM: tf
|
2019-05-28 16:51:53 +08:00
|
|
|
TF_VAR_ssh_user: $SSH_USER
|
2019-06-04 19:25:00 +08:00
|
|
|
TF_VAR_cluster_name: $CI_JOB_ID
|
2019-04-16 20:35:05 +08:00
|
|
|
script:
|
2019-05-14 17:01:14 +08:00
|
|
|
- tests/scripts/testcases_run.sh
|
2019-04-16 20:35:05 +08:00
|
|
|
after_script:
|
|
|
|
# Cleanup regardless of exit code
|
2020-03-31 20:28:40 +08:00
|
|
|
- chronic ./tests/scripts/testcases_cleanup.sh
|
2019-04-16 20:35:05 +08:00
|
|
|
|
|
|
|
tf-validate-openstack:
|
|
|
|
extends: .terraform_validate
|
|
|
|
variables:
|
2020-04-11 14:47:56 +08:00
|
|
|
TF_VERSION: 0.12.24
|
2019-04-16 20:35:05 +08:00
|
|
|
PROVIDER: openstack
|
|
|
|
CLUSTER: $CI_COMMIT_REF_NAME
|
|
|
|
|
|
|
|
tf-validate-packet:
|
|
|
|
extends: .terraform_validate
|
|
|
|
variables:
|
2020-04-11 14:47:56 +08:00
|
|
|
TF_VERSION: 0.12.24
|
2019-04-16 20:35:05 +08:00
|
|
|
PROVIDER: packet
|
|
|
|
CLUSTER: $CI_COMMIT_REF_NAME
|
|
|
|
|
|
|
|
tf-validate-aws:
|
|
|
|
extends: .terraform_validate
|
|
|
|
variables:
|
2020-04-11 14:47:56 +08:00
|
|
|
TF_VERSION: 0.12.24
|
2019-04-16 20:35:05 +08:00
|
|
|
PROVIDER: aws
|
|
|
|
CLUSTER: $CI_COMMIT_REF_NAME
|
|
|
|
|
2019-10-02 17:21:07 +08:00
|
|
|
# tf-packet-ubuntu16-default:
|
|
|
|
# extends: .terraform_apply
|
|
|
|
# variables:
|
2020-04-11 14:47:56 +08:00
|
|
|
# TF_VERSION: 0.12.24
|
2019-10-02 17:21:07 +08:00
|
|
|
# PROVIDER: packet
|
|
|
|
# CLUSTER: $CI_COMMIT_REF_NAME
|
|
|
|
# TF_VAR_number_of_k8s_masters: "1"
|
|
|
|
# TF_VAR_number_of_k8s_nodes: "1"
|
|
|
|
# TF_VAR_plan_k8s_masters: t1.small.x86
|
|
|
|
# TF_VAR_plan_k8s_nodes: t1.small.x86
|
|
|
|
# TF_VAR_facility: ewr1
|
|
|
|
# TF_VAR_public_key_path: ""
|
|
|
|
# TF_VAR_operating_system: ubuntu_16_04
|
|
|
|
#
|
|
|
|
# tf-packet-ubuntu18-default:
|
|
|
|
# extends: .terraform_apply
|
|
|
|
# variables:
|
2020-04-11 14:47:56 +08:00
|
|
|
# TF_VERSION: 0.12.24
|
2019-10-02 17:21:07 +08:00
|
|
|
# PROVIDER: packet
|
|
|
|
# CLUSTER: $CI_COMMIT_REF_NAME
|
|
|
|
# TF_VAR_number_of_k8s_masters: "1"
|
|
|
|
# TF_VAR_number_of_k8s_nodes: "1"
|
|
|
|
# TF_VAR_plan_k8s_masters: t1.small.x86
|
|
|
|
# TF_VAR_plan_k8s_nodes: t1.small.x86
|
|
|
|
# TF_VAR_facility: ams1
|
|
|
|
# TF_VAR_public_key_path: ""
|
|
|
|
# TF_VAR_operating_system: ubuntu_18_04
|
2019-04-16 20:35:05 +08:00
|
|
|
|
2020-05-10 06:19:50 +08:00
|
|
|
# .ovh_variables: &ovh_variables
|
|
|
|
# OS_AUTH_URL: https://auth.cloud.ovh.net/v3
|
|
|
|
# OS_PROJECT_ID: 8d3cd5d737d74227ace462dee0b903fe
|
|
|
|
# OS_PROJECT_NAME: "9361447987648822"
|
|
|
|
# OS_USER_DOMAIN_NAME: Default
|
|
|
|
# OS_PROJECT_DOMAIN_ID: default
|
|
|
|
# OS_USERNAME: 8XuhBMfkKVrk
|
|
|
|
# OS_REGION_NAME: UK1
|
|
|
|
# OS_INTERFACE: public
|
|
|
|
# OS_IDENTITY_API_VERSION: "3"
|
2019-04-16 20:35:05 +08:00
|
|
|
|
2020-05-10 06:19:50 +08:00
|
|
|
# tf-ovh_cleanup:
|
|
|
|
# stage: unit-tests
|
|
|
|
# tags: [light]
|
|
|
|
# image: python
|
|
|
|
# variables:
|
|
|
|
# <<: *ovh_variables
|
|
|
|
# before_script:
|
|
|
|
# - pip install -r scripts/openstack-cleanup/requirements.txt
|
|
|
|
# script:
|
|
|
|
# - ./scripts/openstack-cleanup/main.py
|
2020-03-13 06:12:39 +08:00
|
|
|
|
2020-05-10 06:19:50 +08:00
|
|
|
# tf-ovh_ubuntu18-calico:
|
|
|
|
# extends: .terraform_apply
|
|
|
|
# when: on_success
|
|
|
|
# variables:
|
|
|
|
# <<: *ovh_variables
|
|
|
|
# TF_VERSION: 0.12.24
|
|
|
|
# PROVIDER: openstack
|
|
|
|
# CLUSTER: $CI_COMMIT_REF_NAME
|
|
|
|
# ANSIBLE_TIMEOUT: "60"
|
|
|
|
# SSH_USER: ubuntu
|
|
|
|
# TF_VAR_number_of_k8s_masters: "0"
|
|
|
|
# TF_VAR_number_of_k8s_masters_no_floating_ip: "1"
|
|
|
|
# TF_VAR_number_of_k8s_masters_no_floating_ip_no_etcd: "0"
|
|
|
|
# TF_VAR_number_of_etcd: "0"
|
|
|
|
# TF_VAR_number_of_k8s_nodes: "0"
|
|
|
|
# TF_VAR_number_of_k8s_nodes_no_floating_ip: "1"
|
|
|
|
# TF_VAR_number_of_gfs_nodes_no_floating_ip: "0"
|
|
|
|
# TF_VAR_number_of_bastions: "0"
|
|
|
|
# TF_VAR_number_of_k8s_masters_no_etcd: "0"
|
|
|
|
# TF_VAR_use_neutron: "0"
|
|
|
|
# TF_VAR_floatingip_pool: "Ext-Net"
|
|
|
|
# TF_VAR_external_net: "6011fbc9-4cbf-46a4-8452-6890a340b60b"
|
|
|
|
# TF_VAR_network_name: "Ext-Net"
|
|
|
|
# TF_VAR_flavor_k8s_master: "defa64c3-bd46-43b4-858a-d93bbae0a229" # s1-8
|
|
|
|
# TF_VAR_flavor_k8s_node: "defa64c3-bd46-43b4-858a-d93bbae0a229" # s1-8
|
|
|
|
# TF_VAR_image: "Ubuntu 18.04"
|
|
|
|
# TF_VAR_k8s_allowed_remote_ips: '["0.0.0.0/0"]'
|
2019-05-28 16:51:53 +08:00
|
|
|
|
2020-05-10 06:19:50 +08:00
|
|
|
# tf-ovh_coreos-calico:
|
|
|
|
# extends: .terraform_apply
|
|
|
|
# when: on_success
|
|
|
|
# variables:
|
|
|
|
# <<: *ovh_variables
|
|
|
|
# TF_VERSION: 0.12.24
|
|
|
|
# PROVIDER: openstack
|
|
|
|
# CLUSTER: $CI_COMMIT_REF_NAME
|
|
|
|
# ANSIBLE_TIMEOUT: "60"
|
|
|
|
# SSH_USER: core
|
|
|
|
# TF_VAR_number_of_k8s_masters: "0"
|
|
|
|
# TF_VAR_number_of_k8s_masters_no_floating_ip: "1"
|
|
|
|
# TF_VAR_number_of_k8s_masters_no_floating_ip_no_etcd: "0"
|
|
|
|
# TF_VAR_number_of_etcd: "0"
|
|
|
|
# TF_VAR_number_of_k8s_nodes: "0"
|
|
|
|
# TF_VAR_number_of_k8s_nodes_no_floating_ip: "1"
|
|
|
|
# TF_VAR_number_of_gfs_nodes_no_floating_ip: "0"
|
|
|
|
# TF_VAR_number_of_bastions: "0"
|
|
|
|
# TF_VAR_number_of_k8s_masters_no_etcd: "0"
|
|
|
|
# TF_VAR_use_neutron: "0"
|
|
|
|
# TF_VAR_floatingip_pool: "Ext-Net"
|
|
|
|
# TF_VAR_external_net: "6011fbc9-4cbf-46a4-8452-6890a340b60b"
|
|
|
|
# TF_VAR_network_name: "Ext-Net"
|
|
|
|
# TF_VAR_flavor_k8s_master: "4d4fd037-9493-4f2b-9afe-b542b5248eac" # b2-7
|
|
|
|
# TF_VAR_flavor_k8s_node: "4d4fd037-9493-4f2b-9afe-b542b5248eac" # b2-7
|
|
|
|
# TF_VAR_image: "CoreOS Stable"
|
|
|
|
# TF_VAR_k8s_allowed_remote_ips: '["0.0.0.0/0"]'
|