Skip to content
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

object: unique username for OBC even when preceding OBC was retained #12884

Merged
merged 1 commit into from
Sep 12, 2023

Conversation

haslersn
Copy link
Contributor

@haslersn haslersn commented Sep 11, 2023

Description of your changes:

For an OBC's name we cannot simply use the OBC's namespace and name, because they can be reused, while the preceding bucket might be retained by reclaimPolicy. (PR #11665 also didn't solve this issue, as it is an intra-cluster issue.) Therefore we instead use the OBC's UID which should be unique within the cluster and across clusters.

Similar to how it was after #11665, existing users will continue to work, i.e., rook will not update the ObjectBucket.spec.additionalState.cephUser field of existing buckets.

Which issue is resolved by this Pull Request:
Resolves #11345

Checklist:

  • Commit Message Formatting: Commit titles and messages follow guidelines in the developer guide.
  • Reviewed the developer guide on Submitting a Pull Request
  • Pending release notes updated with breaking and/or notable changes for the next minor release.
  • Documentation has been updated, if necessary.
  • Unit tests have been added, if necessary.
  • Integration tests have been added, if necessary.

@BlaineEXE
Copy link
Member

I think this is working to address the same class of bug as this other PR #12880 (comment).

I believe that this implementation is a simpler approach that I would prefer.

One requirement, @haslersn : please copy the commit description to this PR itself for easier discussion within GitHub.

// user name can be deterministically generated from the OBC's UID. We
// cannot simply use the OBC's namespace and name, because they can be
// reused, while the preceding bucket might be retained by reclaimPolicy.
return "obc-" + string(obc.UID)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally, I like the idea of keeping obcNamespace and obcName here to help with visual inspection of users on the backend and mapping them into the k8s domain. This isn't a hard requirement, but I believe it's a worthwhile "hint" that can help when doing complex debugging, and it's essentially free.

Suggested change
return "obc-" + string(obc.UID)
return "obc-" + obc.Namespace + "-" obc.Name + string(obc.UID)

Copy link
Member

@BlaineEXE BlaineEXE left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#12884 (comment)

I think this can be disregarded. While namespace names are limited to 63 chars, the k8s spec says that resource names can be up to 253, which is approaching the known 255 limit for obc "friendly" user names. While I seem to recall being limited to 63 chars for CR names, I may be mistaken, and it seems safest to proceed with this PR as-is.

For an OBC's name we cannot simply use the OBC's namespace and name,
because they can be reused, while the preceding bucket might be
retained by reclaimPolicy. (Commit 2733375 also didn't solve
this issue, as it is an intra-cluster issue.) Therefore we instead
use the OBC's UID which should be unique within the cluster and
across clusters.

Signed-off-by: Sebastian Hasler <sebastian.hasler@stuvus.uni-stuttgart.de>
@BlaineEXE
Copy link
Member

Considering point 2 of Travis' question here: #12880 (comment)

I think it would be good to create an OBC before this change and then ensure it still works afterwards. I thought we checked this in Rook's upgrade test, but I am seeing that isn't the case.

@BlaineEXE
Copy link
Member

Considering point 2 of Travis' question here: #12880 (comment)

I think it would be good to create an OBC before this change and then ensure it still works afterwards. I thought we checked this in Rook's upgrade test, but I am seeing that isn't the case.

Related Issue describing the need for OBC testing during upgrade CI: #12887

@haslersn
Copy link
Contributor Author

I tested this PR by cherry-picking 041fc1a on top of v1.12.3, building and deploying that. I confirm that now deleting and recreating an ObjectBucketClaim with the same namespace and name works, even if the previous bucket is retained.

@BlaineEXE BlaineEXE merged commit 6b6ef13 into rook:master Sep 12, 2023
50 checks passed
@BlaineEXE
Copy link
Member

@travisn thoughts on 1.11 bp here?

@travisn
Copy link
Member

travisn commented Sep 12, 2023

@travisn thoughts on 1.11 bp here?

Sounds good to could include. In general, if someone asks for a 1.11 backport we can still do it if needed.

@haslersn haslersn deleted the unique-username-for-obc branch September 12, 2023 16:57
mergify bot added a commit that referenced this pull request Sep 12, 2023
object: unique username for OBC even when preceding OBC was retained (backport #12884)
travisn added a commit that referenced this pull request Sep 12, 2023
object: unique username for OBC even when preceding OBC was retained (backport #12884)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ObjectBucketClaim user can conflict with previously created users
3 participants