#!/bin/bash # 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. function create_kuryr_account { if is_service_enabled kuryr-kubernetes; then create_service_user "kuryr" "admin" get_or_create_service "kuryr-kubernetes" "kuryr-kubernetes" \ "Kuryr-Kubernetes Service" fi } function create_kuryr_cache_dir { # Create cache directory sudo install -d -o "$STACK_USER" "$KURYR_AUTH_CACHE_DIR" if [[ ! "$KURYR_AUTH_CACHE_DIR" == "" ]]; then rm -f "$KURYR_AUTH_CACHE_DIR"/* fi } function get_distutils_data_path { cat << EOF | python - from __future__ import print_function import distutils.dist import distutils.command.install inst = distutils.command.install.install(distutils.dist.Distribution()) inst.finalize_options() print(inst.install_data) EOF } function configure_kuryr { sudo install -d -o "$STACK_USER" "$KURYR_CONFIG_DIR" "${KURYR_HOME}/tools/generate_config_file_samples.sh" sudo install -o "$STACK_USER" -m 640 -D "${KURYR_HOME}/etc/kuryr.conf.sample" \ "$KURYR_CONFIG" iniset "$KURYR_CONFIG" kubernetes api_root "$KURYR_K8S_API_URL" if [ "$KURYR_K8S_API_CERT" ]; then iniset "$KURYR_CONFIG" kubernetes ssl_client_crt_file "$KURYR_K8S_API_CERT" fi if [ "$KURYR_K8S_API_KEY" ]; then iniset "$KURYR_CONFIG" kubernetes ssl_client_key_file "$KURYR_K8S_API_KEY" fi if [ "$KURYR_K8S_API_CACERT" ]; then iniset "$KURYR_CONFIG" kubernetes ssl_ca_crt_file "$KURYR_K8S_API_CACERT" fi # REVISIT(ivc): 'use_stderr' is required for current CNI driver. Once a # daemon-based CNI driver is implemented, this could be removed. iniset "$KURYR_CONFIG" DEFAULT use_stderr true create_kuryr_cache_dir # Neutron API server & Neutron plugin if is_service_enabled kuryr-kubernetes; then configure_auth_token_middleware "$KURYR_CONFIG" kuryr \ "$KURYR_AUTH_CACHE_DIR" neutron fi } function install_kuryr_cni { local kuryr_cni_bin=$(which kuryr-cni) sudo install -o "$STACK_USER" -m 0555 -D \ "$kuryr_cni_bin" "${CNI_BIN_DIR}/kuryr-cni" } function _cidr_range { python - <