Skip to content

Conversation

@sushicw
Copy link
Contributor

@sushicw sushicw commented Oct 2, 2019

  1. Each status update controller instance is now responsible for managing a single subfield of the "status" subresource, so it isn't monopolizing the subresource for other use cases.
  2. The validation messages in the status updates are now structured.

Before:

status:|
  Error [IST0101] Referenced gateway not found: "bogus-reviews-gateway-1"
  Error [IST0101] Referenced host not found: "reviews-bogus2"
  Error [IST0101] Referenced host+subset in destinationrule not found: "reviews-bogus2+v1"
  Error [IST0101] Referenced host+subset in destinationrule not found: "reviews+v1-bogus"

After:

status:
  validationMessages:
  - code: IST0101
    level: Error
    message: 'Referenced gateway not found: "bogus-reviews-gateway-1"'
  - code: IST0101
    level: Error
    message: 'Referenced host not found: "reviews-bogus2"'
  - code: IST0101
    level: Error
    message: 'Referenced host+subset in destinationrule not found: "reviews-bogus2+v1"'
  - code: IST0101
    level: Error
    message: 'Referenced host+subset in destinationrule not found: "reviews+v1-bogus"'

Solves #17454

[X] Configuration Infrastructure
[ ] Docs
[ ] Installation
[ ] Networking
[ ] Performance and Scalability
[ ] Policies and Telemetry
[ ] Security
[ ] Test and Release
[ ] User Experience
[ ] Developer Infrastructure

@sushicw sushicw requested a review from a team October 2, 2019 18:16
@googlebot googlebot added the cla: yes Set by the Google CLA bot to indicate the author of a PR has signed the Google CLA. label Oct 2, 2019
@istio-testing istio-testing added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 2, 2019
// Get the map of status objects. If it doesn't already exist, create it.
statusObj, ok := u.Object["status"]
if !ok {
statusObj = make(map[string]interface{})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like you can avoid this allocation in certain cases (e.g. desiredStatus == nil). Which may save from allocating a large number of small objects.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'd only allocate if the status field was entirely blank already, which should normally only trigger when this runs for the first time for a resource. So I don't think it will be expensive.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It means you'd be allocating a map for each resource that has a new message on it. It can add up in a large cluster. It looks like it would be cheap to avoid the allocation by slightly restructuring the code here.

lines.WriteString("\n")
// For the purposes of status update, the origin field is redundant
// since we're attaching the message to the origin resource.
result = append(result, m.Unstructured(false))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you ever need the origin field in Unstructured? Is it for the istioctl JSON output case?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what I had in mind, yes.

I also considered something like m.Unstructured().WithoutOrigin() to avoid the awkward boolean flag, but thought it probably wasn't worth it.

@sushicw
Copy link
Contributor Author

sushicw commented Oct 2, 2019

/test gencheck_istio

@sushicw
Copy link
Contributor Author

sushicw commented Oct 3, 2019

/test racetest_istio

1 similar comment
@sushicw
Copy link
Contributor Author

sushicw commented Oct 3, 2019

/test racetest_istio

@istio-testing istio-testing merged commit 97d593f into istio:master Oct 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes Set by the Google CLA bot to indicate the author of a PR has signed the Google CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants