Skip to content

Commit

Permalink
fix: UPF pod stuck at waiting status for pfcp-agent service (#390)
Browse files Browse the repository at this point in the history
Signed-off-by: gatici <[email protected]>
  • Loading branch information
gatici authored Oct 3, 2024
1 parent 5bba2a9 commit dceb48b
Show file tree
Hide file tree
Showing 4 changed files with 266 additions and 64 deletions.
27 changes: 24 additions & 3 deletions src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,10 @@ def _on_collect_unit_status(self, event: CollectStatusEvent): # noqa C901
event.add_status(WaitingStatus("Waiting for bessd container to be ready"))
logger.info("Waiting for bessd container to be ready")
return
if not self._pfcp_agent_container.can_connect():
event.add_status(WaitingStatus("Waiting for pfcp-agent container to be ready"))
logger.info("Waiting for pfcp-agent container to be ready")
return
self.unit.set_workload_version(self._get_workload_version())

if not self._kubernetes_multus.is_ready():
Expand All @@ -485,8 +489,19 @@ def _on_collect_unit_status(self, event: CollectStatusEvent): # noqa C901
logger.info("Waiting for RAN route creation")
return
if not path_exists(container=self._bessd_container, path=BESSD_CONTAINER_CONFIG_PATH):
event.add_status(WaitingStatus("Waiting for storage to be attached"))
logger.info("Waiting for storage to be attached")
event.add_status(
WaitingStatus("Waiting for storage to be attached for bessd container")
)
logger.info("Waiting for storage to be attached for bessd container")
return
if not path_exists(
container=self._pfcp_agent_container,
path=PFCP_AGENT_CONTAINER_CONFIG_PATH,
):
event.add_status(
WaitingStatus("Waiting for storage to be attached for pfcp-agent container")
)
logger.info("Waiting for storage to be attached for pfcp-agent container")
return
if not service_is_running_on_container(self._bessd_container, self._bessd_service_name):
event.add_status(WaitingStatus("Waiting for bessd service to run"))
Expand Down Expand Up @@ -586,7 +601,10 @@ def _on_pfcp_agent_pebble_ready(self, _: EventBase) -> None:
return
if not self._hugepages_are_available():
return
if not service_is_running_on_container(self._bessd_container, self._bessd_service_name):
if not path_exists(
container=self._pfcp_agent_container,
path=PFCP_AGENT_CONTAINER_CONFIG_PATH,
):
return
self._configure_pfcp_agent_workload()

Expand Down Expand Up @@ -878,12 +896,15 @@ def _exec_command_in_bessd_workload(

def _configure_pfcp_agent_workload(self) -> None:
"""Configure pebble layer for `pfcp-agent` container."""
restart_service = False
plan = self._pfcp_agent_container.get_plan()
layer = self._pfcp_agent_pebble_layer
if plan.services != layer.services:
self._pfcp_agent_container.add_layer(
"pfcp", self._pfcp_agent_pebble_layer, combine=True
)
restart_service = True
if restart_service:
self._pfcp_agent_container.restart(self._pfcp_agent_service_name)
logger.info("Service `pfcp` restarted")

Expand Down
Loading

0 comments on commit dceb48b

Please sign in to comment.