Fix oslo_config and oslo_log configurations
* Ensure that configurations are done via the global `cfg` object * Ensure that the logger is configure through the global object * Upload a configuration sample file with DEFAULT section having the armada.conf and oslo_log namespace
This commit is contained in:
parent
3f1daac6e8
commit
498cf6c98f
|
@ -11,9 +11,6 @@
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
|
||||||
|
|
||||||
from armada.conf import default
|
|
||||||
|
|
||||||
import json
|
import json
|
||||||
from falcon import HTTP_200
|
from falcon import HTTP_200
|
||||||
|
@ -21,16 +18,11 @@ from falcon import HTTP_200
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
|
|
||||||
# Required Oslo configuration setup
|
|
||||||
default.register_opts()
|
|
||||||
|
|
||||||
from armada.handlers.armada import Armada as Handler
|
from armada.handlers.armada import Armada as Handler
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
CONF = cfg.CONF
|
CONF = cfg.CONF
|
||||||
DOMAIN = "armada"
|
|
||||||
|
|
||||||
logging.setup(CONF, DOMAIN)
|
|
||||||
|
|
||||||
class Apply(object):
|
class Apply(object):
|
||||||
'''
|
'''
|
||||||
|
|
|
@ -12,24 +12,16 @@
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from armada.conf import default
|
import falcon
|
||||||
|
|
||||||
# Required Oslo configuration setup
|
|
||||||
default.register_opts()
|
|
||||||
|
|
||||||
from keystoneauth1 import session
|
from keystoneauth1 import session
|
||||||
from keystoneauth1.identity import v3
|
from keystoneauth1.identity import v3
|
||||||
|
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
|
|
||||||
import falcon
|
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
CONF = cfg.CONF
|
CONF = cfg.CONF
|
||||||
DOMAIN = "armada"
|
|
||||||
|
|
||||||
logging.setup(CONF, DOMAIN)
|
|
||||||
|
|
||||||
class AuthMiddleware(object):
|
class AuthMiddleware(object):
|
||||||
|
|
||||||
|
|
|
@ -11,31 +11,30 @@
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
|
||||||
|
|
||||||
from armada.conf import default
|
|
||||||
|
|
||||||
# Required Oslo configuration setup
|
|
||||||
default.register_opts()
|
|
||||||
|
|
||||||
from armada_controller import Apply
|
|
||||||
from tiller_controller import Release, Status
|
|
||||||
|
|
||||||
from middleware import AuthMiddleware, RoleMiddleware
|
|
||||||
|
|
||||||
import falcon
|
import falcon
|
||||||
|
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
import armada.conf as configs
|
||||||
CONF = cfg.CONF
|
|
||||||
DOMAIN = "armada"
|
|
||||||
|
|
||||||
logging.setup(CONF, DOMAIN)
|
from armada_controller import Apply
|
||||||
|
from middleware import AuthMiddleware
|
||||||
|
from middleware import RoleMiddleware
|
||||||
|
from tiller_controller import Release
|
||||||
|
from tiller_controller import Status
|
||||||
|
|
||||||
|
LOG = logging.getLogger(__name__)
|
||||||
|
configs.set_app_default_configs()
|
||||||
|
CONF = cfg.CONF
|
||||||
|
|
||||||
# Build API
|
# Build API
|
||||||
def create(middleware=CONF.middleware):
|
def create(middleware=CONF.middleware):
|
||||||
|
logging.register_options(CONF)
|
||||||
|
logging.set_defaults(default_log_levels=CONF.default_log_levels)
|
||||||
|
logging.setup(CONF, 'armada')
|
||||||
|
|
||||||
if middleware:
|
if middleware:
|
||||||
api = falcon.API(middleware=[AuthMiddleware(), RoleMiddleware()])
|
api = falcon.API(middleware=[AuthMiddleware(), RoleMiddleware()])
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -11,9 +11,6 @@
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
|
||||||
|
|
||||||
from armada.conf import default
|
|
||||||
|
|
||||||
import json
|
import json
|
||||||
from falcon import HTTP_200
|
from falcon import HTTP_200
|
||||||
|
@ -21,16 +18,11 @@ from falcon import HTTP_200
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
|
|
||||||
# Required Oslo configuration setup
|
|
||||||
default.register_opts()
|
|
||||||
|
|
||||||
from armada.handlers.tiller import Tiller as tillerHandler
|
from armada.handlers.tiller import Tiller as tillerHandler
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
CONF = cfg.CONF
|
CONF = cfg.CONF
|
||||||
DOMAIN = "armada"
|
|
||||||
|
|
||||||
logging.setup(CONF, DOMAIN)
|
|
||||||
|
|
||||||
class Status(object):
|
class Status(object):
|
||||||
def on_get(self, req, resp):
|
def on_get(self, req, resp):
|
||||||
|
|
|
@ -22,9 +22,6 @@ from oslo_log import log as logging
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cfg.CONF
|
||||||
DOMAIN = "armada"
|
|
||||||
|
|
||||||
logging.setup(CONF, DOMAIN)
|
|
||||||
|
|
||||||
def tillerServer(args):
|
def tillerServer(args):
|
||||||
|
|
||||||
|
|
|
@ -24,9 +24,6 @@ from oslo_log import log as logging
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cfg.CONF
|
||||||
DOMAIN = "armada"
|
|
||||||
|
|
||||||
logging.setup(CONF, DOMAIN)
|
|
||||||
|
|
||||||
def validateYaml(args):
|
def validateYaml(args):
|
||||||
documents = yaml.safe_load_all(open(args.file).read())
|
documents = yaml.safe_load_all(open(args.file).read())
|
||||||
|
|
|
@ -11,3 +11,18 @@
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
from oslo_config import cfg
|
||||||
|
|
||||||
|
from armada.conf import default
|
||||||
|
|
||||||
|
CONF = cfg.CONF
|
||||||
|
|
||||||
|
# Load config file if exists
|
||||||
|
if (os.path.exists('etc/armada/armada.conf')):
|
||||||
|
CONF(['--config-file', 'etc/armada/armada.conf'])
|
||||||
|
|
||||||
|
def set_app_default_configs():
|
||||||
|
default.register_opts(CONF)
|
||||||
|
|
|
@ -1,208 +1,75 @@
|
||||||
# Copyright 2017 The Armada Authors.
|
# Copyright 2017 The Armada Authors.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the 'License'));
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
# You may obtain a copy of the License at
|
# You may obtain a copy of the License at
|
||||||
#
|
#
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
#
|
#
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
# distributed under the License is distributed on an 'AS IS' BASIS,
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import os
|
|
||||||
|
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
|
|
||||||
|
from armada.conf import utils
|
||||||
|
|
||||||
default_options = [
|
default_options = [
|
||||||
|
|
||||||
cfg.ListOpt(
|
cfg.ListOpt(
|
||||||
'armada_apply_roles',
|
'armada_apply_roles',
|
||||||
default=['admin'],
|
default=['admin'],
|
||||||
help='IDs of approved API access roles.'),
|
help=utils.fmt('IDs of approved API access roles.')),
|
||||||
|
|
||||||
cfg.StrOpt(
|
cfg.StrOpt(
|
||||||
'auth_url',
|
'auth_url',
|
||||||
default='http://0.0.0.0/v3',
|
default='http://0.0.0.0/v3',
|
||||||
help='The default Keystone authentication url.'),
|
help=utils.fmt('The default Keystone authentication url.')),
|
||||||
|
|
||||||
cfg.BoolOpt(
|
|
||||||
'debug',
|
|
||||||
default='false',
|
|
||||||
help='Print debugging output (set logging level to DEBUG instead of \
|
|
||||||
default INFO level).'),
|
|
||||||
|
|
||||||
cfg.ListOpt(
|
|
||||||
'default_log_levels',
|
|
||||||
default='root=INFO, cliff=INFO, stevedore=INFO, iso8601=INFO',
|
|
||||||
help='List of logger=LEVEL pairs.'),
|
|
||||||
|
|
||||||
cfg.BoolOpt(
|
|
||||||
'fatal_deprecations',
|
|
||||||
default='true',
|
|
||||||
help='Enables or disables fatal status of deprecations.'),
|
|
||||||
|
|
||||||
cfg.StrOpt(
|
cfg.StrOpt(
|
||||||
'kubernetes_config_path',
|
'kubernetes_config_path',
|
||||||
default='/home/user/.kube/',
|
default='/home/user/.kube/',
|
||||||
help='Path to Kubernetes configurations.'),
|
help=utils.fmt('Path to Kubernetes configurations.')),
|
||||||
|
|
||||||
cfg.StrOpt(
|
|
||||||
'instance_format',
|
|
||||||
default='[instance: %(uuid)s] ',
|
|
||||||
help='The format for an instance that is passed \
|
|
||||||
with the log message.'),
|
|
||||||
|
|
||||||
cfg.StrOpt(
|
|
||||||
'instance_uuid_format',
|
|
||||||
default='[instance: %(uuid)s] ',
|
|
||||||
help='The format for an instance UUID that is passed \
|
|
||||||
with the log message.'),
|
|
||||||
|
|
||||||
cfg.StrOpt(
|
|
||||||
'log_config_append',
|
|
||||||
default=None,
|
|
||||||
help='The name of a logging configuration file.'),
|
|
||||||
|
|
||||||
cfg.StrOpt(
|
|
||||||
'log_date_format',
|
|
||||||
default='%Y-%m-%d %H:%M:%S',
|
|
||||||
help='Date format for log records.'),
|
|
||||||
|
|
||||||
cfg.StrOpt(
|
|
||||||
'log_dir',
|
|
||||||
default=None,
|
|
||||||
help='(Optional) The base directory used for \
|
|
||||||
relative log file paths.'),
|
|
||||||
|
|
||||||
cfg.StrOpt(
|
|
||||||
'log_file',
|
|
||||||
default=None,
|
|
||||||
help='(Optional) Path to Armada log file.'),
|
|
||||||
|
|
||||||
cfg.StrOpt(
|
|
||||||
'logging_context_format_string',
|
|
||||||
default='%(asctime)s.%(msecs)03d %(process)d %(levelname)s \
|
|
||||||
%(name)s [%(request_id)s %(user_identity)s] \
|
|
||||||
%(instance)s%(message)s',
|
|
||||||
help='Format for context logging.'),
|
|
||||||
|
|
||||||
cfg.StrOpt(
|
|
||||||
'logging_debug_format_suffix',
|
|
||||||
default='%(funcName)s %(pathname)s:%(lineno)d',
|
|
||||||
help='Format string to use for log messages \
|
|
||||||
when context is undefined.'),
|
|
||||||
|
|
||||||
cfg.StrOpt(
|
|
||||||
'logging_default_format_string',
|
|
||||||
default='%(asctime)s.%(msecs)03d %(process)d \
|
|
||||||
%(levelname)s %(name)s [-] %(instance)s%(message)s',
|
|
||||||
help='Format string to use for log \
|
|
||||||
messages when context is undefined.'),
|
|
||||||
|
|
||||||
cfg.StrOpt(
|
|
||||||
'logging_exception_prefix',
|
|
||||||
default='%(asctime)s.%(msecs)03d %(process)d \
|
|
||||||
ERROR %(name)s %(instance)s',
|
|
||||||
help='Prefix each line of \
|
|
||||||
exception output with this format.'),
|
|
||||||
|
|
||||||
cfg.StrOpt(
|
|
||||||
'logging_user_identity_format',
|
|
||||||
default='%(user)s %(tenant)s %(domain)s \
|
|
||||||
%(user_domain)s %(project_domain)s',
|
|
||||||
help='Defines the format string for \
|
|
||||||
%(user_identity)s that is used in logging_context_format_string.'),
|
|
||||||
|
|
||||||
cfg.BoolOpt(
|
cfg.BoolOpt(
|
||||||
'middleware',
|
'middleware',
|
||||||
default='true',
|
default='true',
|
||||||
help='Enables or disables Keystone authentication middleware.'),
|
help=utils.fmt("""
|
||||||
|
Enables or disables Keystone authentication middleware.
|
||||||
|
""")),
|
||||||
|
|
||||||
cfg.StrOpt(
|
cfg.StrOpt(
|
||||||
'project_domain_name',
|
'project_domain_name',
|
||||||
default='default',
|
default='default',
|
||||||
help='The Keystone project domain name used for authentication.'),
|
help=utils.fmt("""
|
||||||
|
The Keystone project domain name used for authentication.
|
||||||
|
""")),
|
||||||
|
|
||||||
cfg.StrOpt(
|
cfg.StrOpt(
|
||||||
'project_name',
|
'project_name',
|
||||||
default='admin',
|
default='admin',
|
||||||
help='The Keystone project name used for authentication.'),
|
help=utils.fmt('The Keystone project name used for authentication.')),
|
||||||
|
|
||||||
cfg.BoolOpt(
|
|
||||||
'publish_errors',
|
|
||||||
default='true',
|
|
||||||
help='Enables or disables publication of error events.'),
|
|
||||||
|
|
||||||
cfg.IntOpt(
|
|
||||||
'rate_limit_burst',
|
|
||||||
default='0',
|
|
||||||
help='Maximum number of logged messages per rate_limit_interval.'),
|
|
||||||
|
|
||||||
cfg.StrOpt(
|
|
||||||
'rate_limit_except_level',
|
|
||||||
default='CRITICAL',
|
|
||||||
help='Log level name used by rate limiting: \
|
|
||||||
CRITICAL, ERROR, INFO, WARNING, DEBUG'),
|
|
||||||
|
|
||||||
cfg.IntOpt(
|
|
||||||
'rate_limit_interval',
|
|
||||||
default='0',
|
|
||||||
help='Maximum number of logged messages per rate_limit_interval.'),
|
|
||||||
|
|
||||||
cfg.StrOpt(
|
cfg.StrOpt(
|
||||||
'ssh_key_path',
|
'ssh_key_path',
|
||||||
default='/home/user/.ssh/',
|
default='/home/user/.ssh/',
|
||||||
help='Path to SSH private key.'),
|
help=utils.fmt('Path to SSH private key.')),
|
||||||
|
|
||||||
cfg.StrOpt(
|
|
||||||
'syslog_log_facility',
|
|
||||||
default='LOG_USER',
|
|
||||||
help='Syslog facility to receive log lines. \
|
|
||||||
This option is ignored if log_config_append is set.'),
|
|
||||||
|
|
||||||
cfg.BoolOpt(
|
|
||||||
'use_journal',
|
|
||||||
default='false',
|
|
||||||
help='Enable journald for logging. (Must be a systemd environment)'),
|
|
||||||
|
|
||||||
cfg.BoolOpt(
|
|
||||||
'use_stderr',
|
|
||||||
default='true',
|
|
||||||
help='Log output to standard error.'),
|
|
||||||
|
|
||||||
cfg.BoolOpt(
|
|
||||||
'use_syslog',
|
|
||||||
default='true',
|
|
||||||
help='Log output to syslog.'),
|
|
||||||
|
|
||||||
cfg.ListOpt(
|
cfg.ListOpt(
|
||||||
'tiller_release_roles',
|
'tiller_release_roles',
|
||||||
default=['admin'],
|
default=['admin'],
|
||||||
help='IDs of approved API access roles.'),
|
help=utils.fmt('IDs of approved API access roles.')),
|
||||||
|
|
||||||
cfg.ListOpt(
|
cfg.ListOpt(
|
||||||
'tiller_status_roles',
|
'tiller_status_roles',
|
||||||
default=['admin'],
|
default=['admin'],
|
||||||
help='IDs of approved API access roles.'),
|
help=utils.fmt('IDs of approved API access roles.'))
|
||||||
|
|
||||||
cfg.BoolOpt(
|
|
||||||
'watch_log_file',
|
|
||||||
default='false',
|
|
||||||
help='Enables instantaneous recreation of a \
|
|
||||||
logging file if the file is removed.')
|
|
||||||
]
|
]
|
||||||
|
|
||||||
def register_opts():
|
def register_opts(conf):
|
||||||
CONF = cfg.CONF
|
conf.register_opts(default_options)
|
||||||
CONF.register_opts(default_options)
|
|
||||||
|
|
||||||
# Load config file if exists
|
|
||||||
default_config_file = 'etc/armada/armada.conf'
|
|
||||||
if (os.path.exists(default_config_file)):
|
|
||||||
CONF(['--config-file', default_config_file])
|
|
||||||
|
|
||||||
def list_opts():
|
def list_opts():
|
||||||
return {'DEFAULT': default_options}
|
return {'DEFAULT': default_options}
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
|
||||||
|
def fmt(docstr):
|
||||||
|
"""Format a docstring for use as documentation in sample config."""
|
||||||
|
# Replace newlines with spaces, as docstrings contain literal newlines that
|
||||||
|
# should not be rendered into the sample configuration file (instead, line
|
||||||
|
# wrappings should be applied automatically).
|
||||||
|
docstr = docstr.replace('\n', ' ')
|
||||||
|
|
||||||
|
# Because it's common for docstrings to begin and end with a newline, there
|
||||||
|
# is now whitespace at the beginning and end of the documentation as a side
|
||||||
|
# effect of replacing newlines with spaces.
|
||||||
|
docstr = docstr.strip()
|
||||||
|
|
||||||
|
return docstr
|
|
@ -19,9 +19,7 @@ LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
DEFAULT_TIMEOUT = 3600
|
DEFAULT_TIMEOUT = 3600
|
||||||
CONF = cfg.CONF
|
CONF = cfg.CONF
|
||||||
DOMAIN = "armada"
|
|
||||||
|
|
||||||
logging.setup(CONF, DOMAIN)
|
|
||||||
|
|
||||||
class ArmadaBaseException(Exception):
|
class ArmadaBaseException(Exception):
|
||||||
'''Base class for Armada exception and error handling.'''
|
'''Base class for Armada exception and error handling.'''
|
||||||
|
|
|
@ -38,9 +38,6 @@ LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
DEFAULT_TIMEOUT = 3600
|
DEFAULT_TIMEOUT = 3600
|
||||||
CONF = cfg.CONF
|
CONF = cfg.CONF
|
||||||
DOMAIN = "armada"
|
|
||||||
|
|
||||||
logging.setup(CONF, DOMAIN)
|
|
||||||
|
|
||||||
|
|
||||||
class Armada(object):
|
class Armada(object):
|
||||||
|
@ -77,8 +74,9 @@ class Armada(object):
|
||||||
self.debug = debug
|
self.debug = debug
|
||||||
|
|
||||||
# Set debug value
|
# Set debug value
|
||||||
CONF.set_default('debug', self.debug)
|
# Define a default handler at INFO logging level
|
||||||
logging.setup(CONF, DOMAIN)
|
if self.debug:
|
||||||
|
logging.basicConfig(level=logging.DEBUG)
|
||||||
|
|
||||||
def get_armada_manifest(self):
|
def get_armada_manifest(self):
|
||||||
return Manifest(self.documents).get_manifest()
|
return Manifest(self.documents).get_manifest()
|
||||||
|
|
|
@ -29,9 +29,6 @@ from oslo_log import log as logging
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cfg.CONF
|
||||||
DOMAIN = "armada"
|
|
||||||
|
|
||||||
logging.setup(CONF, DOMAIN)
|
|
||||||
|
|
||||||
|
|
||||||
class ChartBuilder(object):
|
class ChartBuilder(object):
|
||||||
|
|
|
@ -22,9 +22,6 @@ from oslo_log import log as logging
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cfg.CONF
|
||||||
DOMAIN = "armada"
|
|
||||||
|
|
||||||
logging.setup(CONF, DOMAIN)
|
|
||||||
|
|
||||||
|
|
||||||
class K8s(object):
|
class K8s(object):
|
||||||
|
|
|
@ -43,9 +43,6 @@ MAX_MESSAGE_LENGTH = 429496729
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cfg.CONF
|
||||||
DOMAIN = "armada"
|
|
||||||
|
|
||||||
logging.setup(CONF, DOMAIN)
|
|
||||||
|
|
||||||
|
|
||||||
class Tiller(object):
|
class Tiller(object):
|
||||||
|
|
|
@ -14,12 +14,15 @@
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
from oslo_config import cfg
|
||||||
|
from oslo_log import log
|
||||||
from cliff import app
|
from cliff import app
|
||||||
from cliff import commandmanager as cm
|
from cliff import commandmanager as cm
|
||||||
from conf import default
|
|
||||||
|
|
||||||
import armada
|
import armada
|
||||||
|
|
||||||
|
CONF = cfg.CONF
|
||||||
|
|
||||||
class ArmadaApp(app.App):
|
class ArmadaApp(app.App):
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
super(ArmadaApp, self).__init__(
|
super(ArmadaApp, self).__init__(
|
||||||
|
@ -35,7 +38,9 @@ class ArmadaApp(app.App):
|
||||||
|
|
||||||
def configure_logging(self):
|
def configure_logging(self):
|
||||||
super(ArmadaApp, self).configure_logging()
|
super(ArmadaApp, self).configure_logging()
|
||||||
default.register_opts()
|
log.register_options(CONF)
|
||||||
|
log.set_defaults(default_log_levels=CONF.default_log_levels)
|
||||||
|
log.setup(CONF, 'armada')
|
||||||
|
|
||||||
def main(argv=None):
|
def main(argv=None):
|
||||||
if argv is None:
|
if argv is None:
|
||||||
|
|
|
@ -2,13 +2,10 @@ import mock
|
||||||
import unittest
|
import unittest
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
# Required Oslo configuration setup
|
|
||||||
from armada.conf import default
|
|
||||||
default.register_opts()
|
|
||||||
|
|
||||||
from armada.handlers.armada import Armada
|
from armada.handlers.armada import Armada
|
||||||
from armada.handlers.manifest import Manifest
|
from armada.handlers.manifest import Manifest
|
||||||
|
|
||||||
|
|
||||||
class ArmadaTestCase(unittest.TestCase):
|
class ArmadaTestCase(unittest.TestCase):
|
||||||
test_yaml = """
|
test_yaml = """
|
||||||
---
|
---
|
||||||
|
|
|
@ -14,12 +14,9 @@
|
||||||
import unittest
|
import unittest
|
||||||
import mock
|
import mock
|
||||||
|
|
||||||
# Required Oslo configuration setup
|
|
||||||
from armada.conf import default
|
|
||||||
default.register_opts()
|
|
||||||
|
|
||||||
from armada.handlers.chartbuilder import ChartBuilder
|
from armada.handlers.chartbuilder import ChartBuilder
|
||||||
|
|
||||||
|
|
||||||
class ChartBuilderTestCase(unittest.TestCase):
|
class ChartBuilderTestCase(unittest.TestCase):
|
||||||
chart_stream = """
|
chart_stream = """
|
||||||
chart:
|
chart:
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
import mock
|
import mock
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
# Required Oslo configuration setup
|
|
||||||
from armada.conf import default
|
|
||||||
default.register_opts()
|
|
||||||
|
|
||||||
from armada.handlers.tiller import Tiller
|
from armada.handlers.tiller import Tiller
|
||||||
|
|
||||||
|
|
||||||
class TillerTestCase(unittest.TestCase):
|
class TillerTestCase(unittest.TestCase):
|
||||||
|
|
||||||
@mock.patch.object(Tiller, '_get_tiller_ip')
|
@mock.patch.object(Tiller, '_get_tiller_ip')
|
||||||
|
|
|
@ -0,0 +1,140 @@
|
||||||
|
[DEFAULT]
|
||||||
|
|
||||||
|
#
|
||||||
|
# From armada.conf
|
||||||
|
#
|
||||||
|
|
||||||
|
# IDs of approved API access roles. (list value)
|
||||||
|
#armada_apply_roles = admin
|
||||||
|
|
||||||
|
# The default Keystone authentication url. (string value)
|
||||||
|
#auth_url = http://0.0.0.0/v3
|
||||||
|
|
||||||
|
# Path to Kubernetes configurations. (string value)
|
||||||
|
#kubernetes_config_path = /home/user/.kube/
|
||||||
|
|
||||||
|
# Enables or disables Keystone authentication middleware. (boolean value)
|
||||||
|
#middleware = true
|
||||||
|
|
||||||
|
# The Keystone project domain name used for authentication. (string value)
|
||||||
|
#project_domain_name = default
|
||||||
|
|
||||||
|
# The Keystone project name used for authentication. (string value)
|
||||||
|
#project_name = admin
|
||||||
|
|
||||||
|
# Path to SSH private key. (string value)
|
||||||
|
#ssh_key_path = /home/user/.ssh/
|
||||||
|
|
||||||
|
# IDs of approved API access roles. (list value)
|
||||||
|
#tiller_release_roles = admin
|
||||||
|
|
||||||
|
# IDs of approved API access roles. (list value)
|
||||||
|
#tiller_status_roles = admin
|
||||||
|
|
||||||
|
#
|
||||||
|
# From oslo.log
|
||||||
|
#
|
||||||
|
|
||||||
|
# If set to true, the logging level will be set to DEBUG instead of the default
|
||||||
|
# INFO level. (boolean value)
|
||||||
|
# Note: This option can be changed without restarting.
|
||||||
|
#debug = false
|
||||||
|
|
||||||
|
# The name of a logging configuration file. This file is appended to any
|
||||||
|
# existing logging configuration files. For details about logging configuration
|
||||||
|
# files, see the Python logging module documentation. Note that when logging
|
||||||
|
# configuration files are used then all logging configuration is set in the
|
||||||
|
# configuration file and other logging configuration options are ignored (for
|
||||||
|
# example, logging_context_format_string). (string value)
|
||||||
|
# Note: This option can be changed without restarting.
|
||||||
|
# Deprecated group/name - [DEFAULT]/log_config
|
||||||
|
#log_config_append = <None>
|
||||||
|
|
||||||
|
# Defines the format string for %%(asctime)s in log records. Default:
|
||||||
|
# %(default)s . This option is ignored if log_config_append is set. (string
|
||||||
|
# value)
|
||||||
|
#log_date_format = %Y-%m-%d %H:%M:%S
|
||||||
|
|
||||||
|
# (Optional) Name of log file to send logging output to. If no default is set,
|
||||||
|
# logging will go to stderr as defined by use_stderr. This option is ignored if
|
||||||
|
# log_config_append is set. (string value)
|
||||||
|
# Deprecated group/name - [DEFAULT]/logfile
|
||||||
|
#log_file = <None>
|
||||||
|
|
||||||
|
# (Optional) The base directory used for relative log_file paths. This option
|
||||||
|
# is ignored if log_config_append is set. (string value)
|
||||||
|
# Deprecated group/name - [DEFAULT]/logdir
|
||||||
|
#log_dir = <None>
|
||||||
|
|
||||||
|
# Uses logging handler designed to watch file system. When log file is moved or
|
||||||
|
# removed this handler will open a new log file with specified path
|
||||||
|
# instantaneously. It makes sense only if log_file option is specified and Linux
|
||||||
|
# platform is used. This option is ignored if log_config_append is set. (boolean
|
||||||
|
# value)
|
||||||
|
#watch_log_file = false
|
||||||
|
|
||||||
|
# Use syslog for logging. Existing syslog format is DEPRECATED and will be
|
||||||
|
# changed later to honor RFC5424. This option is ignored if log_config_append is
|
||||||
|
# set. (boolean value)
|
||||||
|
#use_syslog = false
|
||||||
|
|
||||||
|
# Enable journald for logging. If running in a systemd environment you may wish
|
||||||
|
# to enable journal support. Doing so will use the journal native protocol which
|
||||||
|
# includes structured metadata in addition to log messages.This option is
|
||||||
|
# ignored if log_config_append is set. (boolean value)
|
||||||
|
#use_journal = false
|
||||||
|
|
||||||
|
# Syslog facility to receive log lines. This option is ignored if
|
||||||
|
# log_config_append is set. (string value)
|
||||||
|
#syslog_log_facility = LOG_USER
|
||||||
|
|
||||||
|
# Log output to standard error. This option is ignored if log_config_append is
|
||||||
|
# set. (boolean value)
|
||||||
|
#use_stderr = false
|
||||||
|
|
||||||
|
# Format string to use for log messages with context. (string value)
|
||||||
|
#logging_context_format_string = %(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [%(request_id)s %(user_identity)s] %(instance)s%(message)s
|
||||||
|
|
||||||
|
# Format string to use for log messages when context is undefined. (string
|
||||||
|
# value)
|
||||||
|
#logging_default_format_string = %(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [-] %(instance)s%(message)s
|
||||||
|
|
||||||
|
# Additional data to append to log message when logging level for the message is
|
||||||
|
# DEBUG. (string value)
|
||||||
|
#logging_debug_format_suffix = %(funcName)s %(pathname)s:%(lineno)d
|
||||||
|
|
||||||
|
# Prefix each line of exception output with this format. (string value)
|
||||||
|
#logging_exception_prefix = %(asctime)s.%(msecs)03d %(process)d ERROR %(name)s %(instance)s
|
||||||
|
|
||||||
|
# Defines the format string for %(user_identity)s that is used in
|
||||||
|
# logging_context_format_string. (string value)
|
||||||
|
#logging_user_identity_format = %(user)s %(tenant)s %(domain)s %(user_domain)s %(project_domain)s
|
||||||
|
|
||||||
|
# List of package logging levels in logger=LEVEL pairs. This option is ignored
|
||||||
|
# if log_config_append is set. (list value)
|
||||||
|
#default_log_levels = amqp=WARN,amqplib=WARN,boto=WARN,qpid=WARN,sqlalchemy=WARN,suds=INFO,oslo.messaging=INFO,oslo_messaging=INFO,iso8601=WARN,requests.packages.urllib3.connectionpool=WARN,urllib3.connectionpool=WARN,websocket=WARN,requests.packages.urllib3.util.retry=WARN,urllib3.util.retry=WARN,keystonemiddleware=WARN,routes.middleware=WARN,stevedore=WARN,taskflow=WARN,keystoneauth=WARN,oslo.cache=INFO,dogpile.core.dogpile=INFO
|
||||||
|
|
||||||
|
# Enables or disables publication of error events. (boolean value)
|
||||||
|
#publish_errors = false
|
||||||
|
|
||||||
|
# The format for an instance that is passed with the log message. (string value)
|
||||||
|
#instance_format = "[instance: %(uuid)s] "
|
||||||
|
|
||||||
|
# The format for an instance UUID that is passed with the log message. (string
|
||||||
|
# value)
|
||||||
|
#instance_uuid_format = "[instance: %(uuid)s] "
|
||||||
|
|
||||||
|
# Interval, number of seconds, of log rate limiting. (integer value)
|
||||||
|
#rate_limit_interval = 0
|
||||||
|
|
||||||
|
# Maximum number of logged messages per rate_limit_interval. (integer value)
|
||||||
|
#rate_limit_burst = 0
|
||||||
|
|
||||||
|
# Log level name used by rate limiting: CRITICAL, ERROR, INFO, WARNING, DEBUG or
|
||||||
|
# empty string. Logs with level greater or equal to rate_limit_except_level are
|
||||||
|
# not filtered. An empty string means that all levels are filtered. (string
|
||||||
|
# value)
|
||||||
|
#rate_limit_except_level = CRITICAL
|
||||||
|
|
||||||
|
# Enables or disables fatal status of deprecations. (boolean value)
|
||||||
|
#fatal_deprecations = false
|
|
@ -2,3 +2,4 @@
|
||||||
output_file = etc/armada/armada.conf.sample
|
output_file = etc/armada/armada.conf.sample
|
||||||
wrap_width = 80
|
wrap_width = 80
|
||||||
namespace = armada.conf
|
namespace = armada.conf
|
||||||
|
namespace = oslo.log
|
||||||
|
|
|
@ -24,7 +24,10 @@ data:
|
||||||
chart_name: blog-2
|
chart_name: blog-2
|
||||||
release: blog-2
|
release: blog-2
|
||||||
namespace: default
|
namespace: default
|
||||||
values: {}
|
values:
|
||||||
|
some: value
|
||||||
|
upgrade:
|
||||||
|
no_hooks: false
|
||||||
source:
|
source:
|
||||||
type: git
|
type: git
|
||||||
location: https://github.com/gardlt/hello-world-chart
|
location: https://github.com/gardlt/hello-world-chart
|
||||||
|
|
|
@ -40,8 +40,6 @@ armada =
|
||||||
apply = armada.cli.apply:ApplyChartsCommand
|
apply = armada.cli.apply:ApplyChartsCommand
|
||||||
tiller = armada.cli.tiller:TillerServerCommand
|
tiller = armada.cli.tiller:TillerServerCommand
|
||||||
validate = armada.cli.validate:ValidateYamlCommand
|
validate = armada.cli.validate:ValidateYamlCommand
|
||||||
oslo.config.opts =
|
|
||||||
armada.conf = armada.conf.opts:list_opts
|
|
||||||
|
|
||||||
[pbr]
|
[pbr]
|
||||||
warnerrors = True
|
warnerrors = True
|
||||||
|
|
Loading…
Reference in New Issue