diff --git a/docs/gitbook/tutorials/istio-progressive-delivery.md b/docs/gitbook/tutorials/istio-progressive-delivery.md index 9764c828..39b6df63 100644 --- a/docs/gitbook/tutorials/istio-progressive-delivery.md +++ b/docs/gitbook/tutorials/istio-progressive-delivery.md @@ -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: diff --git a/docs/gitbook/usage/deployment-strategies.md b/docs/gitbook/usage/deployment-strategies.md index bc70aafa..05cc4fd5 100644 --- a/docs/gitbook/usage/deployment-strategies.md +++ b/docs/gitbook/usage/deployment-strategies.md @@ -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: diff --git a/pkg/apis/flagger/v1beta1/canary.go b/pkg/apis/flagger/v1beta1/canary.go index 7e33239b..dd9c891a 100644 --- a/pkg/apis/flagger/v1beta1/canary.go +++ b/pkg/apis/flagger/v1beta1/canary.go @@ -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 diff --git a/pkg/router/istio.go b/pkg/router/istio.go index f38d6b9a..3cdfd220 100644 --- a/pkg/router/istio.go +++ b/pkg/router/istio.go @@ -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)} } } diff --git a/pkg/router/istio_test.go b/pkg/router/istio_test.go index a2ac03a2..0b9c3591 100644 --- a/pkg/router/istio_test.go +++ b/pkg/router/istio_test.go @@ -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) }