Skip to content

Commit

Permalink
Fix configmap creation
Browse files Browse the repository at this point in the history
Signed-off-by: Tyler Gu <[email protected]>
  • Loading branch information
tylergu committed Oct 9, 2023
1 parent fc84c59 commit 49411d5
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions acto/post_process/simple_crash_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,28 @@ def create_anvil_crash_config_map(
"expected": "1",
},
)
core_v1_api.replace_namespaced_config_map(
core_v1_api.create_namespaced_config_map(
name="fault-injection-config",
namespace="default",
body=config_map,
)

def replace_anvil_crash_config_map(
apiclient: kubernetes.client.ApiClient, cr_kind: str, namespace: str, cr_name: str):
core_v1_api = kubernetes.client.CoreV1Api(apiclient)
config_map = k8s_models.V1ConfigMap(
api_version="v1",
kind="ConfigMap",
metadata=k8s_models.V1ObjectMeta(
name="fault-injection-config",
),
data={
"cr_key": f"{cr_kind}/{namespace}/{cr_name}",
"current": "0",
"expected": "1",
},
)
core_v1_api.create_namespaced_config_map(
name="fault-injection-config",
namespace="default",
body=config_map,
Expand All @@ -58,7 +79,7 @@ def __init__(self, workqueue: multiprocessing.Queue, context: dict,
cr_kind = self._context['crd']['body']['spec']['names']['kind']
namespace = self._context['namespace']
cr_name = 'test-cluster'
self._hook = partial(create_anvil_crash_config_map, cr_kind=cr_kind,
self._hook = partial(replace_anvil_crash_config_map, cr_kind=cr_kind,
namespace=namespace, cr_name=cr_name)

def run(self):
Expand Down

0 comments on commit 49411d5

Please sign in to comment.