Skip to content

Commit

Permalink
Removed unnecessary namespace references from code
Browse files Browse the repository at this point in the history
  • Loading branch information
tymuraheiev committed Jan 21, 2025
1 parent 416e2f6 commit 36e16d2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
11 changes: 2 additions & 9 deletions src/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ def on_field_match_namespace(
old: Optional[List[str]],
new: List[str],
name: str,
namespace: str,
body,
uid: str,
logger: logging.Logger,
Expand Down Expand Up @@ -91,13 +90,12 @@ def on_field_match_namespace(
csecs_cache.set_cluster_secret(BaseClusterSecret(
uid=uid,
name=name,
namespace=namespace,
body=body,
synced_namespace=updated_matched,
))

# Patch synced_ns field
logger.debug(f'Patching clustersecret {name} in namespace {namespace}')
logger.debug(f'Patching clustersecret {name}')
patch_clustersecret_status(
logger=logger,
name=name,
Expand All @@ -113,7 +111,6 @@ def on_field_data(
body: Dict[str, Any],
meta: kopf.Meta,
name: str,
namespace: Optional[str],
uid: str,
logger: logging.Logger,
**_,
Expand Down Expand Up @@ -166,7 +163,7 @@ def on_field_data(

if updated_syncedns != syncedns:
# Patch synced_ns field
logger.debug(f'Patching clustersecret {name} in namespace {namespace}')
logger.debug(f'Patching clustersecret {name}')
body = patch_clustersecret_status(
logger=logger,
name=name,
Expand All @@ -178,7 +175,6 @@ def on_field_data(
csecs_cache.set_cluster_secret(BaseClusterSecret(
uid=uid,
name=name,
namespace=namespace or "",
body=body,
synced_namespace=updated_syncedns,
))
Expand All @@ -190,7 +186,6 @@ async def create_fn(
logger: logging.Logger,
uid: str,
name: str,
namespace: str,
body: Dict[str, Any],
**_
):
Expand All @@ -211,7 +206,6 @@ async def create_fn(
csecs_cache.set_cluster_secret(BaseClusterSecret(
uid=uid,
name=name,
namespace=namespace or "",
body=body,
synced_namespace=matchedns,
))
Expand Down Expand Up @@ -283,7 +277,6 @@ async def startup_fn(logger: logging.Logger, **_):
BaseClusterSecret(
uid=metadata.get('uid'),
name=metadata.get('name'),
namespace=metadata.get('namespace', ''),
body=item,
synced_namespace=item.get('status', {}).get('create_fn', {}).get('syncedns', []),
)
Expand Down
1 change: 0 additions & 1 deletion src/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@
class BaseClusterSecret(BaseModel):
uid: str
name: str
namespace: str
body: Dict[str, Any]
synced_namespace: List[str]

0 comments on commit 36e16d2

Please sign in to comment.