Skip to content

Reload the password fingerprint key when its Secret changes or is deleted #73

Description

@ThoSap

Follow-up from the review of #71: #71 (comment)

Current behavior

PasswordFingerprintService.getKey() reads the key Secret postgresql-operator-password-fingerprint-key once. It then keeps the key in memory for the lifetime of the process and never invalidates it.

When the key Secret is deleted or changed, a running operator keeps the old key. It creates a new Secret only after a restart. #71 documents this: to retire a key, delete the key Secret and restart the operator.

With more than one operator replica, each replica holds its own copy of the key. After a key rotation without a restart of all replicas, the replicas compute different fingerprints for the same password.

Proposal

Watch the key Secret, for example with an informer on the operator namespace. Drop the cached key when the Secret changes or is deleted. The next reconcile then loads the new key or generates one, and re-applies every Role password once.

Acceptance criteria

  • A deleted key Secret causes a new key without a restart.
  • A changed key Secret causes the operator to use the new key without a restart.
  • A test uses the same service instance before and after the Secret change. The current test whenSecretLost_shouldCreateNewKey uses a new instance, so it does not cover this.
  • Update docs/role.md and the Javadoc of PasswordFingerprintService to remove the restart step.

Activity

  1. self-assigned this
    on Oct 25, 2026
  2. added theissue type on Oct 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions