From b3e7fb3417c818fcd6b4d0087ceacfa9fcbfe915 Mon Sep 17 00:00:00 2001 From: stefanprodan Date: Mon, 25 Feb 2019 00:06:14 +0200 Subject: [PATCH] Add HTTP match and rewrite to Canary service spec --- pkg/apis/flagger/v1alpha3/types.go | 9 ++++++--- pkg/apis/flagger/v1alpha3/zz_generated.deepcopy.go | 13 +++++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/pkg/apis/flagger/v1alpha3/types.go b/pkg/apis/flagger/v1alpha3/types.go index 8c0bdd51..628c5dda 100755 --- a/pkg/apis/flagger/v1alpha3/types.go +++ b/pkg/apis/flagger/v1alpha3/types.go @@ -17,6 +17,7 @@ limitations under the License. package v1alpha3 import ( + istiov1alpha3 "github.com/knative/pkg/apis/istio/v1alpha3" hpav1 "k8s.io/api/autoscaling/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "time" @@ -107,9 +108,11 @@ type CanaryStatus struct { // CanaryService is used to create ClusterIP services // and Istio Virtual Service type CanaryService struct { - Port int32 `json:"port"` - Gateways []string `json:"gateways"` - Hosts []string `json:"hosts"` + Port int32 `json:"port"` + Gateways []string `json:"gateways"` + Hosts []string `json:"hosts"` + Match []istiov1alpha3.HTTPMatchRequest `json:"match,omitempty"` + Rewrite *istiov1alpha3.HTTPRewrite `json:"rewrite,omitempty"` } // CanaryAnalysis is used to describe how the analysis should be done diff --git a/pkg/apis/flagger/v1alpha3/zz_generated.deepcopy.go b/pkg/apis/flagger/v1alpha3/zz_generated.deepcopy.go index 5406fb98..23ff1c58 100644 --- a/pkg/apis/flagger/v1alpha3/zz_generated.deepcopy.go +++ b/pkg/apis/flagger/v1alpha3/zz_generated.deepcopy.go @@ -21,6 +21,7 @@ limitations under the License. package v1alpha3 import ( + istiov1alpha3 "github.com/knative/pkg/apis/istio/v1alpha3" v1 "k8s.io/api/autoscaling/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) @@ -143,6 +144,18 @@ func (in *CanaryService) DeepCopyInto(out *CanaryService) { *out = make([]string, len(*in)) copy(*out, *in) } + if in.Match != nil { + in, out := &in.Match, &out.Match + *out = make([]istiov1alpha3.HTTPMatchRequest, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Rewrite != nil { + in, out := &in.Rewrite, &out.Rewrite + *out = new(istiov1alpha3.HTTPRewrite) + **out = **in + } return }