Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
dynamo
Commits
3c85cfd3
Unverified
Commit
3c85cfd3
authored
Jun 10, 2025
by
julienmancuso
Committed by
GitHub
Jun 10, 2025
Browse files
fix: add blocking mode for k8s connector in planner (#1446)
parent
9b1265ed
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
1 deletion
+7
-1
components/planner/src/dynamo/planner/kubernetes_connector.py
...onents/planner/src/dynamo/planner/kubernetes_connector.py
+5
-1
components/planner/test/kubernetes_connector.py
components/planner/test/kubernetes_connector.py
+2
-0
No files found.
components/planner/src/dynamo/planner/kubernetes_connector.py
View file @
3c85cfd3
...
@@ -43,7 +43,7 @@ class KubernetesConnector(PlannerConnector):
...
@@ -43,7 +43,7 @@ class KubernetesConnector(PlannerConnector):
self
.
_get_graph_deployment_name
(
deployment
)
self
.
_get_graph_deployment_name
(
deployment
)
)
)
async
def
remove_component
(
self
,
component_name
:
str
):
async
def
remove_component
(
self
,
component_name
:
str
,
blocking
:
bool
=
True
):
"""Remove a component by decreasing its replica count by 1"""
"""Remove a component by decreasing its replica count by 1"""
deployment
=
await
self
.
kube_api
.
get_graph_deployment
(
deployment
=
await
self
.
kube_api
.
get_graph_deployment
(
component_name
,
self
.
namespace
component_name
,
self
.
namespace
...
@@ -60,6 +60,10 @@ class KubernetesConnector(PlannerConnector):
...
@@ -60,6 +60,10 @@ class KubernetesConnector(PlannerConnector):
component_name
,
component_name
,
current_replicas
-
1
,
current_replicas
-
1
,
)
)
if
blocking
:
await
self
.
kube_api
.
wait_for_graph_deployment_ready
(
self
.
_get_graph_deployment_name
(
deployment
)
)
def
_get_current_replicas
(
self
,
deployment
:
dict
,
component_name
:
str
)
->
int
:
def
_get_current_replicas
(
self
,
deployment
:
dict
,
component_name
:
str
)
->
int
:
"""Get the current replicas for a component in a graph deployment"""
"""Get the current replicas for a component in a graph deployment"""
...
...
components/planner/test/kubernetes_connector.py
View file @
3c85cfd3
...
@@ -123,6 +123,7 @@ async def test_remove_component_decreases_replicas(kubernetes_connector, mock_ku
...
@@ -123,6 +123,7 @@ async def test_remove_component_decreases_replicas(kubernetes_connector, mock_ku
mock_kube_api
.
update_graph_replicas
.
assert_called_once_with
(
mock_kube_api
.
update_graph_replicas
.
assert_called_once_with
(
"test-graph"
,
component_name
,
1
"test-graph"
,
component_name
,
1
)
)
mock_kube_api
.
wait_for_graph_deployment_ready
.
assert_called_once_with
(
"test-graph"
)
@
pytest
.
mark
.
asyncio
@
pytest
.
mark
.
asyncio
...
@@ -140,3 +141,4 @@ async def test_remove_component_with_zero_replicas(kubernetes_connector, mock_ku
...
@@ -140,3 +141,4 @@ async def test_remove_component_with_zero_replicas(kubernetes_connector, mock_ku
# Assert
# Assert
mock_kube_api
.
update_graph_replicas
.
assert_not_called
()
mock_kube_api
.
update_graph_replicas
.
assert_not_called
()
mock_kube_api
.
wait_for_graph_deployment_ready
.
assert_not_called
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment