Browse Source
Merge pull request #2317 from kubernetes-incubator/add_digitalocean_ci
Merge pull request #2317 from kubernetes-incubator/add_digitalocean_ci
Additional CI platform (digital-ocean)pull/2326/head
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 369 additions and 130 deletions
Unified View
Diff Options
-
275.gitlab-ci.yml
-
16Dockerfile
-
51tests/Makefile
-
97tests/cloud_playbooks/create-do.yml
-
10tests/files/do_ubuntu-canal-ha.yml
-
0tests/files/gce_centos-weave-kubeadm.yml
-
0tests/files/gce_centos7-calico-ha.yml
-
0tests/files/gce_centos7-flannel-addons.yml
-
0tests/files/gce_coreos-alpha-weave-ha.yml
-
0tests/files/gce_coreos-calico-aio.yml
-
0tests/files/gce_coreos-canal.yml
-
0tests/files/gce_debian8-calico-upgrade.yml
-
0tests/files/gce_rhel7-canal-sep.yml
-
0tests/files/gce_rhel7-weave.yml
-
0tests/files/gce_ubuntu-canal-ha.yml
-
0tests/files/gce_ubuntu-canal-kubeadm.yml
-
0tests/files/gce_ubuntu-contiv-sep.yml
-
0tests/files/gce_ubuntu-flannel-sep.yml
-
0tests/files/gce_ubuntu-rkt-sep.yml
-
0tests/files/gce_ubuntu-vault-sep.yml
-
0tests/files/gce_ubuntu-weave-sep.yml
-
2tests/requirements.txt
-
48tests/templates/inventory-do.j2
@ -0,0 +1,16 @@ |
|||||
|
FROM ubuntu:16.04 |
||||
|
|
||||
|
RUN mkdir /kubespray |
||||
|
WORKDIR /kubespray |
||||
|
RUN apt update -y && \ |
||||
|
apt install -y \ |
||||
|
libssl-dev python-dev sshpass apt-transport-https \ |
||||
|
ca-certificates curl gnupg2 software-properties-common python-pip |
||||
|
RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - && \ |
||||
|
add-apt-repository \ |
||||
|
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \ |
||||
|
$(lsb_release -cs) \ |
||||
|
stable" \ |
||||
|
&& apt update -y && apt-get install docker-ce -y |
||||
|
COPY . . |
||||
|
RUN /usr/bin/python -m pip install pip -U && /usr/bin/python -m pip install -r tests/requirements.txt && python -m pip install -r requirements.txt |
@ -0,0 +1,51 @@ |
|||||
|
INVENTORY=$(PWD)/../inventory/sample/hosts.ini |
||||
|
|
||||
|
$(HOME)/.ssh/id_rsa: |
||||
|
mkdir -p $(HOME)/.ssh |
||||
|
echo $(PRIVATE_KEY) | base64 -d > $(HOME)/.ssh/id_rsa |
||||
|
chmod 400 $(HOME)/.ssh/id_rsa |
||||
|
|
||||
|
init-gce: $(HOME)/.ssh/id_rsa |
||||
|
# echo $(GCE_PEM_FILE) | base64 -d > $(HOME)/.ssh/gce |
||||
|
echo "$(GCE_CREDENTIALS_B64)" | base64 -d > $(HOME)/.ssh/gce.json |
||||
|
|
||||
|
init-do: $(HOME)/.ssh/id_rsa |
||||
|
echo $(DO_PRIVATE_KEY) | base64 -d > $(HOME)/.ssh/id_rsa |
||||
|
|
||||
|
create-gce: init-gce |
||||
|
ansible-playbook cloud_playbooks/create-gce.yml -i local_inventory/hosts.cfg -c local \
|
||||
|
$(LOG_LEVEL) \
|
||||
|
-e @"files/${CI_JOB_NAME}.yml" \
|
||||
|
-e gce_credentials_file=$(HOME)/.ssh/gce.json \
|
||||
|
-e gce_project_id=$(GCE_PROJECT_ID) \
|
||||
|
-e gce_service_account_email=$(GCE_ACCOUNT) \
|
||||
|
-e inventory_path=$(INVENTORY) \
|
||||
|
-e test_id=$(TEST_ID) \
|
||||
|
-e preemptible=$(GCE_PREEMPTIBLE) |
||||
|
|
||||
|
|
||||
|
delete-gce: |
||||
|
ansible-playbook -i $(INVENTORY) cloud_playbooks/delete-gce.yml -c local \
|
||||
|
$(LOG_LEVEL) \
|
||||
|
-e @"files/${CI_JOB_NAME}.yml" \
|
||||
|
-e test_id=$(TEST_ID) \
|
||||
|
-e gce_project_id=$(GCE_PROJECT_ID) \
|
||||
|
-e gce_service_account_email=$(GCE_ACCOUNT) \
|
||||
|
-e gce_credentials_file=$(HOME)/.ssh/gce.json \
|
||||
|
-e inventory_path=$(INVENTORY) |
||||
|
|
||||
|
create-do: init-do |
||||
|
ansible-playbook cloud_playbooks/create-do.yml -i local_inventory/hosts.cfg -c local \
|
||||
|
${LOG_LEVEL} \
|
||||
|
-e @"files/${CI_JOB_NAME}.yml" \
|
||||
|
-e inventory_path=$(INVENTORY) \
|
||||
|
-e test_id=${TEST_ID} |
||||
|
|
||||
|
|
||||
|
delete-do: |
||||
|
ansible-playbook -i $(INVENTORY) cloud_playbooks/create-do.yml -c local \
|
||||
|
$(LOG_LEVEL) \
|
||||
|
-e @"files/${CI_JOB_NAME}.yml" \
|
||||
|
-e state=absent \
|
||||
|
-e test_id=${TEST_ID} \
|
||||
|
-e inventory_path=$(INVENTORY) |
@ -0,0 +1,97 @@ |
|||||
|
--- |
||||
|
- hosts: localhost |
||||
|
become: false |
||||
|
gather_facts: no |
||||
|
vars: |
||||
|
state: "present" |
||||
|
ssh_key_id: "6536865" |
||||
|
cloud_machine_type: 2gb |
||||
|
regions: |
||||
|
- nyc1 |
||||
|
- sfo1 |
||||
|
- nyc2 |
||||
|
- ams2 |
||||
|
- sgp1 |
||||
|
- lon1 |
||||
|
- nyc3 |
||||
|
- ams3 |
||||
|
- fra1 |
||||
|
- tor1 |
||||
|
- sfo2 |
||||
|
- blr1 |
||||
|
cloud_images: |
||||
|
- coreos-beta |
||||
|
- fedora-24-x64 |
||||
|
- centos-5-x64 |
||||
|
- centos-5-x32 |
||||
|
- fedora-25-x64 |
||||
|
- debian-7-x64 |
||||
|
- debian-7-x32 |
||||
|
- debian-8-x64 |
||||
|
- debian-8-x32 |
||||
|
- centos-6-x32 |
||||
|
- centos-6-x64 |
||||
|
- coreos-stable |
||||
|
- ubuntu-16-10-x32 |
||||
|
- ubuntu-16-10-x64 |
||||
|
- freebsd-11-0-x64-zfs |
||||
|
- freebsd-10-3-x64-zfs |
||||
|
- coreos-alpha |
||||
|
- ubuntu-12-04-x32 |
||||
|
- ubuntu-12-04-x64 |
||||
|
- ubuntu-16-04-x64 |
||||
|
- ubuntu-16-04-x32 |
||||
|
- ubuntu-14-04-x64 |
||||
|
- ubuntu-14-04-x32 |
||||
|
- centos-7-x64 |
||||
|
- freebsd-11-0-x64 |
||||
|
- freebsd-10-3-x64 |
||||
|
- centos-7-3-1611-x64 |
||||
|
mode: default |
||||
|
|
||||
|
tasks: |
||||
|
- name: replace_test_id |
||||
|
set_fact: |
||||
|
test_name: "{{test_id |regex_replace('\\.', '-')}}" |
||||
|
|
||||
|
- name: show vars |
||||
|
debug: msg="{{cloud_region}}, {{cloud_image}}" |
||||
|
|
||||
|
- set_fact: |
||||
|
instance_names: >- |
||||
|
{%- if mode in ['separate', 'ha'] -%} |
||||
|
["k8s-{{test_name}}-1", "k8s-{{test_name}}-2", "k8s-{{test_name}}-3"] |
||||
|
{%- else -%} |
||||
|
["k8s-{{test_name}}-1", "k8s-{{test_name}}-2"] |
||||
|
{%- endif -%} |
||||
|
|
||||
|
- name: Manage DO instances | {{state}} |
||||
|
digital_ocean: |
||||
|
unique_name: yes |
||||
|
api_token: "{{ lookup('env','DO_API_TOKEN') }}" |
||||
|
command: "droplet" |
||||
|
image_id: "{{ cloud_image }}" |
||||
|
name: "{{ item }}" |
||||
|
private_networking: no |
||||
|
region_id: "{{cloud_region}}" |
||||
|
size_id: "{{cloud_machine_type}}" |
||||
|
ssh_key_ids: "{{ssh_key_id}}" |
||||
|
state: "{{state}}" |
||||
|
wait: yes |
||||
|
register: droplets |
||||
|
with_items: "{{instance_names}}" |
||||
|
|
||||
|
- debug: |
||||
|
msg: "{{droplets}}, {{inventory_path}}" |
||||
|
when: "{{ state == 'present' }}" |
||||
|
|
||||
|
- name: Template the inventory |
||||
|
template: |
||||
|
src: ../templates/inventory-do.j2 |
||||
|
dest: "{{ inventory_path }}" |
||||
|
when: "{{ state == 'present' }}" |
||||
|
|
||||
|
- name: Wait for SSH to come up |
||||
|
wait_for: host={{item.droplet.ip_address}} port=22 delay=10 timeout=180 state=started |
||||
|
with_items: "{{droplets.results}}" |
||||
|
when: "{{ state == 'present' }}" |
@ -0,0 +1,10 @@ |
|||||
|
cloud_image: ubuntu-16-04-x64 |
||||
|
cloud_region: nyc3 |
||||
|
mode: ha |
||||
|
|
||||
|
# Deployment settings |
||||
|
bootstrap_os: ubuntu |
||||
|
kube_network_plugin: canal |
||||
|
deploy_netchecker: true |
||||
|
kubedns_min_replicas: 1 |
||||
|
# cloud_provider: 'do' |
@ -0,0 +1,48 @@ |
|||||
|
{% for instance in droplets.results %} |
||||
|
{{instance.droplet.name}} ansible_ssh_host={{instance.droplet.ip_address}} |
||||
|
{% endfor %} |
||||
|
|
||||
|
{% if mode is defined and mode == "separate" %} |
||||
|
[kube-master] |
||||
|
{{droplets.results[0].droplet.name}} |
||||
|
|
||||
|
[kube-node] |
||||
|
{{droplets.results[1].droplet.name}} |
||||
|
|
||||
|
[etcd] |
||||
|
{{droplets.results[2].droplet.name}} |
||||
|
|
||||
|
[vault] |
||||
|
{{droplets.results[2].droplet.name}} |
||||
|
{% elif mode is defined and mode == "ha" %} |
||||
|
[kube-master] |
||||
|
{{droplets.results[0].droplet.name}} |
||||
|
{{droplets.results[1].droplet.name}} |
||||
|
|
||||
|
[kube-node] |
||||
|
{{droplets.results[2].droplet.name}} |
||||
|
|
||||
|
[etcd] |
||||
|
{{droplets.results[1].droplet.name}} |
||||
|
{{droplets.results[2].droplet.name}} |
||||
|
|
||||
|
[vault] |
||||
|
{{droplets.results[1].droplet.name}} |
||||
|
{{droplets.results[2].droplet.name}} |
||||
|
{% else %} |
||||
|
[kube-master] |
||||
|
{{droplets.results[0].droplet.name}} |
||||
|
|
||||
|
[kube-node] |
||||
|
{{droplets.results[1].droplet.name}} |
||||
|
|
||||
|
[etcd] |
||||
|
{{droplets.results[0].droplet.name}} |
||||
|
|
||||
|
[vault] |
||||
|
{{droplets.results[0].droplet.name}} |
||||
|
{% endif %} |
||||
|
|
||||
|
[k8s-cluster:children] |
||||
|
kube-node |
||||
|
kube-master |
Write
Preview
Loading…
Cancel
Save