Skip to content

add synced resource version status#189

Merged
paul-the-alien[bot] merged 1 commit intomainfrom
fix/add-resource-version
Jun 25, 2021
Merged

add synced resource version status#189
paul-the-alien[bot] merged 1 commit intomainfrom
fix/add-resource-version

Conversation

@moolen
Copy link
Copy Markdown
Member

@moolen moolen commented Jun 9, 2021

This fixes #169.

Adds a SyncedResourceVersion to the Status field: it keeps track of the last synced external secret.

It's a string and has the schema {generation}-{meta-hash}. We can not rely solely on the metadata.generation, because it is not updated when object-meta changes. The hash is generated only from the labels and annotations fields.

We need this to:
A) prevent the controller from reconciling an already synced secret (within the refresh interval)
B) do not reconcile if only the status field was changed (to prevent controller recon loops on status updates)

Example:

Status:
  Conditions:
    Last Transition Time:   2021-06-09T17:28:53Z
    Message:                Secret was synced
    Reason:                 SecretSynced
    Status:                 True
    Type:                   Ready
  Refresh Time:             2021-06-09T18:00:46Z
  Synced Resource Version:  2-9c4307d314852c669189b819592d73e6

Minor changes:

  • using Status().Patch() instead of Update()
  • using defer to update patch the status field after the controller is done
  • the metrics in the controller tests can now be exact (ES is reconciled exactly once in the changed test cases)

@moolen moolen force-pushed the fix/add-resource-version branch from 6758a17 to 0663bcb Compare June 9, 2021 20:54
@moolen moolen changed the title draft: add synced resource version status add synced resource version status Jun 14, 2021
@moolen moolen requested a review from mcavoyk June 14, 2021 18:11
@knelasevero
Copy link
Copy Markdown
Member

Seems like a very nice solution to me! But I did not have the time to reproduce the bug of #169 to properly check everything yet.

@knelasevero
Copy link
Copy Markdown
Member

/approve

@knelasevero
Copy link
Copy Markdown
Member

/ok-to-test sha=0663bcb

@moolen moolen force-pushed the fix/add-resource-version branch from 0663bcb to 5ac02ed Compare June 25, 2021 19:23
@moolen
Copy link
Copy Markdown
Member Author

moolen commented Jun 25, 2021

/ok-to-test sha=5ac02ed

@moolen
Copy link
Copy Markdown
Member Author

moolen commented Jun 25, 2021

/merge

@paul-the-alien paul-the-alien bot merged commit 9d1d186 into main Jun 25, 2021
@paul-the-alien paul-the-alien bot deleted the fix/add-resource-version branch June 25, 2021 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ExternalSecret controller constantly updating and generating Vault tokens

2 participants