From 159fe3e0ae75f774c9329f9ba2e78de603cbd749 Mon Sep 17 00:00:00 2001 From: Yossi Boaron Date: Tue, 24 Apr 2018 22:24:38 +0300 Subject: [PATCH] OCP-Router: add support for external Ingress Controller's LB creation This is the first patch of the Ingress Controller capability. In order for the K8S Ingress and OpenShift Route resources to work, the cluster must have an Ingress Controller running. The Kuryr's Ingress Controller implementation will be based on Octavia L7 load balancing. This patch adds support for the creation of an external Load Balancer in Devstack deployment, the follow-up Ingress Controller patches will configure the L7 rules in that LB to perform the actual L7 routing. Partially Implements: blueprint openshift-router-support Change-Id: I9c18bd1d2d0f2127a1a924efe7976a38b6f7cc51 --- devstack/lib/kuryr_kubernetes | 63 ++++++++++++++++++++++------ devstack/local.conf.openshift.sample | 14 +++++++ devstack/plugin.sh | 55 +++++++++++++++++++++++- devstack/settings | 6 +++ 4 files changed, 123 insertions(+), 15 deletions(-) diff --git a/devstack/lib/kuryr_kubernetes b/devstack/lib/kuryr_kubernetes index 7a7b07978..14c7193be 100644 --- a/devstack/lib/kuryr_kubernetes +++ b/devstack/lib/kuryr_kubernetes @@ -316,10 +316,23 @@ function create_k8s_router_fake_service { --os-region "$REGION_NAME" \ subnet show "$KURYR_NEUTRON_DEFAULT_SERVICE_SUBNET" \ -f value -c gateway_ip) + create_k8s_fake_service $fake_svc_name $router_ip +} + +# create_k8s_fake_service +# Description: Creates an endpoint-less kubernetes service to keep Kubernetes +# API server from allocating this IP for another service +function create_k8s_fake_service { + local svc_name + local svc_ip + + fake_svc_name="$1" + fake_svc_ip="$2" + existing_svc_ip=$(/usr/local/bin/kubectl get svc --namespace kube-system -o jsonpath='{.items[?(@.metadata.name=='"\"${fake_svc_name}\""')].spec.clusterIP}') if [[ "$existing_svc_ip" == "" ]]; then - # Create fake router service so the router clusterIP can't be reassigned + # Create fake service so the clusterIP can't be reassigned cat <