Skip to content

Commit

Permalink
Merge pull request #27 from vnsamsonov/main
Browse files Browse the repository at this point in the history
Debug checking mutation webhooks
  • Loading branch information
vnsamsonov authored Aug 9, 2023
2 parents 6308d35 + 1d1863d commit 7e2e5e9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion k8s-itlabs-operator/operators/keycloak.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def create_pods(body, patch, spec, annotations, **_):

@kopf.on.create("pods.v1", id="keycloak-connector-on-check-creation")
@mutation_hook_monitoring(connector_type="keycloak_connector")
def check_creation(annotations, body, spec, **_):
def check_creation(annotations, body, **_):
status = MutationHookStatus()

if not KeycloakConnectorService.is_kk_conn_used_by_obj(annotations):
Expand All @@ -69,6 +69,7 @@ def check_creation(annotations, body, spec, **_):

status.is_used = True
status.is_success = True
spec = body.get("spec", {})
if not KeycloakConnectorService.containers_contain_required_envs(spec):
kopf.event(
body,
Expand Down
3 changes: 2 additions & 1 deletion k8s-itlabs-operator/operators/postgresconnector.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def create_pods(body, patch, spec, annotations, labels, **_):

@kopf.on.create("pods.v1", id="postgres-connector-on-check-creation")
@mutation_hook_monitoring(connector_type="postgres_connector")
def check_creation(annotations, body, spec, **_):
def check_creation(annotations, body, **_):
status = MutationHookStatus()

if not PostgresConnectorService.is_pg_conn_used_by_object(annotations):
Expand All @@ -66,6 +66,7 @@ def check_creation(annotations, body, spec, **_):

status.is_used = True
status.is_success = True
spec = body.get("spec", {})
if not PostgresConnectorService.containers_contain_required_envs(spec):
kopf.event(
body,
Expand Down
3 changes: 2 additions & 1 deletion k8s-itlabs-operator/operators/rabbitconnector.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def create_pods(body, patch, spec, annotations, labels, **_):

@kopf.on.create("pods.v1", id="rabbit-connector-on-check-creation")
@mutation_hook_monitoring(connector_type="rabbit_connector")
def check_creation(annotations, body, spec, **_):
def check_creation(annotations, body, **_):
status = MutationHookStatus()

if not RabbitConnectorService.is_rabbit_conn_used_by_object(annotations):
Expand All @@ -60,6 +60,7 @@ def check_creation(annotations, body, spec, **_):

status.is_used = True
status.is_success = True
spec = body.get("spec", {})
if not RabbitConnectorService.containers_contain_required_envs(spec):
kopf.event(
body,
Expand Down
3 changes: 2 additions & 1 deletion k8s-itlabs-operator/operators/sentry.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,15 @@ def create_pods(body, patch, spec, labels, annotations, **_):

@kopf.on.create("pods.v1", id="sentry-connector-on-check-creation")
@mutation_hook_monitoring(connector_type="sentry_connector")
def check_creation(annotations, labels, body, spec, **_):
def check_creation(annotations, labels, body, new, **_):
status = MutationHookStatus()
if not SentryConnectorService.is_sentry_conn_used_by_object(annotations, labels):
status.is_used = False
return status

status.is_used = True
status.is_success = True
spec = body.get("spec", {})
if not SentryConnectorService.containers_contain_required_envs(spec):
kopf.event(
body,
Expand Down

0 comments on commit 7e2e5e9

Please sign in to comment.