From aac8345c4cc98873812a021483c7a22fdaf32d17 Mon Sep 17 00:00:00 2001 From: "hagun.kim" Date: Tue, 15 Jan 2019 10:59:18 +0900 Subject: [PATCH] Octavia: add octavia chart and deployment scripts This PS adds octavia chart and its deployment scripts. Blueprint name : openstack-helm-octavia - Deployments : api, worker, housekeeping - Daemonset : health-manager - health-manager daemonset creates o-hm device on each controller node. - This is for multi node deployment. - 180-create-resource-for-octavia.sh : Create openstack resources (network, sec groups, flavor, keypair, image for development) - 190-create-octavia-certs.sh : Create certificates to use Octavia (the certs is passed into pod using secret and volume for development) - 200-octavia.sh : Deploy Octavia chart Note: This chart doesn't include amphora image itself and its build. Change-Id: I0bb7dfc7c15d77287c05a8542347e19fc269aba4 Signed-off-by: hagun.kim --- neutron/templates/configmap-etc.yaml | 4 + neutron/values.yaml | 17 + octavia/Chart.yaml | 25 + octavia/requirements.yaml | 18 + octavia/templates/bin/_bootstrap.sh.tpl | 20 + octavia/templates/bin/_db-sync.sh.tpl | 21 + octavia/templates/bin/_octavia-api.sh.tpl | 31 + .../_octavia-health-manager-get-port.sh.tpl | 28 + .../_octavia-health-manager-nic-init.sh.tpl | 35 + .../bin/_octavia-health-manager.sh.tpl | 38 + .../bin/_octavia-housekeeping.sh.tpl | 31 + octavia/templates/bin/_octavia-worker.sh.tpl | 31 + octavia/templates/configmap-bin.yaml | 62 ++ octavia/templates/configmap-etc.yaml | 117 +++ .../templates/daemonset-health-manager.yaml | 159 ++++ octavia/templates/deployment-api.yaml | 105 +++ .../templates/deployment-housekeeping.yaml | 99 +++ octavia/templates/deployment-worker.yaml | 100 +++ octavia/templates/ingress-api.yaml | 21 + octavia/templates/job-bootstrap.yaml | 21 + octavia/templates/job-db-drop.yaml | 20 + octavia/templates/job-db-init.yaml | 20 + octavia/templates/job-db-sync.yaml | 20 + octavia/templates/job-image-repo-sync.yaml | 20 + octavia/templates/job-ks-endpoint.yaml | 20 + octavia/templates/job-ks-service.yaml | 20 + octavia/templates/job-ks-user.yaml | 20 + octavia/templates/job-rabbit-init.yaml | 19 + octavia/templates/network_policy.yaml | 18 + octavia/templates/pdb-api.yaml | 29 + octavia/templates/secret-db.yaml | 30 + octavia/templates/secret-ingress-tls.yaml | 19 + octavia/templates/secret-keystone.yaml | 30 + octavia/templates/secret-rabbitmq.yaml | 30 + octavia/templates/service-api.yaml | 36 + octavia/templates/service-ingress-api.yaml | 20 + octavia/values.yaml | 681 ++++++++++++++++++ .../ceph/180-create-resource-for-octavia.sh | 1 + .../ceph/190-create-octavia-certs.sh | 1 + .../deployment/developer/ceph/200-octavia.sh | 1 + .../common/180-create-resource-for-octavia.sh | 84 +++ .../common/190-create-octavia-certs.sh | 49 ++ .../developer/common/200-octavia.sh | 123 ++++ .../nfs/180-create-resource-for-octavia.sh | 1 + .../developer/nfs/190-create-octavia-certs.sh | 1 + tools/deployment/developer/nfs/200-octavia.sh | 1 + 46 files changed, 2297 insertions(+) create mode 100644 octavia/Chart.yaml create mode 100644 octavia/requirements.yaml create mode 100644 octavia/templates/bin/_bootstrap.sh.tpl create mode 100644 octavia/templates/bin/_db-sync.sh.tpl create mode 100644 octavia/templates/bin/_octavia-api.sh.tpl create mode 100644 octavia/templates/bin/_octavia-health-manager-get-port.sh.tpl create mode 100644 octavia/templates/bin/_octavia-health-manager-nic-init.sh.tpl create mode 100644 octavia/templates/bin/_octavia-health-manager.sh.tpl create mode 100644 octavia/templates/bin/_octavia-housekeeping.sh.tpl create mode 100644 octavia/templates/bin/_octavia-worker.sh.tpl create mode 100644 octavia/templates/configmap-bin.yaml create mode 100644 octavia/templates/configmap-etc.yaml create mode 100644 octavia/templates/daemonset-health-manager.yaml create mode 100644 octavia/templates/deployment-api.yaml create mode 100644 octavia/templates/deployment-housekeeping.yaml create mode 100644 octavia/templates/deployment-worker.yaml create mode 100644 octavia/templates/ingress-api.yaml create mode 100644 octavia/templates/job-bootstrap.yaml create mode 100644 octavia/templates/job-db-drop.yaml create mode 100644 octavia/templates/job-db-init.yaml create mode 100644 octavia/templates/job-db-sync.yaml create mode 100644 octavia/templates/job-image-repo-sync.yaml create mode 100644 octavia/templates/job-ks-endpoint.yaml create mode 100644 octavia/templates/job-ks-service.yaml create mode 100644 octavia/templates/job-ks-user.yaml create mode 100644 octavia/templates/job-rabbit-init.yaml create mode 100644 octavia/templates/network_policy.yaml create mode 100644 octavia/templates/pdb-api.yaml create mode 100644 octavia/templates/secret-db.yaml create mode 100644 octavia/templates/secret-ingress-tls.yaml create mode 100644 octavia/templates/secret-keystone.yaml create mode 100644 octavia/templates/secret-rabbitmq.yaml create mode 100644 octavia/templates/service-api.yaml create mode 100644 octavia/templates/service-ingress-api.yaml create mode 100644 octavia/values.yaml create mode 120000 tools/deployment/developer/ceph/180-create-resource-for-octavia.sh create mode 120000 tools/deployment/developer/ceph/190-create-octavia-certs.sh create mode 120000 tools/deployment/developer/ceph/200-octavia.sh create mode 100755 tools/deployment/developer/common/180-create-resource-for-octavia.sh create mode 100755 tools/deployment/developer/common/190-create-octavia-certs.sh create mode 100755 tools/deployment/developer/common/200-octavia.sh create mode 120000 tools/deployment/developer/nfs/180-create-resource-for-octavia.sh create mode 120000 tools/deployment/developer/nfs/190-create-octavia-certs.sh create mode 120000 tools/deployment/developer/nfs/200-octavia.sh diff --git a/neutron/templates/configmap-etc.yaml b/neutron/templates/configmap-etc.yaml index b07f16fb05..62eb9d626b 100644 --- a/neutron/templates/configmap-etc.yaml +++ b/neutron/templates/configmap-etc.yaml @@ -84,6 +84,10 @@ limitations under the License. {{- $_ := set $envAll.Values.conf.neutron.nova "password" $envAll.Values.endpoints.identity.auth.nova.password -}} {{- end -}} +{{- if empty $envAll.Values.conf.neutron.octavia.base_url -}} +{{- $_ := tuple "load_balancer" "internal" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_uri_lookup"| set $envAll.Values.conf.neutron.octavia "base_url" -}} +{{- end }} + {{/* nova_metadata_ip can go away when Newton is no longer supported, otherwise just set it along with nova_metadata_host. diff --git a/neutron/values.yaml b/neutron/values.yaml index 6c04b9fcb1..814233637b 100644 --- a/neutron/values.yaml +++ b/neutron/values.yaml @@ -1765,6 +1765,8 @@ conf: memcache_security_strategy: ENCRYPT auth_type: password auth_version: v3 + octavia: + request_poll_timeout: 3000 logging: loggers: keys: @@ -2133,6 +2135,21 @@ endpoints: api: default: 9696 public: 80 + load_balancer: + name: octavia + hosts: + default: octavia-api + public: octavia + host_fqdn_override: + default: null + path: + default: null + scheme: + default: http + port: + api: + default: 9876 + public: 80 fluentd: namespace: osh-infra name: fluentd diff --git a/octavia/Chart.yaml b/octavia/Chart.yaml new file mode 100644 index 0000000000..e9cceb99d0 --- /dev/null +++ b/octavia/Chart.yaml @@ -0,0 +1,25 @@ +# Copyright 2019 Samsung Electronics Co., Ltd. +# +# 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. + +apiVersion: v1 +description: OpenStack-Helm Octavia +name: octavia +version: 0.1.0 +home: https://docs.openstack.org/octavia/latest/ +icon: https://www.openstack.org/themes/openstack/images/project-mascots/Octavia/OpenStack_Project_Octavia_vertical.png +sources: + - https://opendev.org/openstack/octavia + - https://opendev.org/openstack/openstack-helm +maintainers: + - name: OpenStack-Helm Authors diff --git a/octavia/requirements.yaml b/octavia/requirements.yaml new file mode 100644 index 0000000000..35cf13c6a8 --- /dev/null +++ b/octavia/requirements.yaml @@ -0,0 +1,18 @@ +# Copyright 2019 Samsung Electronics Co., Ltd. +# +# 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. + +dependencies: + - name: helm-toolkit + repository: http://localhost:8879/charts + version: 0.1.0 diff --git a/octavia/templates/bin/_bootstrap.sh.tpl b/octavia/templates/bin/_bootstrap.sh.tpl new file mode 100644 index 0000000000..98d1b371c2 --- /dev/null +++ b/octavia/templates/bin/_bootstrap.sh.tpl @@ -0,0 +1,20 @@ +#!/bin/bash + +{{/* +Copyright 2019 Samsung Electronics Co., Ltd. + +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. +*/}} + +set -ex +{{ .Values.bootstrap.script | default "echo 'Not Enabled'" }} diff --git a/octavia/templates/bin/_db-sync.sh.tpl b/octavia/templates/bin/_db-sync.sh.tpl new file mode 100644 index 0000000000..ae7e3c8961 --- /dev/null +++ b/octavia/templates/bin/_db-sync.sh.tpl @@ -0,0 +1,21 @@ +#!/bin/bash + +{{/* +Copyright 2019 Samsung Electronics Co., Ltd. + +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. +*/}} + +set -ex + +octavia-db-manage upgrade head diff --git a/octavia/templates/bin/_octavia-api.sh.tpl b/octavia/templates/bin/_octavia-api.sh.tpl new file mode 100644 index 0000000000..9e322689cc --- /dev/null +++ b/octavia/templates/bin/_octavia-api.sh.tpl @@ -0,0 +1,31 @@ +#!/bin/bash + +{{/* +Copyright 2019 Samsung Electronics Co., Ltd. + +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. +*/}} + +set -ex +COMMAND="${@:-start}" + +function start () { + exec octavia-api \ + --config-file /etc/octavia/octavia.conf +} + +function stop () { + kill -TERM 1 +} + +$COMMAND diff --git a/octavia/templates/bin/_octavia-health-manager-get-port.sh.tpl b/octavia/templates/bin/_octavia-health-manager-get-port.sh.tpl new file mode 100644 index 0000000000..fbe8f6ad13 --- /dev/null +++ b/octavia/templates/bin/_octavia-health-manager-get-port.sh.tpl @@ -0,0 +1,28 @@ +#!/bin/bash + +{{/* +Copyright 2019 Samsung Electronics Co., Ltd. + +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. +*/}} + +set -ex + +HOSTNAME=$(hostname -s) +PORTNAME=octavia-health-manager-port-$HOSTNAME + +HM_PORT_ID=$(openstack port show $PORTNAME -c id -f value) +HM_PORT_MAC=$(openstack port show $PORTNAME -c mac_address -f value) + +echo $HM_PORT_ID > /tmp/pod-shared/HM_PORT_ID +echo $HM_PORT_MAC > /tmp/pod-shared/HM_PORT_MAC diff --git a/octavia/templates/bin/_octavia-health-manager-nic-init.sh.tpl b/octavia/templates/bin/_octavia-health-manager-nic-init.sh.tpl new file mode 100644 index 0000000000..0317c3d334 --- /dev/null +++ b/octavia/templates/bin/_octavia-health-manager-nic-init.sh.tpl @@ -0,0 +1,35 @@ +#!/bin/bash + +{{/* +Copyright 2019 Samsung Electronics Co., Ltd. + +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. +*/}} + +set -ex + +HM_PORT_ID=$(cat /tmp/pod-shared/HM_PORT_ID) +HM_PORT_MAC=$(cat /tmp/pod-shared/HM_PORT_MAC) + +ovs-vsctl --no-wait show + +ovs-vsctl --may-exist add-port br-int o-hm0 \ + -- set Interface o-hm0 type=internal \ + -- set Interface o-hm0 external-ids:iface-status=active \ + -- set Interface o-hm0 external-ids:attached-mac=$HM_PORT_MAC \ + -- set Interface o-hm0 external-ids:iface-id=$HM_PORT_ID \ + -- set Interface o-hm0 external-ids:skip_cleanup=true + +ip link set dev o-hm0 address $HM_PORT_MAC + +iptables -I INPUT -i o-hm0 -p udp --dport {{ .Values.conf.octavia.health_manager.bind_port }} -j ACCEPT diff --git a/octavia/templates/bin/_octavia-health-manager.sh.tpl b/octavia/templates/bin/_octavia-health-manager.sh.tpl new file mode 100644 index 0000000000..3a42066871 --- /dev/null +++ b/octavia/templates/bin/_octavia-health-manager.sh.tpl @@ -0,0 +1,38 @@ +#!/bin/bash + +{{/* +Copyright 2019 Samsung Electronics Co., Ltd. + +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. +*/}} + +set -ex +COMMAND="${@:-start}" + +function start () { + cat > /tmp/dhclient.conf < /tmp/octavia_hm_controller_ip_port_list + +# Create a flavor for amphora instance +openstack flavor create --id auto --ram 1024 --disk 2 --vcpus 1 --private m1.amphora + +# Create key pair to connect amphora instance via management network +ssh-keygen -b 2048 -t rsa -N '' -f ~/.ssh/octavia_ssh_key +openstack keypair create --public-key ~/.ssh/octavia_ssh_key.pub octavia_ssh_key + +# Create amphora image from file. Default is https://tarballs.openstack.org/octavia/test-images/ +if [ "$OSH_AMPHORA_IMAGE_FILE_PATH" == "" ]; then + curl https://tarballs.openstack.org/octavia/test-images/test-only-amphora-x64-haproxy-ubuntu-xenial.qcow2 \ + -o /tmp/test-only-amphora-x64-haproxy-ubuntu-xenial.qcow2 + + OSH_AMPHORA_IMAGE_FILE_PATH=/tmp/test-only-amphora-x64-haproxy-ubuntu-xenial.qcow2 +fi + +OSH_AMPHORA_IMAGE_ID=$(openstack image create -f value -c id \ + --public \ + --container-format=bare \ + --disk-format qcow2 < $OSH_AMPHORA_IMAGE_FILE_PATH \ + $OSH_LB_AMPHORA_IMAGE_NAME) +openstack image set --tag amphora $OSH_AMPHORA_IMAGE_ID diff --git a/tools/deployment/developer/common/190-create-octavia-certs.sh b/tools/deployment/developer/common/190-create-octavia-certs.sh new file mode 100755 index 0000000000..4b4f19d4ff --- /dev/null +++ b/tools/deployment/developer/common/190-create-octavia-certs.sh @@ -0,0 +1,49 @@ +#!/bin/bash + +# Copyright 2019 Samsung Electronics Co., Ltd. +# +# 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. + +set -xe + +function trim_data() { + local data_path=$1 + cat $data_path | base64 -w0 | tr -d '\n' +} + +function create_secret() { + { + cat <