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

Load balance support #65

Merged
merged 13 commits into from
Aug 26, 2024

Conversation

linglingye001
Copy link
Contributor

Support load balance when replicaDiscoveryEnabled
Add load balance and failover request tracing

Expect(allSettings.ConfigMapSettings["app:test:"]).Should(Equal("value6"))
})

It("Succeed to get settings when load balance not enabled", func() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the test necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, test only single client used (line 1311) when load balance not enabled.

Comment on lines 53 to 71
if provider.Spec.ReplicaDiscoveryEnabled {
if manager, ok := clientManager.(*ConfigurationClientManager); ok {
replicaCount := 0
if manager.DynamicClientWrappers != nil {
replicaCount = len(manager.DynamicClientWrappers)
}

output = append(output, fmt.Sprintf("ReplicaCount=%d", replicaCount))

if manager.IsFailoverRequest {
output = append(output, "FailoverRequest")
}
}
}

if provider.Spec.LoadBalancingEnabled {
output = append(output, "UsesLoadBalancing")
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Please align the format with .net provider

if err != nil {
successful = false
updateClientBackoffStatus(clientWrapper, successful)
if IsFailoverable(err) {
klog.Warningf("current client of '%s' failed to get settings: %s", clientWrapper.Endpoint, err.Error())
errors = append(errors, err)
if ok {
Copy link
Contributor

@RichardChen820 RichardChen820 Aug 23, 2024

Choose a reason for hiding this comment

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

ok here just means it can find the RequestTracingEnabled in env var. I don't get the point here.

@@ -37,6 +37,8 @@ import (

type ConfigurationClientManager struct {
ReplicaDiscoveryEnabled bool
LoadBalancingEnabled bool
IsFailoverRequest bool
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think it's required to be a property in ConfigurationClientManager, we don't need to remember the state of IsFailoverRequest

@linglingye001 linglingye001 merged commit 807bf33 into release/v2/stable Aug 26, 2024
3 checks passed
@linglingye001 linglingye001 deleted the user/linglingye/loadBalanceSupport branch August 26, 2024 05:39
linglingye001 added a commit that referenced this pull request Nov 8, 2024
* load balance support

* update load balance tracing

* upgrade golangci version

* update

* skip cache for golangci lint

* update

* update

* update envtest version

* update envtest tool version

* add cancel context

* resolve comments

* fix lint error

* no need to update isFailoverRequest when succeed to get settings
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.

2 participants