adding deployment spec overrides via node label selector#5845
Conversation
|
You can add some description in the "What this PR does / why we need it" part. |
|
@WillardHu can you please review if I am going to the right track? |
|
question: 1. How can I update the edgeapplication crd yaml to test these changes? |
Sorry, I've been busy recently, so I'm replying late.
By the way, for deployment generated by |
wbc6080
left a comment
There was a problem hiding this comment.
You can try to run hack/update-codegen.sh to pass the make verify CI test and run hack/generate-crds.sh to generate new crds
Maybe we can discuss more details in community meeting |
Its still generating the same error. I tried to upgrade the controller gen version to latest version and it apparently worked. Should I go ahead with it? |
wbc6080
left a comment
There was a problem hiding this comment.
@EraKin575 Do you mean that after upgrading the controller gen version, hack/generate-crds.sh was executed successfully? Based on this success, you can run hack/update-codegen.sh again, and then execute git status. You should be able to see that some files have been automatically modified. Push these modifications up again, and you should be able to solve the CI error.
|
Hi! I have a question. Can you please tell me about the matching logic for targetnodegroup overriders? How does it find the node group to override the deployment spec? |
wbc6080
left a comment
There was a problem hiding this comment.
Hi! I have a question. Can you please tell me about the matching logic for targetnodegroup overriders? How does it find the node group to override the deployment spec?
Sorry, I didn't understand your question clearly. Are you asking how to build nodes into node groups? Or how to fully populate edge application deployment in different node groups?
If it is the former, we define the NodeGroup CRD to describe a node group. Nodes with specific labels can be add to a node group management through the matchlable field.
If it is the latter, in edge application CRD , the Workload Templates field can define the Deployment Template of the edge application, and WorkloadScopes can be configured differently according to the needs of different node groups, such as configuring an image repository address. Workload Templates and WorkloadScopes can be added together to form a complete deployment for deployment.
You can also read nodegroup's proposal for more information https://github.com/kubeedge/kubeedge/blob/master/docs/proposals/node-group-management.md
|
thanks for the help @WillardHu , but already I knew this part. I am sorry I couldn't explain my problem better. I am struggling to find the logic for finding the correct targetnodegroup that implements the deployments on. Example; where is the code to match the name of targetnodegroup with the actual NodeGroup where it does the deployment? |
|
Hi, @WillardHu can you review this PR ? I have made the required changes and it seems to be working. For now, I have added tests for command overrider and it passed. If you approve the changes, I will add test for every overrider |
| if [ "$(which controller-gen)" == "" ]; then | ||
| echo "Start to install controller-gen tool" | ||
| GO111MODULE=on go install -v sigs.k8s.io/controller-tools/cmd/controller-gen@v0.6.2 | ||
| GO111MODULE=on go install -v sigs.k8s.io/controller-tools/cmd/controller-gen@latest |
There was a problem hiding this comment.
A consistent version is required here, and the latest version will make a difference in comparison checks
| if err := utils.ApplyNodeAffinity(tmplCopy, info.TargetNodeLabelSelector); err != nil { | ||
| klog.Errorf("failed to apply node affinity to obj %s/%s of gvk %s, %v", | ||
| tmplCopy.GetNamespace(), tmplCopy.GetName(), tmplCopy.GroupVersionKind(), err) | ||
| errs = append(errs, err) | ||
| continue | ||
| } |
There was a problem hiding this comment.
This code can be put in the nodeselectoroverrider.go
| klog.Warningf("No nodes found matching labels for obj %s/%s of gvk %s", | ||
| tmplCopy.GetNamespace(), tmplCopy.GetName(), tmplCopy.GroupVersionKind()) | ||
| continue |
There was a problem hiding this comment.
It would be best to write the message to the EdgeApplication Status. And the historical error handling doesn't look good, the Reconcile() function returns an error only make it constant retried.
| affinity["nodeAffinity"].(map[string]interface{})["requiredDuringSchedulingIgnoredDuringExecution"].(map[string]interface{})["nodeSelectorTerms"].([]interface{})[0].(map[string]interface{})["matchExpressions"] = append( | ||
| affinity["nodeAffinity"].(map[string]interface{})["requiredDuringSchedulingIgnoredDuringExecution"].(map[string]interface{})["nodeSelectorTerms"].([]interface{})[0].(map[string]interface{})["matchExpressions"].([]interface{}), | ||
| map[string]interface{}{ | ||
| "key": key, | ||
| "operator": "In", | ||
| "values": []interface{}{value}, | ||
| }, | ||
| ) |
There was a problem hiding this comment.
Here, the processing performance is better with map, but the readability is worse. Is it better to use jsonpath?
|
The nameoverrider.go file is also to be modified |
Refer to nodeselectoroverrider.go, when each node is bound by a node group, the node automatically adds a label |
Should I also restore those crd files which have been modified and not added with 'v1alpha2' device versioning? |
c15ebd0 to
2709b73
Compare
84197e0 to
e4d1de5
Compare
|
@WillardHu please review the PR |
|
Please rebase your commits to one commit. @EraKin575 |
Signed-off-by: EraKin575 <tejaskumar574@gmail.com> wip:adding deployment spec overrides for node label selector Signed-off-by: EraKin575 <tejaskumar574@gmail.com> wip:adding deployment spec overrides for node label selector Signed-off-by: EraKin575 <tejaskumar574@gmail.com> modified overriders Signed-off-by: EraKin575 <tejaskumar574@gmail.com> updated openapischema Signed-off-by: EraKin575 <tejaskumar574@gmail.com> added openapiv3schema Signed-off-by: EraKin575 <tejaskumar574@gmail.com> fixed type for targetnodelabel Signed-off-by: EraKin575 <tejaskumar574@gmail.com> added utility functions Signed-off-by: EraKin575 <tejaskumar574@gmail.com> implemented targetnodelabelselector functionality Signed-off-by: EraKin575 <tejaskumar574@gmail.com> added tests for env overrider Signed-off-by: EraKin575 <tejaskumar574@gmail.com> updated crds Signed-off-by: EraKin575 <tejaskumar574@gmail.com> updated crds Signed-off-by: EraKin575 <tejaskumar574@gmail.com> updated crds Signed-off-by: EraKin575 <tejaskumar574@gmail.com> corrected gci Signed-off-by: EraKin575 <tejaskumar574@gmail.com> correct import order Signed-off-by: EraKin575 <tejaskumar574@gmail.com> correct import order Signed-off-by: EraKin575 <tejaskumar574@gmail.com> correct import order Signed-off-by: EraKin575 <tejaskumar574@gmail.com> correct import order Signed-off-by: EraKin575 <tejaskumar574@gmail.com> correct import order Signed-off-by: EraKin575 <tejaskumar574@gmail.com> added image overrider Signed-off-by: EraKin575 <tejaskumar574@gmail.com> fixed overrider test Signed-off-by: EraKin575 <tejaskumar574@gmail.com> fixed overridermanager import order Signed-off-by: EraKin575 <tejaskumar574@gmail.com> added integration tests Signed-off-by: EraKin575 <tejaskumar574@gmail.com> trying to fix integration test Signed-off-by: EraKin575 <tejaskumar574@gmail.com> trying to fix integration test Signed-off-by: EraKin575 <tejaskumar574@gmail.com> correct import order Signed-off-by: EraKin575 <tejaskumar574@gmail.com> restored changes related to device Signed-off-by: EraKin575 <tejaskumar574@gmail.com> restored changes related to device Signed-off-by: EraKin575 <tejaskumar574@gmail.com> restored changes related to device Signed-off-by: EraKin575 <tejaskumar574@gmail.com> restored changes related to device Signed-off-by: EraKin575 <tejaskumar574@gmail.com> restored changes related to device Signed-off-by: EraKin575 <tejaskumar574@gmail.com> added controller gen version compatible to go1.21 Signed-off-by: EraKin575 <tejaskumar574@gmail.com> moved node affinity to node selector Signed-off-by: EraKin575 <tejaskumar574@gmail.com> moved node affinity to node selector Signed-off-by: EraKin575 <tejaskumar574@gmail.com> changed edgeapplicationcontroller Signed-off-by: EraKin575 <tejaskumar574@gmail.com> changed edgeapplicationcontroller Signed-off-by: EraKin575 <tejaskumar574@gmail.com> changed edgeapplicationcontroller Signed-off-by: EraKin575 <tejaskumar574@gmail.com> moved logic to node selector overrider Signed-off-by: EraKin575 <tejaskumar574@gmail.com> moved logic to node selector overrider Signed-off-by: EraKin575 <tejaskumar574@gmail.com> moved logic to node selector overrider Signed-off-by: EraKin575 <tejaskumar574@gmail.com> modified integration test Signed-off-by: EraKin575 <tejaskumar574@gmail.com> modified integration test Signed-off-by: EraKin575 <tejaskumar574@gmail.com> modified integration test Signed-off-by: EraKin575 <tejaskumar574@gmail.com> modified integration test Signed-off-by: EraKin575 <tejaskumar574@gmail.com> modified integration test Signed-off-by: EraKin575 <tejaskumar574@gmail.com> removed unnecessary comments Signed-off-by: EraKin575 <tejaskumar574@gmail.com> trying to fix integration tests Signed-off-by: EraKin575 <tejaskumar574@gmail.com> trying to fix integration tests Signed-off-by: EraKin575 <tejaskumar574@gmail.com> removed unnecessary function Signed-off-by: EraKin575 <tejaskumar574@gmail.com> added node affinity to node selector Signed-off-by: EraKin575 <tejaskumar574@gmail.com> trying to fix integration test Signed-off-by: EraKin575 <tejaskumar574@gmail.com> trying to fix integration test Signed-off-by: EraKin575 <tejaskumar574@gmail.com> trying to fix integration test Signed-off-by: EraKin575 <tejaskumar574@gmail.com> resolve conflicts Signed-off-by: EraKin575 <tejaskumar574@gmail.com> modified nameoverrider Signed-off-by: EraKin575 <tejaskumar574@gmail.com> modified nameoverrider Signed-off-by: EraKin575 <tejaskumar574@gmail.com> modified nameoverrider Signed-off-by: EraKin575 <tejaskumar574@gmail.com> modified nameoverrider Signed-off-by: EraKin575 <tejaskumar574@gmail.com> modified nameoverrider Signed-off-by: EraKin575 <tejaskumar574@gmail.com> modified nameoverrider Signed-off-by: EraKin575 <tejaskumar574@gmail.com> modified nameoverrider Signed-off-by: EraKin575 <tejaskumar574@gmail.com> modified nameoverrider Signed-off-by: EraKin575 <tejaskumar574@gmail.com> modified nameoverrider Signed-off-by: EraKin575 <tejaskumar574@gmail.com> modified nameoverrider Signed-off-by: EraKin575 <tejaskumar574@gmail.com> modified nameoverrider Signed-off-by: EraKin575 <tejaskumar574@gmail.com> modified nameoverrider Signed-off-by: EraKin575 <tejaskumar574@gmail.com> modified nameoverrider Signed-off-by: EraKin575 <tejaskumar574@gmail.com> modified nameoverrider Signed-off-by: EraKin575 <tejaskumar574@gmail.com> modified nameoverrider Signed-off-by: EraKin575 <tejaskumar574@gmail.com> modified nameoverrider Signed-off-by: EraKin575 <tejaskumar574@gmail.com> modified nameoverrider Signed-off-by: EraKin575 <tejaskumar574@gmail.com> modified nameoverrider Signed-off-by: EraKin575 <tejaskumar574@gmail.com> modified nameoverrider Signed-off-by: EraKin575 <tejaskumar574@gmail.com> added watcher Signed-off-by: EraKin575 <tejaskumar574@gmail.com>
Signed-off-by: EraKin575 <tejaskumar574@gmail.com>
Signed-off-by: EraKin575 <tejaskumar574@gmail.com>
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: fisherxu The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |

What type of PR is this?
Adding deployment spec overrides via node label selector to have granular node characteristics.
/kind feature
What this PR does / why we need it:
Which issue(s) this PR fixes:
A part of #5755
Special notes for your reviewer:
Does this PR introduce a user-facing change?: