Skip to content

Commit

Permalink
Retain node info on SDS stream when omitted from subsequent requests (s…
Browse files Browse the repository at this point in the history
…piffe#4611)

* Bump the aws-sdk group with 2 updates (spiffe#4610)

Bumps the aws-sdk group with 2 updates: [github.com/aws/aws-sdk-go-v2/service/ec2](https://github.com/aws/aws-sdk-go-v2) and [github.com/aws/aws-sdk-go-v2/service/iam](https://github.com/aws/aws-sdk-go-v2).

Updates `github.com/aws/aws-sdk-go-v2/service/ec2` from 1.126.0 to 1.127.0
- [Release notes](https://github.com/aws/aws-sdk-go-v2/releases)
- [Commits](aws/aws-sdk-go-v2@service/ec2/v1.126.0...service/ec2/v1.127.0)

Updates `github.com/aws/aws-sdk-go-v2/service/iam` from 1.22.0 to 1.24.0
- [Release notes](https://github.com/aws/aws-sdk-go-v2/releases)
- [Changelog](https://github.com/aws/aws-sdk-go-v2/blob/service/s3/v1.24.0/CHANGELOG.md)
- [Commits](aws/aws-sdk-go-v2@service/s3/v1.22.0...service/s3/v1.24.0)

---
updated-dependencies:
- dependency-name: github.com/aws/aws-sdk-go-v2/service/ec2
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: aws-sdk
- dependency-name: github.com/aws/aws-sdk-go-v2/service/iam
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: aws-sdk
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: grameshtwilio <[email protected]>

* patching sds handler to remember node info

Signed-off-by: grameshtwilio <[email protected]>

* Update pkg/agent/endpoints/sdsv3/handler.go

Co-authored-by: Andrew Harding <[email protected]>
Signed-off-by: grameshtwilio <[email protected]>

---------

Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: grameshtwilio <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Andrew Harding <[email protected]>
  • Loading branch information
3 people authored Oct 26, 2023
1 parent f302325 commit 00f2825
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/agent/endpoints/sdsv3/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ func (h *Handler) StreamSecrets(stream secret_v3.SecretDiscoveryService_StreamSe
var versionCounter int64
var versionInfo = strconv.FormatInt(versionCounter, 10)
var lastNonce string
var lastNode *core_v3.Node
var upd *cache.WorkloadUpdate
var lastReq *discovery_v3.DiscoveryRequest
for {
Expand Down Expand Up @@ -142,6 +143,10 @@ func (h *Handler) StreamSecrets(stream secret_v3.SecretDiscoveryService_StreamSe
telemetry.Expect: versionInfo,
}).Error("Client rejected expected version and rolled back")
}
// If the current request does not contain node information, use the information from a previous request (if any)
if newReq.Node == nil {
newReq.Node = lastNode
}
}

// We need to send updates if the requested resource list has changed
Expand Down Expand Up @@ -190,6 +195,11 @@ func (h *Handler) StreamSecrets(stream secret_v3.SecretDiscoveryService_StreamSe

// remember the last nonce
lastNonce = resp.Nonce

// Remember Node info if it exists
if lastReq.Node != nil {
lastNode = lastReq.Node
}
}
}

Expand Down

0 comments on commit 00f2825

Please sign in to comment.