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 <