Skip to content

Commit

Permalink
maintain compatibility with the annotation apps.openyurt.io/desired-n…
Browse files Browse the repository at this point in the history
…odepool for the nodepool (#1744)
  • Loading branch information
rambohe-ch authored Oct 24, 2023
1 parent 9b26e3b commit 0c1c982
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -451,4 +451,4 @@ As an end user, I want to support more devices.
## Implementation History

- [x] 08/23/2023: Draft proposal created
- [ ]
- [ ]
1 change: 1 addition & 0 deletions pkg/apis/apps/well_known_labels_annotations.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
11 changes: 8 additions & 3 deletions pkg/yurtmanager/webhook/node/v1/node_default.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0c1c982

Please sign in to comment.