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

Make CloneSet and StatefulSet Support the generateName setting #1635

Closed
wants to merge 1 commit into from

Conversation

Radeity
Copy link

@Radeity Radeity commented May 31, 2024

Ⅰ. Describe what this PR does

  • Support generateName setting for CloneSet and StatefulSet.
  • Use generateName as prefix of the name of owned pod/pvc, rather using name like before. And if user doesn't declare generateName, generateName will be set the same value of name in webhook.

Ⅱ. Does this pull request fix one issue?

Ⅲ. Describe how to verify it

  • Manually test locally (kind cluster).
  • Modify some UT, set different name and generateName to verify pod/pvc using generateName can work well during doReconcile (like cloneset_controller_test:TestReconcile, stateful_set_utils_test.go:newStatefulSet).

Ⅳ. Special notes for reviews

  • TODO: update doc

@kruise-bot kruise-bot requested review from Fei-Guo and shiyan2016 May 31, 2024 15:04
@kruise-bot
Copy link

[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 zmberg for approval by writing /assign @zmberg 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.

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

@kruise-bot
Copy link

Welcome @Radeity! It looks like this is your first PR to openkruise/kruise 🎉

@kruise-bot kruise-bot added the size/M size/M: 30-99 label May 31, 2024
Copy link

codecov bot commented May 31, 2024

Codecov Report

Attention: Patch coverage is 66.66667% with 2 lines in your changes missing coverage. Please review.

Project coverage is 48.99%. Comparing base (0d0031a) to head (e43f479).
Report is 115 commits behind head on master.

Files with missing lines Patch % Lines
pkg/controller/cloneset/core/cloneset_core.go 0.00% 1 Missing ⚠️
pkg/controller/cloneset/utils/cloneset_utils.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1635      +/-   ##
==========================================
+ Coverage   47.91%   48.99%   +1.08%     
==========================================
  Files         162      180      +18     
  Lines       23491    18803    -4688     
==========================================
- Hits        11256     9213    -2043     
+ Misses      11014     8378    -2636     
+ Partials     1221     1212       -9     
Flag Coverage Δ
unittests 48.99% <66.66%> (+1.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Radeity Radeity marked this pull request as draft May 31, 2024 15:50
@Radeity Radeity marked this pull request as ready for review June 1, 2024 09:03
@kruise-bot kruise-bot requested review from hellolijj and veophi June 1, 2024 09:03
@@ -95,7 +95,7 @@ func (c *commonControl) newVersionedPods(cs *appsv1alpha1.CloneSet, revision str
}
clonesetutils.WriteRevisionHash(pod, revision)

pod.Name = fmt.Sprintf("%s-%s", cs.Name, id)
pod.Name = fmt.Sprintf("%s-%s", cs.GenerateName, id)
Copy link
Member

@zmberg zmberg Jul 31, 2024

Choose a reason for hiding this comment

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

Consider the case where the generateName filed for the inventory cluster is empty.

@@ -95,7 +95,7 @@ func (c *commonControl) newVersionedPods(cs *appsv1alpha1.CloneSet, revision str
}
clonesetutils.WriteRevisionHash(pod, revision)

pod.Name = fmt.Sprintf("%s-%s", cs.Name, id)
pod.Name = fmt.Sprintf("%s-%s", cs.GenerateName, id)
Copy link
Member

Choose a reason for hiding this comment

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

shall we leave pod name empty and let the apiserver assign unique names using generateName?

@zmberg
Copy link
Member

zmberg commented Jul 31, 2024

/hold

Copy link

stale bot commented Oct 30, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Oct 30, 2024
@stale stale bot closed this Nov 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/hold size/M size/M: 30-99 wontfix This will not be worked on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feature request] Make CloneSet and StatefulSet Support the generateName setting
4 participants