Skip to content

Commit c75c3e8

Browse files
gurghetclaude
andcommitted
fix: use force parameter correctly in create_deploy_key
The check was using kwargs.get('force') instead of the force parameter, so the force=True from reconcile calls was being ignored. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 5da9fbe commit c75c3e8

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

operator.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,13 +259,17 @@ def delete_secret_if_exists(self, name, namespace):
259259
return False
260260

261261
@kopf.on.create('github.com', 'v1alpha1', 'githubdeploykeys')
262-
def create_deploy_key(spec, status, logger, patch, force=True, **kwargs):
263-
"""Create a new deploy key. Called by kopf on CR creation and by reconcile when key is missing."""
262+
def create_deploy_key(spec, status, logger, patch, force=False, **kwargs):
263+
"""Create a new deploy key. Called by kopf on CR creation and by reconcile when key is missing.
264+
265+
Args:
266+
force: If True, proceed even if CR already has keyId (used by reconcile when key is missing)
267+
"""
264268

265269
# If called from on.create but CR already has a keyId, skip - let reconcile handle it
266270
# This prevents duplicate key creation when operator restarts and sees existing CRs
267271
# When called from reconcile (with force=True), always proceed
268-
if status and status.get('keyId') and not kwargs.get('force'):
272+
if status and status.get('keyId') and not force:
269273
logger.info(f"CR already has keyId {status['keyId']}, skipping on.create - reconcile will handle it")
270274
return
271275

0 commit comments

Comments
 (0)