-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Improvement] Make InstanceSet controller set ownerReferences on PersistentVolumeClaims #7846
Comments
This issue has been marked as stale because it has been open for 30 days with no activity |
Any updates? This is still causing issues for me after migrating to InstanceSets |
There's a historical reason for not supporting owner reference of PVCs in InstanceSets. Will support in next major version of KubeBlocks which planned to release within 2 months. |
If anyone else comes across this issue, a workaround on the Argo CD side is to set |
@jackmaninov One more thing incase you don't know yet: the StatefulSet will not add a |
Yes, after digging deeper the root cause of my issue turns out to be more argo-cd's poor default component tracking, coupled with the change in behaviour of the InstanceSet. The configuration change I posted above seems to be the "correct" fix. Not sure if you want to close this issue. However, adding an ownerReference to PVCs when the cluster/component's retention policy is Delete also sounds like correct behaviour. Then the API server would garbage collect them automatically, rather than kubeblocks needing to do it. |
I hit that one too and the annotation based tracking resolved it. |
Is your improvement request related to a problem?
After upgrading kubeblocks from 0.8.x to 0.9.0 all my clusters were migrated from StatefulSets to InstanceSets. My existing clusters are working as expected, but when I create new clusters, their PersistentVolumeClaims do not receive ownerReferences pointing to the Component that created them.
Existing PVCs created by StatefulSet Components have ownerReferences like:
while new PVCs created by InstanceSet Components have no ownerReferences.
Having an ownerReference on a PVC lets continuous delivery tools like argo-cd identify the source of an object, and identify them as belonging to an application set. Without these references, argo-cd identifies these PVCs as stray objects and will attempt to prune them (for example once an attached pod is killed). There are also garbage collection implications to ownerReferences.
According to https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#persistentvolumeclaim-retention the StatefulSet controller is responsible for adding these ownerReferences to PVCs normally, so by migrating to InstanceSets we are losing this functionality.
If this is a new function, please describe the motivation and goals.
I am deploying kubeblocks Clusters using argo-cd in projects that require stray resources to be pruned, and I do not want my Cluster PVCs to be pruned.
Describe the solution you'd like
InstanceSet controller should add ownerReferences to PVCs referencing their Components similiar to the StatefulSet controller.
Describe alternatives you've considered
I can disable pruning in my projects, however by their nature they will have other objects that require pruning from time to time, so this is not ideal. I would have to reorganise my projects to remove Clusters to a separate one, which is also not ideal.
For now I am manually adding ownerReferences to the affected PVCs.
The text was updated successfully, but these errors were encountered: