-
Notifications
You must be signed in to change notification settings - Fork 147
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
refactor: reuse SchedulingPolicy struct for the scheduling policy definition of InstanceTemplate #7290
refactor: reuse SchedulingPolicy struct for the scheduling policy definition of InstanceTemplate #7290
Conversation
apis/apps/v1alpha1/cluster_types.go
Outdated
// Deprecated since v0.10, replaced by the `schedulingPolicy` field. | ||
// | ||
// +kubebuilder:deprecatedversion:warning="This field has been deprecated since 0.10.0" | ||
// +kubebuilder:pruning:PreserveUnknownFields | ||
// +optional | ||
NodeName *string `json:"nodeName,omitempty"` | ||
|
||
// Defines NodeSelector to override. | ||
// | ||
// Deprecated since v0.10, replaced by the `schedulingPolicy` field. | ||
// | ||
// +kubebuilder:deprecatedversion:warning="This field has been deprecated since 0.10.0" | ||
// +kubebuilder:pruning:PreserveUnknownFields | ||
// +optional | ||
NodeSelector map[string]string `json:"nodeSelector,omitempty"` | ||
|
||
// Tolerations specifies a list of tolerations to be applied to the Pod, allowing it to tolerate node taints. | ||
// This field can be used to add new tolerations or override existing ones. | ||
// | ||
// Deprecated since v0.10, replaced by the `schedulingPolicy` field. | ||
// | ||
// +kubebuilder:deprecatedversion:warning="This field has been deprecated since 0.10.0" | ||
// +kubebuilder:pruning:PreserveUnknownFields | ||
// +optional | ||
Tolerations []corev1.Toleration `json:"tolerations,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should remove them directly as they are introduced in the 0.9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it
Makefile
Outdated
@@ -22,6 +22,8 @@ TEST_TYPE ?= wesql | |||
GIT_COMMIT = $(shell git rev-list -1 HEAD) | |||
GIT_VERSION = $(shell git describe --always --abbrev=0 --tag) | |||
GENERATED_CLIENT_PKG = "pkg/client" | |||
GENERATED_DEEP_COPY_FILE = "zz_generated.deepcopy.go" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggest not to modify the unrelated files of the issue that this PR tries to resolve.
missing the controller part. |
2eef999
to
c156c53
Compare
c156c53
to
fc7860f
Compare
fc7860f
to
5f15feb
Compare
5f15feb
to
acc038a
Compare
acc038a
to
bfd640e
Compare
@@ -586,12 +586,12 @@ func buildInstanceTemplateExt(template workloads.InstanceTemplate, templateExt * | |||
replicas = *template.Replicas | |||
} | |||
templateExt.Replicas = replicas | |||
if template.NodeName != nil { | |||
templateExt.Spec.NodeName = *template.NodeName | |||
if template.SchedulingPolicy.NodeName != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do nil check of SchedulingPolicy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed SchedulingPolicy
should be optional. The pointer type is more appropriate. I will modify it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@free6om PTAL again, THX
462f2e1
to
b5f3908
Compare
b5f3908
to
3c4fe93
Compare
3c4fe93
to
7307c4e
Compare
@@ -651,6 +664,105 @@ func mergeCPUNMemory(s, d *corev1.ResourceList) { | |||
} | |||
} | |||
|
|||
func mergeAffinity(affinity1Ptr, affinity2Ptr **corev1.Affinity) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems we have two mergeAffinity now.
Should be addressed in the future pr.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@weicao 👍 I didn't find a similar method before, I'll see if I can reuse it directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@weicao 👍 I didn't find a similar method before, I'll see if I can reuse it directly.
in pkg/controller/scheduling/scheduling_utils.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The two function implementations are different. The previous implementation is a direct accumulation, and my implementation is merged if the key is the same.
Can a TODO action be added first, and then create a separate PR to merge these two methods? @free6om
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure
7307c4e
to
05ca8f0
Compare
…inition of InstanceTemplate Signed-off-by: starnop <starnop@163.com>
/cherry-pick release-0.9 |
🤖 says: cherry pick action finished successfully 🎉! |
…inition of InstanceTemplate (apecloud#7290) Signed-off-by: starnop <starnop@163.com> (cherry picked from commit d7dd465)
Reuse SchedulingPolicy struct for the scheduling policy definition of InstanceTemplate
Fixed #7291