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

Add service canary #392

Merged
merged 8 commits into from
Dec 6, 2021
Merged

Add service canary #392

merged 8 commits into from
Dec 6, 2021

Conversation

xxx7xxxx
Copy link
Contributor

@xxx7xxxx xxx7xxxx commented Dec 1, 2021

(Will make actions correct after megaease/easemesh-api#16 merged)

  • Support multiple canaries (deprecate the first version)
  • Change label separator & to more idiomatic ,.

pkg/object/meshcontroller/spec/selector.go Outdated Show resolved Hide resolved
pkg/object/meshcontroller/spec/selector.go Outdated Show resolved Hide resolved
pkg/object/meshcontroller/spec/spec.go Outdated Show resolved Hide resolved
pkg/object/meshcontroller/worker/worker.go Show resolved Hide resolved
@xxx7xxxx
Copy link
Contributor Author

xxx7xxxx commented Dec 2, 2021

Updated as comment @samutamm

logger.Warnf("dead instances: %s", serviceInstances(deadInstances))
}
if len(rebornInstances) > 0 {
logger.Warnf("reborn instances: %s", serviceInstances(rebornInstances))
Copy link
Collaborator

Choose a reason for hiding this comment

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

should this log message be a info ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure

Comment on lines 966 to 967
// GetServiceCanaryWithInfo gets the service canary with raw info.
func (s *Service) GetServiceCanaryWithInfo(serviceCanaryName string) (*spec.ServiceCanary, *mvccpb.KeyValue) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

this function is only called in GetServiceCanary and WithInfo is not good name, I propose to remove this function and only keep GetServiceCanary

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

Comment on lines +187 to +189
// Priority must be [1, 9], the default is 5 if user does not set it.
// The smaller number get higher priority.
// The order is sorted by name alphabetically in the same priority.
Copy link
Collaborator

Choose a reason for hiding this comment

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

why limit priority to [1, 9], is the range large enough?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Enough for our scenarios. We leverage the OS scheduling system plus explicit two-layer sorting. Infinite priority with integer causes a bad user experience.

return nil
}

// Clone clonse TrafficRules.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
// Clone clonse TrafficRules.
// Clone clones TrafficRules.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Corrected

break
}

headerMatchNum := 0
Copy link
Collaborator

Choose a reason for hiding this comment

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

the change in this function impact performance.
Now, when MatchAllHeaders is false, the code will continue to match other headers when one header is matched.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated with a pre-checking.

@codecov-commenter
Copy link

codecov-commenter commented Dec 2, 2021

Codecov Report

Merging #392 (f00075e) into main (262061a) will decrease coverage by 0.44%.
The diff coverage is 88.95%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #392      +/-   ##
==========================================
- Coverage   80.82%   80.37%   -0.45%     
==========================================
  Files          60       62       +2     
  Lines        6966     7107     +141     
==========================================
+ Hits         5630     5712      +82     
- Misses       1045     1100      +55     
- Partials      291      295       +4     
Impacted Files Coverage Δ
pkg/util/urlrule/urlrule.go 88.73% <11.11%> (-11.27%) ⬇️
pkg/object/meshcontroller/spec/spec.go 87.12% <92.85%> (+0.16%) ⬆️
pkg/util/httpfilter/httpfilter.go 44.70% <94.11%> (ø)
pkg/object/meshcontroller/spec/selector.go 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 262061a...f00075e. Read the comment docs.

@xxx7xxxx
Copy link
Contributor Author

xxx7xxxx commented Dec 3, 2021

I resolved all conflicts, please review @suchen-sci @samutamm @zhao-kun

Comment on lines 238 to 240
select {
case egs.chReloadEvent <- struct{}{}:
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
select {
case egs.chReloadEvent <- struct{}{}:
}
egs.chReloadEvent <- struct{}{}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No need to change, We keep the pattern consistent

Copy link
Contributor

@suchen-sci suchen-sci Dec 3, 2021

Choose a reason for hiding this comment

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

Got it. My static checker just report this. FYI, https://staticcheck.io/docs/checks#S1000
message: "should use a simple channel send/receive instead of select with a single case (S1000) go-staticcheck".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated with correct select statement

@xxx7xxxx xxx7xxxx merged commit 451faf5 into easegress-io:main Dec 6, 2021
@xxx7xxxx xxx7xxxx deleted the servicecanary branch December 14, 2021 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants