5cba8b1614
* Wait for kube-apiserver availability before starting upgrade I am experiencing a timing issue when upgrading from kubespray 2.11.0(k8s 1.15.3) to kubespray 2.12.6(k8s 1.16.9). The certificates get replaced in `kubeadm-secondary-legacy.yml` and kube-apiserver notices a mismatch (for a fraction of a second) between `apiserver.crt` and `apiserver.key` which causes it to restart. And sometimes ( ~ 1 out of 5 upgrades) the kube-apiserver isn't back on time for the start of the upgrade task. It fails when kubeadm checks with the kube-apiserver to start the upgrade. The kube-apiserver returns a `connect: connection refused`. I have created this small task to check the availability of the kube-apiserver before starting the upgrade, so that the upgrade will run without an issue. Signed-off-by: Rick Haan <rickhaan94@gmail.com> * Fix markdownlint * Remove old CI Co-authored-by: Maxime Guyot <maxime@root314.com>
94 lines
2.6 KiB
YAML
94 lines
2.6 KiB
YAML
---
|
|
# Tests for contrib/terraform/
|
|
.terraform_install:
|
|
extends: .job
|
|
before_script:
|
|
- update-alternatives --install /usr/bin/python python /usr/bin/python3 1
|
|
- ./tests/scripts/rebase.sh
|
|
- ./tests/scripts/testcases_prepare.sh
|
|
- ./tests/scripts/terraform_install.sh
|
|
# Set Ansible config
|
|
- cp ansible.cfg ~/.ansible.cfg
|
|
# Prepare inventory
|
|
- cp contrib/terraform/$PROVIDER/sample-inventory/cluster.tfvars .
|
|
- ln -s contrib/terraform/$PROVIDER/hosts
|
|
- terraform init contrib/terraform/$PROVIDER
|
|
# 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
|
|
only: ['master', /^pr-.*$/]
|
|
script:
|
|
- terraform validate -var-file=cluster.tfvars contrib/terraform/$PROVIDER
|
|
- terraform fmt -check -diff contrib/terraform/$PROVIDER
|
|
|
|
.terraform_apply:
|
|
extends: .terraform_install
|
|
stage: deploy-part2
|
|
when: manual
|
|
only: [/^pr-.*$/]
|
|
variables:
|
|
ANSIBLE_INVENTORY_UNPARSED_FAILED: "true"
|
|
ANSIBLE_INVENTORY: hosts
|
|
CI_PLATFORM: tf
|
|
TF_VAR_ssh_user: $SSH_USER
|
|
TF_VAR_cluster_name: $CI_JOB_ID
|
|
script:
|
|
- tests/scripts/testcases_run.sh
|
|
after_script:
|
|
# Cleanup regardless of exit code
|
|
- ./tests/scripts/testcases_cleanup.sh
|
|
|
|
tf-validate-openstack:
|
|
extends: .terraform_validate
|
|
variables:
|
|
TF_VERSION: 0.12.12
|
|
PROVIDER: openstack
|
|
CLUSTER: $CI_COMMIT_REF_NAME
|
|
|
|
tf-validate-packet:
|
|
extends: .terraform_validate
|
|
variables:
|
|
TF_VERSION: 0.12.12
|
|
PROVIDER: packet
|
|
CLUSTER: $CI_COMMIT_REF_NAME
|
|
|
|
tf-validate-aws:
|
|
extends: .terraform_validate
|
|
variables:
|
|
TF_VERSION: 0.12.12
|
|
PROVIDER: aws
|
|
CLUSTER: $CI_COMMIT_REF_NAME
|
|
|
|
# tf-packet-ubuntu16-default:
|
|
# extends: .terraform_apply
|
|
# variables:
|
|
# TF_VERSION: 0.12.12
|
|
# 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:
|
|
# TF_VERSION: 0.12.12
|
|
# 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
|