diff --git a/docs/proposals/20230825-use-message-bus-instead-of-REST-to-communicate-with-EdgeX.md b/docs/proposals/20230825-use-message-bus-instead-of-REST-to-communicate-with-EdgeX.md index 5c7a127e161..461e5371f40 100644 --- a/docs/proposals/20230825-use-message-bus-instead-of-REST-to-communicate-with-EdgeX.md +++ b/docs/proposals/20230825-use-message-bus-instead-of-REST-to-communicate-with-EdgeX.md @@ -15,20 +15,20 @@ status: provisional ## Table of Contents -* [User message-bus instead of REST to communicate with EdgeX](# use-message-bus-instead-of-rest-to-communicate-with-edgex) - * [Table of Contents](#table-of-contents) - * [Summary](#summary) - * [Motivation](#motivation) - * [Goals](#goals) - * [Non-Goals/Future Work](#non-goalsfuture-work) - * [Proposal](#proposal) - * [Backgrounds](#backgrounds) - * [Experiments](#experiments) - * [EdgeX Side](#edgex-side) - * [Device Side](#device-side) - * [Partial Realization](#partial-realization) - * [User Stories](#user-stories) - * [Implementation History](#implementation-history) +- [User message-bus instead of REST to communicate with EdgeX](# use-message-bus-instead-of-rest-to-communicate-with-edgex) + - [Table of Contents](#table-of-contents) + - [Summary](#summary) + - [Motivation](#motivation) + - [Goals](#goals) + - [Non-Goals/Future Work](#non-goalsfuture-work) + - [Proposal](#proposal) + - [Backgrounds](#backgrounds) + - [Experiments](#experiments) + - [EdgeX Side](#edgex-side) + - [Device Side](#device-side) + - [Partial Realization](#partial-realization) + - [User Stories](#user-stories) + - [Implementation History](#implementation-history) ## Summary @@ -165,7 +165,7 @@ func PatchDevice(dto dtos.UpdateDevice, ctx context.Context, dic *di.Container) // 更新device err = dbClient.UpdateDevice(device) ... - + // 如果修改了deviceService if oldServiceName != "" { go publishSystemEvent(common.DeviceSystemEventType, common.SystemEventActionUpdate, oldServiceName, deviceDTO, ctx, dic) @@ -451,4 +451,4 @@ As an end user, I want to support more devices. ## Implementation History - [x] 08/23/2023: Draft proposal created -- [ ] \ No newline at end of file +- [ ] \ No newline at end of file diff --git a/pkg/apis/apps/well_known_labels_annotations.go b/pkg/apis/apps/well_known_labels_annotations.go index 619babbca07..ecf4abde208 100644 --- a/pkg/apis/apps/well_known_labels_annotations.go +++ b/pkg/apis/apps/well_known_labels_annotations.go @@ -38,6 +38,7 @@ const ( const ( AnnotationPrevAttrs = "nodepool.openyurt.io/previous-attributes" NodePoolLabel = "apps.openyurt.io/nodepool" + DesiredNodePoolLabel = "apps.openyurt.io/desired-nodepool" NodePoolTypeLabel = "nodepool.openyurt.io/type" NodePoolHostNetworkLabel = "nodepool.openyurt.io/hostnetwork" NodePoolChangedEvent = "NodePoolChanged" diff --git a/pkg/yurtmanager/webhook/node/v1/node_default.go b/pkg/yurtmanager/webhook/node/v1/node_default.go index 946e09736e1..52bbf692e3a 100644 --- a/pkg/yurtmanager/webhook/node/v1/node_default.go +++ b/pkg/yurtmanager/webhook/node/v1/node_default.go @@ -38,9 +38,14 @@ func (webhook *NodeHandler) Default(ctx context.Context, obj runtime.Object, req return apierrors.NewBadRequest(fmt.Sprintf("expected a Node but got a %T", obj)) } - npName, ok := node.Labels[apps.NodePoolLabel] - if !ok || len(npName) == 0 { - return nil + npName := node.Labels[apps.NodePoolLabel] + if len(npName) == 0 { + npName = node.Labels[apps.DesiredNodePoolLabel] + if len(npName) != 0 { + node.Labels[apps.NodePoolLabel] = npName + } else { + return nil + } } var np appsv1beta1.NodePool