Skip to content

Commit 513c575

Browse files
committed
Add json string property to hash_balance
1 parent 183e008 commit 513c575

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

src/code.cloudfoundry.org/gorouter/mbus/subscriber.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ type RegistryMessage struct {
4343
type RegistryMessageOpts struct {
4444
LoadBalancingAlgorithm string `json:"loadbalancing"`
4545
HashHeaderName string `json:"hash_header"`
46-
HashBalance float64 `json:"hash_balance"`
46+
HashBalance float64 `json:"hash_balance,string"`
4747
}
4848

4949
func (rm *RegistryMessage) makeEndpoint(http2Enabled bool) (*route.Endpoint, error) {

src/code.cloudfoundry.org/gorouter/route/pool.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,7 @@ func (e *Endpoint) MarshalJSON() ([]byte, error) {
688688
ServerCertDomainSAN string `json:"server_cert_domain_san,omitempty"`
689689
LoadBalancingAlgorithm string `json:"load_balancing_algorithm,omitempty"`
690690
HashHeader string `json:"hash_header,omitempty"`
691-
HashBalance float64 `json:"hash_balance,omitempty"`
691+
HashBalance float64 `json:"hash_balance,omitempty,string"`
692692
}
693693

694694
jsonObj.Address = e.addr

src/code.cloudfoundry.org/gorouter/route/pool_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,7 @@ var _ = Describe("EndpointPool", func() {
967967
json, err := pool.MarshalJSON()
968968
Expect(err).ToNot(HaveOccurred())
969969

970-
Expect(string(json)).To(Equal(`[{"address":"1.2.3.4:5678","availability_zone":"az-meow","protocol":"http1","tls":false,"ttl":-1,"route_service_url":"https://my-rs.com","tags":null},{"address":"5.6.7.8:5678","availability_zone":"","protocol":"http2","tls":true,"ttl":-1,"tags":null,"private_instance_id":"pvt_test_instance_id","server_cert_domain_san":"pvt_test_san","load_balancing_algorithm":"hash","hash_header":"X-Header","hash_balance":1.25}]`))
970+
Expect(string(json)).To(Equal(`[{"address":"1.2.3.4:5678","availability_zone":"az-meow","protocol":"http1","tls":false,"ttl":-1,"route_service_url":"https://my-rs.com","tags":null},{"address":"5.6.7.8:5678","availability_zone":"","protocol":"http2","tls":true,"ttl":-1,"tags":null,"private_instance_id":"pvt_test_instance_id","server_cert_domain_san":"pvt_test_san","load_balancing_algorithm":"hash","hash_header":"X-Header","hash_balance":"1.25"}]`))
971971
})
972972

973973
Context("when endpoints do not have empty tags", func() {

src/code.cloudfoundry.org/route-registrar/config/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ type RouteSchema struct {
7676
type Options struct {
7777
LoadBalancingAlgorithm LoadBalancingAlgorithm `json:"loadbalancing,omitempty" yaml:"loadbalancing,omitempty"`
7878
HashHeader string `json:"hash_header,omitempty" yaml:"hash_header,omitempty"`
79-
HashBalance float64 `json:"hash_balance,omitempty" yaml:"hash_balance,omitempty"`
79+
HashBalance float64 `json:"hash_balance,omitempty,string" yaml:"hash_balance,omitempty"`
8080
}
8181

8282
type LoadBalancingAlgorithm string

0 commit comments

Comments
 (0)