choose between gce and aws cloud providers
This commit is contained in:
parent
f49926413a
commit
68fafd030d
7 changed files with 22 additions and 14 deletions
|
@ -128,7 +128,7 @@ script:
|
||||||
-e cloud_region=${CLOUD_REGION}
|
-e cloud_region=${CLOUD_REGION}
|
||||||
|
|
||||||
# Create cluster
|
# Create cluster
|
||||||
- "$HOME/.local/bin/ansible-playbook -i inventory/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} cluster.yml"
|
- "$HOME/.local/bin/ansible-playbook -i inventory/inventory.ini -u $SSH_USER -e ansible_ssh_user=$SSH_USER $SSH_ARGS -b --become-user=root -e cloud_provider=gce $LOG_LEVEL -e kube_network_plugin=${KUBE_NETWORK_PLUGIN} cluster.yml"
|
||||||
# Tests Cases
|
# Tests Cases
|
||||||
## Test Master API
|
## Test Master API
|
||||||
- $HOME/.local/bin/ansible-playbook -i inventory/inventory.ini tests/testcases/010_check-apiserver.yml $LOG_LEVEL
|
- $HOME/.local/bin/ansible-playbook -i inventory/inventory.ini tests/testcases/010_check-apiserver.yml $LOG_LEVEL
|
||||||
|
|
|
@ -101,6 +101,11 @@ dns_domain: "{{ cluster_name }}"
|
||||||
skydns_server: "{{ kube_service_addresses|ipaddr('net')|ipaddr(3)|ipaddr('address') }}"
|
skydns_server: "{{ kube_service_addresses|ipaddr('net')|ipaddr(3)|ipaddr('address') }}"
|
||||||
dns_server: "{{ kube_service_addresses|ipaddr('net')|ipaddr(2)|ipaddr('address') }}"
|
dns_server: "{{ kube_service_addresses|ipaddr('net')|ipaddr(2)|ipaddr('address') }}"
|
||||||
|
|
||||||
|
# There are some changes specific to the cloud providers
|
||||||
|
# for instance we need to encapsulate packets with some network plugins
|
||||||
|
# If set the possible values are either 'gce' or 'aws'
|
||||||
|
# cloud_provider:
|
||||||
|
|
||||||
# For multi masters architecture:
|
# For multi masters architecture:
|
||||||
# kube-proxy doesn't support multiple apiservers for the time being so you'll need to configure your own loadbalancer
|
# kube-proxy doesn't support multiple apiservers for the time being so you'll need to configure your own loadbalancer
|
||||||
# This domain name will be inserted into the /etc/hosts file of all servers
|
# This domain name will be inserted into the /etc/hosts file of all servers
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
---
|
---
|
||||||
|
- src: https://gitlab.com/kubespray-ansibl8s/k8s-dashboard.git
|
||||||
|
path: roles/apps
|
||||||
|
scm: git
|
||||||
|
|
||||||
- src: https://gitlab.com/kubespray-ansibl8s/k8s-common.git
|
- src: https://gitlab.com/kubespray-ansibl8s/k8s-common.git
|
||||||
path: roles/apps
|
path: roles/apps
|
||||||
scm: git
|
scm: git
|
||||||
|
@ -7,14 +11,6 @@
|
||||||
path: roles/apps
|
path: roles/apps
|
||||||
scm: git
|
scm: git
|
||||||
|
|
||||||
- src: https://gitlab.com/kubespray-ansibl8s/k8s-kube-ui.git
|
|
||||||
path: roles/apps
|
|
||||||
scm: git
|
|
||||||
|
|
||||||
- src: https://gitlab.com/kubespray-ansibl8s/k8s-fabric8.git
|
|
||||||
path: roles/apps
|
|
||||||
scm: git
|
|
||||||
|
|
||||||
- src: https://gitlab.com/kubespray-ansibl8s/k8s-elasticsearch.git
|
- src: https://gitlab.com/kubespray-ansibl8s/k8s-elasticsearch.git
|
||||||
path: roles/apps
|
path: roles/apps
|
||||||
scm: git
|
scm: git
|
||||||
|
|
|
@ -46,6 +46,11 @@
|
||||||
owner: kube
|
owner: kube
|
||||||
when: ansible_service_mgr in ["sysvinit","upstart"]
|
when: ansible_service_mgr in ["sysvinit","upstart"]
|
||||||
|
|
||||||
|
- name: check cloud_provider value
|
||||||
|
fail:
|
||||||
|
msg: "If set the 'cloud_provider' var must be set eithe to 'gce' or 'aws'"
|
||||||
|
when: cloud_provider is defined and cloud_provider not in ['gce', 'aws']
|
||||||
|
|
||||||
- name: Create cni directories
|
- name: Create cni directories
|
||||||
file:
|
file:
|
||||||
path: "{{ item }}"
|
path: "{{ item }}"
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
---
|
---
|
||||||
# Enables Internet connectivity from containers
|
# Enables Internet connectivity from containers
|
||||||
nat_outgoing: true
|
nat_outgoing: true
|
||||||
# cloud_provider: no
|
|
||||||
|
# cloud_provider can only be set to 'gce' or 'aws'
|
||||||
|
# cloud_provider:
|
||||||
|
|
|
@ -51,19 +51,19 @@
|
||||||
- name: Calico | Configure calico network pool
|
- name: Calico | Configure calico network pool
|
||||||
command: "{{ bin_dir }}/calicoctl pool add {{ kube_pods_subnet }}"
|
command: "{{ bin_dir }}/calicoctl pool add {{ kube_pods_subnet }}"
|
||||||
run_once: true
|
run_once: true
|
||||||
when: calico_conf.status == 404 and (cloud_provider is not defined or cloud_provider != True)
|
when: calico_conf.status == 404 and cloud_provider is not defined
|
||||||
and not nat_outgoing|default(false) or
|
and not nat_outgoing|default(false) or
|
||||||
(nat_outgoing|default(false) and peer_with_router|default(false))
|
(nat_outgoing|default(false) and peer_with_router|default(false))
|
||||||
|
|
||||||
- name: Calico | Configure calico network pool for cloud
|
- name: Calico | Configure calico network pool for cloud
|
||||||
command: "{{ bin_dir }}/calicoctl pool add {{ kube_pods_subnet }} --ipip --nat-outgoing"
|
command: "{{ bin_dir }}/calicoctl pool add {{ kube_pods_subnet }} --ipip --nat-outgoing"
|
||||||
run_once: true
|
run_once: true
|
||||||
when: calico_conf.status == 404 and cloud_provider is defined and cloud_provider == True
|
when: calico_conf.status == 404 and cloud_provider is defined
|
||||||
|
|
||||||
- name: Calico | Configure calico network pool with nat outgoing
|
- name: Calico | Configure calico network pool with nat outgoing
|
||||||
command: "{{ bin_dir}}/calicoctl pool add {{ kube_pods_subnet }} --nat-outgoing"
|
command: "{{ bin_dir}}/calicoctl pool add {{ kube_pods_subnet }} --nat-outgoing"
|
||||||
run_once: true
|
run_once: true
|
||||||
when: calico_conf.status == 404 and (cloud_provider is not defined or cloud_provider != True)
|
when: calico_conf.status == 404 and cloud_provider is not defined
|
||||||
and nat_outgoing|default(false) and not peer_with_router|default(false)
|
and nat_outgoing|default(false) and not peer_with_router|default(false)
|
||||||
|
|
||||||
- name: Calico | Get calico configuration from etcd
|
- name: Calico | Get calico configuration from etcd
|
||||||
|
|
|
@ -58,7 +58,7 @@ def install_cluster(inventory_path, credentialsId, network_plugin) {
|
||||||
extraVars: [
|
extraVars: [
|
||||||
kube_network_plugin: network_plugin
|
kube_network_plugin: network_plugin
|
||||||
],
|
],
|
||||||
extras: "-e '{\"cloud_provider\": true}'",
|
extras: "-e cloud_provider=aws",
|
||||||
colorized: true
|
colorized: true
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue