Skip to content

This PR is to add comments to etMasterStatefulset in fluid/pkg/ddc/alluxio/utils.go.#6080

Open
zhayangyu22 wants to merge 1 commit into
fluid-cloudnative:masterfrom
zhayangyu22:new-branch
Open

This PR is to add comments to etMasterStatefulset in fluid/pkg/ddc/alluxio/utils.go.#6080
zhayangyu22 wants to merge 1 commit into
fluid-cloudnative:masterfrom
zhayangyu22:new-branch

Conversation

@zhayangyu22

Copy link
Copy Markdown

Ⅰ. Describe what this PR does

Add comments to etMasterStatefulset in fluid/pkg/ddc/alluxio/utils.go.

Ⅱ. Does this pull request fix one issue?

fixes #6079

Ⅲ. Special notes for reviews

Signed-off-by: 赵媛媛231840070 <231840070@smail.nju.edu.cn>
@fluid-e2e-bot

fluid-e2e-bot Bot commented Jun 29, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign trafalgarzzz for approval by writing /assign @trafalgarzzz in a comment. For more information see:The Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@fluid-e2e-bot

fluid-e2e-bot Bot commented Jun 29, 2026

Copy link
Copy Markdown

Hi @zhayangyu22. Thanks for your PR.

I'm waiting for a fluid-cloudnative member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request adds a documentation comment to the getMasterStatefulset method in pkg/ddc/alluxio/utils.go. Feedback was provided to correct the documentation, as it incorrectly states that the returned master pointer is nil on error, whereas the implementation actually returns a pointer to an empty StatefulSet struct.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread pkg/ddc/alluxio/utils.go
Comment on lines +85 to +87
// Returns:
// - master: a pointer to the appsv1.StatefulSet object if found; nil on error.
// - err: non-nil if the retrieval fails (e.g., resource not found, network issue).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The comment states that master is nil on error. However, looking at the implementation of getMasterStatefulset, master is initialized as &appsv1.StatefulSet{} and then returned along with the error. Therefore, on error, master will be a pointer to an empty StatefulSet struct rather than nil. The comment should be updated to accurately reflect this behavior to prevent callers from incorrectly assuming they can perform a simple nil check on the returned master pointer.

Suggested change
// Returns:
// - master: a pointer to the appsv1.StatefulSet object if found; nil on error.
// - err: non-nil if the retrieval fails (e.g., resource not found, network issue).
// Returns:
// - master: a pointer to the appsv1.StatefulSet object (note: on error, this is a pointer to an empty StatefulSet, not nil).
// - err: non-nil if the retrieval fails (e.g., resource not found, network issue).

@sonarqubecloud

Copy link
Copy Markdown

Comment thread pkg/ddc/alluxio/utils.go
// - name: the name of the StatefulSet resource.
// - namespace: the Kubernetes namespace where the StatefulSet resides.
//
// Returns:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for adding GoDoc here — the description of the parameters and behavior is clear. One small accuracy nit on the return value: the comment says master: a pointer to the appsv1.StatefulSet object if found; nil on error., but the implementation always allocates master = &appsv1.StatefulSet{} before calling e.Client.Get, so the returned pointer is never nil. On error it just points to a zero-value StatefulSet.

Consider rewording to match the actual behavior, for example:

//   - master: a non-nil pointer to an appsv1.StatefulSet; populated when err is nil,
//             otherwise points to a zero-value StatefulSet and should not be relied upon.

Keeping the doc precise here helps callers reason about nil checks vs. error checks.

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.

Add Notation to getMasterStatefulset in fluid/pkg/ddc/alluxio/utils.go.

2 participants