Generate config file by tool
Change-Id: I58a340775d9b50e161baaa79eb9a0074ce7f1c3b
This commit is contained in:
parent
42fcf4640f
commit
279df10cfb
|
@ -30,6 +30,7 @@ nosetests.xml
|
|||
.venv
|
||||
.log
|
||||
*.cover
|
||||
*.sample
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
[DEFAULT]
|
||||
output_file = etc/fuxi_kubernetes.conf.sample
|
||||
wrap_width = 79
|
||||
namespace = fuxi-kubernetes
|
|
@ -12,6 +12,8 @@
|
|||
|
||||
import pbr.version
|
||||
|
||||
from fuxi_kubernetes.common import constants
|
||||
|
||||
|
||||
__version__ = pbr.version.VersionInfo(
|
||||
'fuxi-kubernetes').version_string()
|
||||
constants.PROJECT_NAME).version_string()
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
# 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.
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
from fuxi_kubernetes.i18n import _
|
||||
|
||||
|
||||
flexvolume_driver_group = cfg.OptGroup(
|
||||
'flexvolume_driver',
|
||||
title='FlexVolume driver Options',
|
||||
help=_('Configuration options for FlexVolume driver'))
|
||||
|
||||
flexvolume_driver_opts = [
|
||||
cfg.HostAddressOpt('node_ip',
|
||||
help=_('IP address of machine '
|
||||
'on which FlexVolume driver runs.')),
|
||||
cfg.IntOpt('driver_server_port',
|
||||
default=7878,
|
||||
help=_('Port for the server of FlexVolume driver.')),
|
||||
]
|
||||
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.register_opts(flexvolume_driver_opts, flexvolume_driver_group.name)
|
|
@ -11,6 +11,9 @@
|
|||
# under the License.
|
||||
|
||||
|
||||
PROJECT_NAME = 'fuxi-kubernetes'
|
||||
|
||||
|
||||
VOLUME_DRIVER_CMD = (
|
||||
CMD_INIT,
|
||||
CMD_GET_VOLUME_NAME,
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
# 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.
|
||||
|
||||
import oslo_i18n
|
||||
|
||||
from fuxi_kubernetes.common import constants
|
||||
|
||||
DOMAIN = constants.PROJECT_NAME
|
||||
|
||||
_translators = oslo_i18n.TranslatorFactory(domain=DOMAIN)
|
||||
|
||||
# The primary translation function using the well-known name "_"
|
||||
_ = _translators.primary
|
|
@ -0,0 +1,27 @@
|
|||
# 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.
|
||||
|
||||
__all__ = [
|
||||
'list_fuxi_k8s_opts',
|
||||
]
|
||||
|
||||
import itertools
|
||||
|
||||
from fuxi_kubernetes.common import config
|
||||
|
||||
|
||||
def list_fuxi_k8s_opts():
|
||||
|
||||
return [
|
||||
(config.flexvolume_driver_group.name,
|
||||
itertools.chain(config.flexvolume_driver_opts,)),
|
||||
]
|
|
@ -23,6 +23,9 @@ packages =
|
|||
fuxi_kubernetes
|
||||
|
||||
[entry_points]
|
||||
oslo.config.opts =
|
||||
fuxi-kubernetes = fuxi_kubernetes.opts:list_fuxi_k8s_opts
|
||||
|
||||
console_scripts =
|
||||
fuxi-k8s-volume-driver-cinder = fuxi_kubernetes.cmd.cinder:main
|
||||
fuxi-k8s-volume-driver-server = fuxi_kubernetes.cmd.driver_server:main
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# 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 -e
|
||||
|
||||
GEN_CMD=oslo-config-generator
|
||||
SCRIPT_PATH=$(dirname "$(readlink -f "$0")")
|
||||
DIST_PATH=$(dirname "$SCRIPT_PATH")
|
||||
|
||||
prerequisites() (
|
||||
if ! command -v "$GEN_CMD" > /dev/null; then
|
||||
echo "ERROR: $GEN_CMD not installed on the system."
|
||||
return 1
|
||||
fi
|
||||
|
||||
if ! [ -f "${DIST_PATH}/fuxi_kubernetes.egg-info/entry_points.txt" ]; then
|
||||
curr_dir=$(pwd)
|
||||
cd "${DIST_PATH}"
|
||||
python setup.py egg_info # Generate entrypoints for config generation
|
||||
cd "${curr_dir}"
|
||||
fi
|
||||
|
||||
return 0
|
||||
)
|
||||
|
||||
generate() (
|
||||
curr_dir=$(pwd)
|
||||
cd "${DIST_PATH}"
|
||||
# Set PYTHONPATH so that it will use the generated egg-info
|
||||
PYTHONPATH=. find "etc/oslo-config-generator" -type f -exec "$GEN_CMD" --config-file="{}" \;
|
||||
cd "${curr_dir}"
|
||||
)
|
||||
|
||||
|
||||
prerequisites
|
||||
rc=$?
|
||||
if [ $rc -ne 0 ]; then
|
||||
exit $rc
|
||||
fi
|
||||
|
||||
generate
|
||||
|
||||
set -x
|
Loading…
Reference in New Issue