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

Open
wants to merge 1 commit into
base: master
Choose a base branch
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
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 60 commits behind head on master.

Files 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.

Signed-off-by: Aaron Wang <wangweirao16@gmail.com>
@@ -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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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