Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Also provision empty route rules for revisions that are not yet Active #785

Merged
merged 5 commits into from
May 8, 2018

Conversation

tcnghia
Copy link
Contributor

@tcnghia tcnghia commented Apr 30, 2018

This appears to make Istio happy, that if we switch traffic to them
later we won't cause Istio to throw spurious 503s. See
istio/istio#5204.

Fixes #348

Proposed Changes

  • Also provision empty route rules for revisions that are not yet Active.

@tcnghia tcnghia requested a review from mdemirhan April 30, 2018 19:24
@google-prow-robot google-prow-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Apr 30, 2018
@tcnghia
Copy link
Contributor Author

tcnghia commented Apr 30, 2018

/retest

4 similar comments
@tcnghia
Copy link
Contributor Author

tcnghia commented Apr 30, 2018

/retest

@tcnghia
Copy link
Contributor Author

tcnghia commented Apr 30, 2018

/retest

@tcnghia
Copy link
Contributor Author

tcnghia commented Apr 30, 2018

/retest

@tcnghia
Copy link
Contributor Author

tcnghia commented Apr 30, 2018

/retest

@google-prow-robot google-prow-robot removed the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 1, 2018
@@ -95,12 +96,12 @@ func isRouteReady() func(r *v1alpha1.Route) (bool, error) {

func allRouteTrafficAtRevision(routeName string, revisionName string) func(r *v1alpha1.Route) (bool, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

sorry @tcnghia I refactored this, the file you'll need to move this change over to is https://github.com/elafros/elafros/blob/master/test/states.go

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks for pointing that out. updated.

@mdemirhan
Copy link
Contributor

/lgtm
/approve

@google-prow-robot google-prow-robot added the lgtm Indicates that a PR is ready to be merged. label May 1, 2018
@adrcunha
Copy link
Contributor

adrcunha commented May 1, 2018

/lgtm
/approve

@google-prow-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: adrcunha, mdemirhan, tcnghia

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-prow-robot google-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 1, 2018
@tcnghia
Copy link
Contributor Author

tcnghia commented May 2, 2018

/retest

@google-prow-robot google-prow-robot removed the lgtm Indicates that a PR is ready to be merged. label May 2, 2018
@adrcunha
Copy link
Contributor

adrcunha commented May 2, 2018

/lgtm

@google-prow-robot google-prow-robot added the lgtm Indicates that a PR is ready to be merged. label May 2, 2018
@evankanderson evankanderson assigned grantr and mattmoor and unassigned mdemirhan and adrcunha May 2, 2018
@evankanderson
Copy link
Member

/hold

Waiting on CODEOWNERS review; the hold is to keep this from blocking the Tide merge queue.

@google-prow-robot google-prow-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 4, 2018
var err error
configName := tt.ConfigurationName
revName := tt.RevisionName
if tt.ConfigurationName != "" {
Copy link
Member

Choose a reason for hiding this comment

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

configName

if revName == "" {
glog.Errorf("Configuration %s is not ready. Should skip updating route rules",
tt.ConfigurationName)
latestReadyRevName := configMap[tt.ConfigurationName].Status.LatestReadyRevisionName
Copy link
Member

Choose a reason for hiding this comment

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

[configName]

} else if _, ok := revMap[rev.Name]; !ok {
// This is a non-target revision. Adding a dummy rule to make Istio happy,
// so that if we switch traffic to them later we won't cause Istio to
// throw spurious 503s. See https://github.com/istio/istio/issues/5204.
Copy link
Member

Choose a reason for hiding this comment

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

I find this loop pretty hard to follow.

Since I believe this is a temporary workaround, I think it would be better to have:

  1. Control loop that materializes the semantics we want (route rule per active revision)
  2. Control loop that materializes route rules to work around the istio issue

Above 2. we should have a clear comment outlining the Istio issue (and a link to an issue tracking it's resolution), we should also have an Ela tracking issue, which shouldn't close until the second control loop is ripped out.

Copy link
Member

Choose a reason for hiding this comment

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

Also, I believe this means that the number of routes will monotonically increase and that revisions will remain routable in perpetuity, which certainly shouldn't be the end state. We should be clear about the trade-offs here while we wait on a proper fix from Istio.

Nghia Tran added 2 commits May 8, 2018 08:19
This appears to make Istio happy, and if we switch traffic to them
later we won't cause Istio to throw spurious 503s. See
istio/istio#5204.
@tcnghia tcnghia requested a review from a team May 8, 2018 16:23
@google-prow-robot google-prow-robot removed the lgtm Indicates that a PR is ready to be merged. label May 8, 2018
Copy link
Member

@mattmoor mattmoor left a comment

Choose a reason for hiding this comment

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

couple nits, thanks!

revRoutes := []RevisionRoute{}
for _, tt := range route.Spec.Traffic {
configName := tt.ConfigurationName
if configName != "" {
Copy link
Member

Choose a reason for hiding this comment

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

if configName == "" {
  continue
}

configName := tt.ConfigurationName
if configName != "" {
// Get the configuration's LatestReadyRevisionName
latestReadyRevName := configMap[tt.ConfigurationName].Status.LatestReadyRevisionName
Copy link
Member

Choose a reason for hiding this comment

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

configMap[configName]

@@ -789,7 +831,13 @@ func (c *Controller) createOrUpdateRouteRules(route *v1alpha1.Route, configMap m
glog.Errorf("Failed to check if should direct traffic to activator: %s", err)
return nil, err
}

// TODO: remove this once https://github.com/istio/istio/issues/5204 is fixe.
Copy link
Member

Choose a reason for hiding this comment

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

typo: fixed

glog.Errorf("Failed to get empty routes for %s : %q", route.Name, err)
return nil, err
}
revisionRoutes = append(revisionRoutes, emptyRoutes...)
Copy link
Member

Choose a reason for hiding this comment

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

Thanks, this will be significantly easier to excise later when Istio fixes things!

@tcnghia
Copy link
Contributor Author

tcnghia commented May 8, 2018

/retest

@mattmoor
Copy link
Member

mattmoor commented May 8, 2018

/lgtm
/hold remove

@google-prow-robot google-prow-robot added the lgtm Indicates that a PR is ready to be merged. label May 8, 2018
@tcnghia tcnghia removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 8, 2018
@tcnghia
Copy link
Contributor Author

tcnghia commented May 8, 2018

/retest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. 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.

8 participants