Files
distcloud/distributedcloud/dcagent/common/config.py
Hugo Brito d237af07ca Endpoint cache cleanup
The previously introduced token caching mechanism [1] reduces token
requests to subclouds and also effectively handles Keystone endpoint
caching, as the endpoint catalog is cached alongside tokens.

We avoid unnecessary creation of `OpenStackDriver` instances solely
for retrieving service endpoints, significantly reducing redundant
Keystone connections and improving performance.

[1] https://review.opendev.org/c/starlingx/distcloud/+/931830

Test Plan:
PASS - Deploy a subcloud and verify token caching behavior
PASS - Deploy a subcloud with remote install
PASS - Prestage a subcloud for install and software deployment,
       validating token caching during the process
PASS - Manage a subcloud for the first time and verify that the
       initial sync functions as expected.
PASS - Unmanage a subcloud, then manage the subcloud again.
PASS - BnR scalability test
PASS - Test DC orchestration sw-deploy
PASS - Scalability test
PASS - Geo-Redundancy test
PASS - Subcloud network reconfiguration test

Story: 2011311
Task: 52217

Change-Id: I2ff8c9c95052a7c3d0c495f481f48c1eb239c253
Signed-off-by: Hugo Brito <hugo.brito@windriver.com>
2025-06-19 20:52:49 +00:00

161 lines
4.7 KiB
Python

#
# Copyright (c) 2024-2025 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
"""
File to store all the configurations
"""
from oslo_config import cfg
from oslo_utils import importutils
# Ensure keystonemiddleware options are imported
importutils.import_module("keystonemiddleware.auth_token")
# OpenStack credentials used for Endpoint Cache
# We need to register the below non-standard config options to dcagent engine
keystone_opts = [
cfg.StrOpt("username", help="Username of account"),
cfg.StrOpt("password", help="Password of account"),
cfg.StrOpt("project_name", help="Tenant name of account"),
cfg.StrOpt(
"user_domain_name", default="Default", help="User domain name of account"
),
cfg.StrOpt(
"project_domain_name", default="Default", help="Project domain name of account"
),
]
# Pecan_opts
pecan_opts = [
cfg.StrOpt(
"root",
default="dcagent.api.controllers.root.RootController",
help="Pecan root controller",
),
cfg.ListOpt(
"modules",
default=["dcagent.api"],
help="A list of modules where pecan will search for applications.",
),
cfg.BoolOpt(
"debug",
default=False,
help="Enables the ability to display tracebacks in the browser and "
"interactively debug during development.",
),
cfg.BoolOpt(
"auth_enable", default=True, help="Enables user authentication in pecan."
),
]
# OpenStack credentials used for Endpoint Cache
cache_opts = [
cfg.StrOpt("auth_uri", help="Keystone authorization url"),
cfg.StrOpt("identity_uri", help="Keystone service url"),
cfg.StrOpt(
"admin_username",
help="Username of admin account, needed when "
"auto_refresh_endpoint set to True",
),
cfg.StrOpt(
"admin_password",
help="Password of admin account, needed when "
"auto_refresh_endpoint set to True",
),
cfg.StrOpt(
"admin_tenant",
help="Tenant name of admin account, needed when "
"auto_refresh_endpoint set to True",
),
cfg.StrOpt(
"admin_user_domain_name",
default="Default",
help="User domain name of admin account, needed when "
"auto_refresh_endpoint set to True",
),
cfg.StrOpt(
"admin_project_domain_name",
default="Default",
help="Project domain name of admin account, needed when "
"auto_refresh_endpoint set to True",
),
]
# OpenStack credentials used for Endpoint Cache
endpoint_cache_opts = [
cfg.StrOpt("auth_uri", help="Keystone authorization url"),
cfg.StrOpt("auth_plugin", help="Name of the plugin to load"),
cfg.StrOpt("username", help="Username of account"),
cfg.StrOpt("password", secret=True, help="Password of account"),
cfg.StrOpt("project_name", help="Project name of account"),
cfg.StrOpt(
"user_domain_name", default="Default", help="User domain name of account"
),
cfg.StrOpt(
"project_domain_name", default="Default", help="Project domain name of account"
),
cfg.IntOpt(
"http_discovery_timeout",
default=15,
help="Discovery timeout value for communicating with Identity API server.",
),
cfg.IntOpt(
"http_connect_timeout",
help="Request timeout value for communicating with Identity API server.",
),
cfg.IntOpt(
"token_cache_size",
default=10000,
help="Maximum number of entries in the in-memory token cache",
),
]
scheduler_opts = [
cfg.BoolOpt(
"periodic_enable",
default=True,
help="Boolean value to enable or disable periodic tasks",
),
cfg.IntOpt(
"dcagent_audit_interval",
default=30,
help="Periodic time interval for subcloud audit",
),
]
common_opts = [
cfg.IntOpt("workers", default=1, help="Number of workers"),
cfg.StrOpt("host", default="localhost", help="Hostname of the machine"),
]
scheduler_opt_group = cfg.OptGroup(
name="scheduler", title="Scheduler options for periodic job"
)
keystone_opt_group = cfg.OptGroup(name="keystone_authtoken", title="Keystone options")
# The group stores the pecan configurations.
pecan_group = cfg.OptGroup(name="pecan", title="Pecan options")
cache_opt_group = cfg.OptGroup(name="cache", title="OpenStack Credentials")
endpoint_cache_opt_group = cfg.OptGroup(
name="endpoint_cache", title="OpenStack Credentials"
)
def list_opts():
yield cache_opt_group.name, cache_opts
yield endpoint_cache_opt_group.name, endpoint_cache_opts
yield scheduler_opt_group.name, scheduler_opts
yield pecan_group.name, pecan_opts
yield None, common_opts
def register_options():
for group, opts in list_opts():
cfg.CONF.register_opts(opts, group=group)