Skip to content

Commit

Permalink
Merge branch 'main' into prs/externalize-modulehandler-subclasses
Browse files Browse the repository at this point in the history
Signed-off-by: Tobias Wolf <[email protected]>
  • Loading branch information
NotTheEvilOne committed Jun 12, 2024
2 parents 4dcc214 + e2ce404 commit 6e9aec5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
21 changes: 17 additions & 4 deletions src/rookify/modules/create_cluster/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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"
Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/rookify/modules/create_configmap/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 6e9aec5

Please sign in to comment.