make MirrorWeight's type int, not float64

This commit is contained in:
mathetake
2020-03-10 15:47:46 +09:00
parent 3425d6e965
commit 7380dbb8ab
5 changed files with 7 additions and 7 deletions
@@ -325,7 +325,7 @@ spec:
# enable traffic shadowing
mirror: true
# weight of the traffic mirrored to your canary (defaults to 100%)
mirrorWeight: 100.0
mirrorWeight: 100
metrics:
- name: request-success-rate
thresholdRange:
+1 -1
View File
@@ -278,7 +278,7 @@ Istio example:
# Traffic shadowing (compatible with Istio only)
mirror: true
# Weight of the traffic mirrored to your canary (defaults to 100%)
mirrorWeight: 100.0
mirrorWeight: 100
```
Mirroring rollout steps for service mesh:
+2 -2
View File
@@ -179,9 +179,9 @@ type CanaryAnalysis struct {
// +optional
Mirror bool `json:"mirror,omitempty"`
// Percentage of the traffic to be mirrored in the range of [0.0, 100.0].
// Percentage of the traffic to be mirrored in the range of [0, 100].
// +optional
MirrorWeight float64 `json:"mirrorWeight,omitempty"`
MirrorWeight int `json:"mirrorWeight,omitempty"`
// Max traffic percentage routed to canary
// +optional
+1 -1
View File
@@ -306,7 +306,7 @@ func (ir *IstioRouter) SetRoutes(
}
if mw := canary.GetAnalysis().MirrorWeight; mw > 0 {
vsCopy.Spec.Http[0].MirrorPercentage = &istiov1alpha3.Percent{Value: mw}
vsCopy.Spec.Http[0].MirrorPercentage = &istiov1alpha3.Percent{Value: float64(mw)}
}
}
+2 -2
View File
@@ -123,7 +123,7 @@ func TestIstioRouter_SetRoutes(t *testing.T) {
})
t.Run("mirror", func(t *testing.T) {
for _, w := range []float64{0, 10, 50} {
for _, w := range []int{0, 10, 50} {
p, c := 100, 0
// set mirror weight
@@ -157,7 +157,7 @@ func TestIstioRouter_SetRoutes(t *testing.T) {
}
if w > 0 && assert.NotNil(t, mirrorWeight) {
assert.Equal(t, w, mirrorWeight.Value)
assert.Equal(t, w, int(mirrorWeight.Value))
} else {
assert.Nil(t, mirrorWeight)
}