X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=installers%2Fcharm%2Flcm%2Fsrc%2Fcharm.py;h=e9552fd194f887085f9d7c3c87c0d6484ea7875f;hb=33f9315586721431cf67df69d49736109f36735c;hp=270a5479a837a791859d2f2143eb5e71c5afb030;hpb=49379ced23b5e344a773ce77ac9cb59c1864e19b;p=osm%2Fdevops.git diff --git a/installers/charm/lcm/src/charm.py b/installers/charm/lcm/src/charm.py index 270a5479..e9552fd1 100755 --- a/installers/charm/lcm/src/charm.py +++ b/installers/charm/lcm/src/charm.py @@ -24,25 +24,16 @@ import logging -from typing import Optional, NoReturn +from typing import NoReturn, Optional -from ops.main import main +from ops.main import main from opslib.osm.charm import CharmedOsmBase, RelationsMissing - -from opslib.osm.pod import ( - ContainerV3Builder, - PodSpecV3Builder, -) - -from opslib.osm.validator import ( - ModelValidator, - validator, -) - +from opslib.osm.interfaces.http import HttpClient from opslib.osm.interfaces.kafka import KafkaClient from opslib.osm.interfaces.mongo import MongoClient -from opslib.osm.interfaces.http import HttpClient +from opslib.osm.pod import ContainerV3Builder, PodSpecV3Builder +from opslib.osm.validator import ModelValidator, validator logger = logging.getLogger(__name__) @@ -54,7 +45,7 @@ class ConfigModel(ModelValidator): vca_host: str vca_port: int vca_user: str - vca_password: str + vca_secret: str vca_pubkey: str vca_cacert: str vca_cloud: str @@ -62,6 +53,60 @@ class ConfigModel(ModelValidator): database_commonkey: str log_level: str vca_apiproxy: Optional[str] + # Model-config options + vca_model_config_agent_metadata_url: Optional[str] + vca_model_config_agent_stream: Optional[str] + vca_model_config_apt_ftp_proxy: Optional[str] + vca_model_config_apt_http_proxy: Optional[str] + vca_model_config_apt_https_proxy: Optional[str] + vca_model_config_apt_mirror: Optional[str] + vca_model_config_apt_no_proxy: Optional[str] + vca_model_config_automatically_retry_hooks: Optional[bool] + vca_model_config_backup_dir: Optional[str] + vca_model_config_cloudinit_userdata: Optional[str] + vca_model_config_container_image_metadata_url: Optional[str] + vca_model_config_container_image_stream: Optional[str] + vca_model_config_container_inherit_properties: Optional[str] + vca_model_config_container_networking_method: Optional[str] + vca_model_config_default_series: Optional[str] + vca_model_config_default_space: Optional[str] + vca_model_config_development: Optional[bool] + vca_model_config_disable_network_management: Optional[bool] + vca_model_config_egress_subnets: Optional[str] + vca_model_config_enable_os_refresh_update: Optional[bool] + vca_model_config_enable_os_upgrade: Optional[bool] + vca_model_config_fan_config: Optional[str] + vca_model_config_firewall_mode: Optional[str] + vca_model_config_ftp_proxy: Optional[str] + vca_model_config_http_proxy: Optional[str] + vca_model_config_https_proxy: Optional[str] + vca_model_config_ignore_machine_addresses: Optional[bool] + vca_model_config_image_metadata_url: Optional[str] + vca_model_config_image_stream: Optional[str] + vca_model_config_juju_ftp_proxy: Optional[str] + vca_model_config_juju_http_proxy: Optional[str] + vca_model_config_juju_https_proxy: Optional[str] + vca_model_config_juju_no_proxy: Optional[str] + vca_model_config_logforward_enabled: Optional[bool] + vca_model_config_logging_config: Optional[str] + vca_model_config_lxd_snap_channel: Optional[str] + vca_model_config_max_action_results_age: Optional[str] + vca_model_config_max_action_results_size: Optional[str] + vca_model_config_max_status_history_age: Optional[str] + vca_model_config_max_status_history_size: Optional[str] + vca_model_config_net_bond_reconfigure_delay: Optional[str] + vca_model_config_no_proxy: Optional[str] + vca_model_config_provisioner_harvest_mode: Optional[str] + vca_model_config_proxy_ssh: Optional[bool] + vca_model_config_snap_http_proxy: Optional[str] + vca_model_config_snap_https_proxy: Optional[str] + vca_model_config_snap_store_assertions: Optional[str] + vca_model_config_snap_store_proxy: Optional[str] + vca_model_config_snap_store_proxy_url: Optional[str] + vca_model_config_ssl_hostname_verification: Optional[bool] + vca_model_config_test_mode: Optional[bool] + vca_model_config_transmit_vendor_metrics: Optional[bool] + vca_model_config_update_status_hook_interval: Optional[str] @validator("log_level") def validate_log_level(cls, v): @@ -136,7 +181,7 @@ class LcmCharm(CharmedOsmBase): "OSMLCM_VCA_PORT": config.vca_port, "OSMLCM_VCA_USER": config.vca_user, "OSMLCM_VCA_PUBKEY": config.vca_pubkey, - "OSMLCM_VCA_SECRET": config.vca_password, + "OSMLCM_VCA_SECRET": config.vca_secret, "OSMLCM_VCA_CACERT": config.vca_cacert, "OSMLCM_VCA_CLOUD": config.vca_cloud, "OSMLCM_VCA_K8S_CLOUD": config.vca_k8s_cloud, @@ -145,6 +190,13 @@ class LcmCharm(CharmedOsmBase): if config.vca_apiproxy: container_builder.add_env("OSMLCM_VCA_APIPROXY", config.vca_apiproxy) + model_config_envs = { + f"OSMLCM_{k.upper()}": v + for k, v in self.config.items() + if k.startswith("vca_model_config") + } + if model_config_envs: + container_builder.add_envs(model_config_envs) container = container_builder.build() # Add container to pod spec pod_spec_builder.add_container(container)