Storage created before migratedb and server start#89
Conversation
Signed-off-by: desmax74 <mdessi@redhat.com>
Reviewer's guide (collapsed on small PRs)Reviewer's GuideMakes the common storage PersistentVolumeClaim a Helm pre-install/pre-upgrade hook that is created (once) before other components, with resource retention, by moving it to the common chart and guarding it with a lookup-based existence check. Sequence diagram for Helm pre-install/pre-upgrade PVC creationsequenceDiagram
participant Helm
participant Hook_pre_install
participant Kubernetes
participant Migratedb
participant Server
Helm->>Hook_pre_install: execute pre-install hooks
Hook_pre_install->>Kubernetes: lookup v1 PersistentVolumeClaim storage
alt [PVC does not exist]
Hook_pre_install->>Kubernetes: create PersistentVolumeClaim storage
Note over Hook_pre_install,Kubernetes: annotations: helm.sh/hook pre-install,pre-upgrade
else [PVC already exists]
Hook_pre_install-->>Kubernetes: skip creation
end
Helm->>Migratedb: install/upgrade migratedb
Helm->>Server: install/upgrade server
Flow diagram for PVC creation guard using lookupflowchart TD
A[Helm pre-install or pre-upgrade hook] --> B[lookup PersistentVolumeClaim storage]
B -->|not found| C[create PersistentVolumeClaim storage
annotations: hook, hook-weight, resource-policy keep]
B -->|found| D[skip PVC creation]
C --> E[continue chart installation]
D --> E[continue chart installation]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- With the
.Values.modules.server.enabledguard removed and the PVC moved tocommon, this volume will now be created for all releases regardless of which modules are enabled; please confirm this broader scope is intentional or consider reintroducing a narrower condition if only certain modules require it. - Using
helm.sh/resource-policy: keepmeans the PVC will persist even after uninstall or template removal, which can complicate cleanup and future installs; consider whether this is desired or if a hook delete policy (e.g.helm.sh/hook-delete-policy) would better match your lifecycle needs.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- With the `.Values.modules.server.enabled` guard removed and the PVC moved to `common`, this volume will now be created for all releases regardless of which modules are enabled; please confirm this broader scope is intentional or consider reintroducing a narrower condition if only certain modules require it.
- Using `helm.sh/resource-policy: keep` means the PVC will persist even after uninstall or template removal, which can complicate cleanup and future installs; consider whether this is desired or if a hook delete policy (e.g. `helm.sh/hook-delete-policy`) would better match your lifecycle needs.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
Not sure this is still relevant? As there's also the other PR? |
|
@ctron this pr ensure the storage is present on migratedb and on server pods, the other PR #8 add only a configuration but but doesn't fix the missing storage when migratedb was executed since was performed only when the server start after the migratedb that failed due to the not yet available pvc. This PR fix move the storage creation in the migratedb and leave as is for the server executed as a last pod. |
ctron
left a comment
There was a problem hiding this comment.
Looks good to me. But I guess this might break upgrade process.
|
As @ctron mentioned, fresh installation works without any issues. But upgrade with |
Signed-off-by: desmax74 <mdessi@redhat.com>
|
@sourcery-ai review |
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Removing the
modules.server.enabledguard means this PVC will now be rendered wheneverstorage.typeisfilesystem, regardless of which modules are enabled; double‑check this won't create unused PVCs or conflict with other module configurations. - Because the PVC is now created as a
pre-install,pre-upgradehook withhelm.sh/resource-policy: keep, updates to the PVC spec will not be reconciled for existing claims; confirm that future spec changes are either unnecessary or will be handled via a migration process. - The
lookupguard prevents duplicate PVC creation but assumes the Helm release has RBAC to list PVCs in the namespace; consider what happens in restricted environments and whether you need a fallback or explicit note about this requirement.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Removing the `modules.server.enabled` guard means this PVC will now be rendered whenever `storage.type` is `filesystem`, regardless of which modules are enabled; double‑check this won't create unused PVCs or conflict with other module configurations.
- Because the PVC is now created as a `pre-install,pre-upgrade` hook with `helm.sh/resource-policy: keep`, updates to the PVC spec will not be reconciled for existing claims; confirm that future spec changes are either unnecessary or will be handled via a migration process.
- The `lookup` guard prevents duplicate PVC creation but assumes the Helm release has RBAC to list PVCs in the namespace; consider what happens in restricted environments and whether you need a fallback or explicit note about this requirement.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
ctron
left a comment
There was a problem hiding this comment.
To my understanding, this would lead to data corruption. As the migration would NOT run with the actual data. But with an empty set.
8f2761c to
c0a8f53
Compare

Summary by Sourcery
Enhancements: