diff --git a/src/rookify/modules/create_cluster/main.py b/src/rookify/modules/create_cluster/main.py index d7fd9a4..43cbd3c 100644 --- a/src/rookify/modules/create_cluster/main.py +++ b/src/rookify/modules/create_cluster/main.py @@ -16,16 +16,16 @@ class CreateClusterHandler(ModuleHandler): @property def __mon_placement_label(self) -> str: - return ( # type: ignore - self._config["rook"]["cluster"]["mon_placement_label"] + return ( + str(self._config["rook"]["cluster"]["mon_placement_label"]) if "mon_placement_label" in self._config["rook"]["cluster"] else f"placement-{self._config["rook"]["cluster"]["name"]}-mon" ) @property def __mgr_placement_label(self) -> str: - return ( # type: ignore - self._config["rook"]["cluster"]["mgr_placement_label"] + return ( + str(self._config["rook"]["cluster"]["mgr_placement_label"]) if "mgr_placement_label" in self._config["rook"]["cluster"] else f"placement-{self._config["rook"]["cluster"]["name"]}-mgr" ) @@ -54,6 +54,15 @@ def __create_cluster_definition(self) -> None: f"There are more than 1 mgr running on node {node}" ) + self.logger.debug( + "Rook cluster definition values: {0} {1} with mon label {2} and mgr label {3}".format( + self._config["rook"]["cluster"]["namespace"], + self._config["rook"]["cluster"]["name"], + self.__mon_placement_label, + self.__mgr_placement_label, + ) + ) + # Render cluster config from template cluster_definition = self.load_template( "cluster.yaml.j2", @@ -97,6 +106,8 @@ def preflight(self) -> None: self.__create_cluster_definition() def execute(self) -> None: + self.logger.info("Creating Rook cluster definition") + # Create CephCluster cluster_definition = self.machine.get_preflight_state( "CreateClusterHandler" @@ -105,6 +116,8 @@ def execute(self) -> None: self.k8s.crd_api_apply(cluster_definition) # Wait for CephCluster to get into Progressing phase + self.logger.info("Waiting for Rook cluster created") + result = self.k8s.watch_events( self._watch_cluster_phase_callback, self.k8s.custom_objects_api.list_namespaced_custom_object, diff --git a/src/rookify/modules/create_configmap/main.py b/src/rookify/modules/create_configmap/main.py index 4a3136f..37d843f 100644 --- a/src/rookify/modules/create_configmap/main.py +++ b/src/rookify/modules/create_configmap/main.py @@ -71,13 +71,13 @@ def execute(self) -> None: **self.machine.get_preflight_state("CreateConfigMapHandler").configmap ) - configmap = self.k8s.core_v1_api.create_namespaced_config_map( + configmap_created = self.k8s.core_v1_api.create_namespaced_config_map( self._config["rook"]["cluster"]["namespace"], body=configmap ) self.machine.get_execution_state( "CreateConfigMapHandler" - ).configmap = configmap.to_dict() + ).configmap = configmap_created.to_dict() # Get or create needed auth keys admin_auth: Dict[str, Any] = self.ceph.mon_command(