From 277c639f0869c23918038556c3b9552542bee85b Mon Sep 17 00:00:00 2001 From: okozachenko Date: Mon, 22 Jun 2020 19:42:09 +0300 Subject: [PATCH] Add rpc_backend override in devstack Change-Id: Ibc641fc1a52f77b50a1ce193c081cf401b002973 --- devstack/lib/common | 11 +++++++++++ devstack/lib/rpc_backend | 33 +++++++++++++++++++++++++++++++++ devstack/settings | 1 + 3 files changed, 45 insertions(+) create mode 100755 devstack/lib/rpc_backend diff --git a/devstack/lib/common b/devstack/lib/common index 2b85147e..c972f69b 100644 --- a/devstack/lib/common +++ b/devstack/lib/common @@ -90,3 +90,14 @@ spec: EOF } export -f _get_or_create_endpoint_with_interface + +# Get plain data from the specified secret +# Usage: get_data_from_secret +function get_data_from_secret { + local secret=$1 + local ns=$2 + local key=$3 + local data=$(kubectl get secret -n $ns $secret -o jsonpath="{.data.$key}" | base64 --decode) + echo $data +} +export -f get_data_from_secret \ No newline at end of file diff --git a/devstack/lib/rpc_backend b/devstack/lib/rpc_backend new file mode 100755 index 00000000..49a239be --- /dev/null +++ b/devstack/lib/rpc_backend @@ -0,0 +1,33 @@ +#!/bin/bash +# +# Copyright 2020 VEXXHOST, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + + +# iniset rpc configuration +function iniset_k8s_rpc_backend { + local package=$1 + local file=$2 + local section=${3:-DEFAULT} + local conn_url=$4 + + iniset $file $section transport_url $conn_url + if [ -n "$RABBIT_HEARTBEAT_TIMEOUT_THRESHOLD" ]; then + iniset $file oslo_messaging_rabbit heartbeat_timeout_threshold $RABBIT_HEARTBEAT_TIMEOUT_THRESHOLD + fi + if [ -n "$RABBIT_HEARTBEAT_RATE" ]; then + iniset $file oslo_messaging_rabbit heartbeat_rate $RABBIT_HEARTBEAT_RATE + fi +} +export -f iniset_k8s_rpc_backend \ No newline at end of file diff --git a/devstack/settings b/devstack/settings index 19525c42..37b502d9 100644 --- a/devstack/settings +++ b/devstack/settings @@ -19,3 +19,4 @@ define_plugin openstack-operator source $DEST/openstack-operator/devstack/lib/common source $DEST/openstack-operator/devstack/lib/glance source $DEST/openstack-operator/devstack/lib/keystone +source $DEST/openstack-operator/devstack/lib/rpc_backend