summaryrefslogtreecommitdiffstats
path: root/xci/installer/osh/playbooks/configure-kubenet.yml
diff options
context:
space:
mode:
authornikoskarandreas <nick@intracom-telecom.com>2019-02-22 13:04:29 +0200
committernikoskarandreas <nick@intracom-telecom.com>2019-08-01 07:13:40 -0400
commit0d6907e04a51aface7ed6cd456f4e20f2d2ad0e2 (patch)
treea3ee23be9aee9cea0032b1df89de01ee486b8728 /xci/installer/osh/playbooks/configure-kubenet.yml
parent3bfb68f11c8f2579a0daff825fb54c64641a26b0 (diff)
Introduction of Openstack-helm as installer
This patch creates a new installer tree in xci that uses openstack-helm to deploy openstack on a kubernetes cluster. USAGE: Export INSTALLER_TYPE=osh, DEPLOY_SCENARIO=k8-calico-nofeature and XCI_FLAVOR=noha or mini and run xci-deploy.sh as in documentation. deploy-scenario:k8-calico-nofeature installer-type:osh Change-Id: I212f70eb51c2a38c798c11367d2ebb8bf5f4a1de Signed-off-by: nikoskarandreas <nick@intracom-telecom.com>
Diffstat (limited to 'xci/installer/osh/playbooks/configure-kubenet.yml')
-rw-r--r--xci/installer/osh/playbooks/configure-kubenet.yml51
1 files changed, 51 insertions, 0 deletions
diff --git a/xci/installer/osh/playbooks/configure-kubenet.yml b/xci/installer/osh/playbooks/configure-kubenet.yml
new file mode 100644
index 00000000..18a126c1
--- /dev/null
+++ b/xci/installer/osh/playbooks/configure-kubenet.yml
@@ -0,0 +1,51 @@
+---
+# SPDX-license-identifier: Apache-2.0
+##############################################################################
+# Copyright (c) 2018 SUSE LINUX GmbH and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+# NOTE(hwoarang) Kubenet expects networking to be prepared by the administrator so it's necessary
+# to do that as part of the node configuration. All we need is to add static routes on every node
+# so cbr0 interfaces can talk to each other.
+- name: Prepare networking for kubenet
+ hosts: k8s-cluster
+ remote_user: root
+ gather_facts: True
+ become: yes
+ vars_files:
+ - "{{ xci_path }}/xci/var/opnfv.yml"
+ tasks:
+ - name: Configure static routes
+ block:
+ - name: Collect cbr0 information from the nodes
+ set_fact:
+ kubenet_xci_static_routes: |-
+ {% set static_routes = [] %}
+ {% for host in groups['k8s-cluster']|select("ne", inventory_hostname) %}
+ {%- set _ = static_routes.append(
+ {'network': (hostvars[host]['ansible_cbr0']['ipv4']['network']+'/'+
+ hostvars[host]['ansible_cbr0']['ipv4']['netmask'])|ipaddr('net'),
+ 'gateway': hostvars[host]['ansible_default_ipv4']['address']}) -%}
+ {% endfor %}
+ {{ static_routes }}
+
+ - name: Add static routes on each node
+ shell: "ip route show | grep -q {{ item.network }} || ip route add {{ item.network }} via {{ item.gateway }}"
+ with_items: "{{ kubenet_xci_static_routes }}"
+ loop_control:
+ label: "{{ item.network }}"
+ when: deploy_scenario.find('k8-nosdn-') != -1
+
+ - name: Ensure rp_filter is disabled on localhost
+ sysctl:
+ name: net.ipv4.conf.all.rp_filter
+ sysctl_set: yes
+ state: present
+ value: "{{ (kubenet_xci_static_routes is defined) | ternary(0, 1) }}"
+ reload: yes
+ delegate_to: localhost
+ run_once: True