Generalise auto-restart logic to support workloads other than Deployments #195
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
Refactors the auto-restart logic for workloads referencing 1Password-managed secrets. It generalises internal logic to allow future support for non-Deployment workload types (i.e. stateful sets, daemon sets) while preserving existing behaviour.
client.Object
orruntime.Object
The next steps should this implementation be approved would be to implement controllers for each of the remaining workloads. I believe the current controller could also be genericised in a similar way seen in this PR – which would be ideal as otherwise we'd need to think about how secrets are cleaned up when they're shared by multiple workloads/controllers.
A demo of this implementation working for DaemonSets can be found at: https://github.com/jmsnll/onepassword-operator/tree/feat/demo-daemonsets-autorestart
Related Issue(s)
Changelog
GetPodTemplate
extracts pod template from known workload typesGetUpdatedSecretsForPodTemplate
resolves updated secrets from a pod specruntime.Object
for workload definitions