kube-object-storage / lib-bucket-provisioner

Library for the dynamic provisioning of object store buckets to be used by object store providers.
Apache License 2.0
20 stars 22 forks source link

When OBC is deployed using ArgoCD, the reconciliation process does not end #206

Closed llamerada-jp closed 1 year ago

llamerada-jp commented 3 years ago

We are trying to deploy Rook's OBC using ArgoCD. We expect that the OB will be created and the status of the OBC will be changed to Bound. However, the process does not end with a Pending status for the following reasons. I'm going to create a patch to fix the problem.

  1. ArgoCD deploys an OBC resource with the label app.kubernetes.io/instance: <ArgoCD's app name>.
  2. Reconciling process of lib-bucket-provisioner runs. In the reconciling process, update the label with the setOBCMetaFields function. When updating a label, existing labels are ignored and only the bucket-provisioner label is given. https://github.com/kube-object-storage/lib-bucket-provisioner/blob/2e9d6aa76d5895c0b497758e250e9ba69e6c18c1/pkg/provisioner/controller.go#L616 Also, the setOBCMetaFields function discards the return value of the Update function. https://github.com/kube-object-storage/lib-bucket-provisioner/blob/2e9d6aa76d5895c0b497758e250e9ba69e6c18c1/pkg/provisioner/controller.go#L624
  3. Trying to update spec.bucketName and spec.objectBucketName in OBC after updating OB. However, since the OBC is updated by the setOBCMetaFields function, it will output the following message and terminate with an error. the object has been modified; please apply your changes to the latest version and try again, requeuing https://github.com/kube-object-storage/lib-bucket-provisioner/blob/2e9d6aa76d5895c0b497758e250e9ba69e6c18c1/pkg/provisioner/controller.go#L331
  4. ArgoCD will add app.kubernetes.io/instance: label to the OBC again.
  5. Repeat from 2.

How to reproduce it:

You can reproduce the ArgoCD process by using a shell script like the following.

while true
do
  kubectl label objectbucketclaim -n sandbox obc app.kubernetes.io/instance=sandbox 
done
apiVersion: objectbucket.io/v1alpha1
kind: ObjectBucketClaim
metadata:
  name: obc
  namespace: sandbox
spec:
  generateBucketName: obc-poc
  storageClassName: ceph-hdd-bucket

Environment: Kubernetes: 1.18.9 Rook: 1.5.4 Ceph: 15.2.7

toshipp commented 3 years ago

This is fixed by https://github.com/rook/rook/pull/7086