From 3ad79934f91eec90958a9094d6b59bc55a9fdf63 Mon Sep 17 00:00:00 2001 From: Scott Andrews Date: Wed, 30 May 2018 22:34:16 -0400 Subject: [PATCH] Add Istio RouteRule HTTPRewrite Istio RouteRules are capable of rewriting HTTP traffic. Adding the HTTPRewrite struct to the RouteRule type. Refs https://istio.io/docs/reference/config/istio.routing.v1alpha1.html#HTTPRewrite --- pkg/apis/istio/v1alpha2/routerule_types.go | 6 ++++++ .../istio/v1alpha2/zz_generated.deepcopy.go | 17 +++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/pkg/apis/istio/v1alpha2/routerule_types.go b/pkg/apis/istio/v1alpha2/routerule_types.go index 2a9f339c993a..c762f13c9e20 100644 --- a/pkg/apis/istio/v1alpha2/routerule_types.go +++ b/pkg/apis/istio/v1alpha2/routerule_types.go @@ -83,10 +83,16 @@ type MatchString struct { Prefix string `json:"prefix,omitempty"` } +type HTTPRewrite struct { + URI string `json:"uri"` + Authority string `json:"authority"` +} + type RouteRuleSpec struct { Destination IstioService `json:"destination"` Match Match `json:"match,omitempty"` Route []DestinationWeight `json:"route"` + Rewrite HTTPRewrite `json:"rewrite"` AppendHeaders map[string]string `json:"appendHeaders"` } diff --git a/pkg/apis/istio/v1alpha2/zz_generated.deepcopy.go b/pkg/apis/istio/v1alpha2/zz_generated.deepcopy.go index ca2779b6f139..6d892e4df687 100644 --- a/pkg/apis/istio/v1alpha2/zz_generated.deepcopy.go +++ b/pkg/apis/istio/v1alpha2/zz_generated.deepcopy.go @@ -41,6 +41,22 @@ func (in *DestinationWeight) DeepCopy() *DestinationWeight { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HTTPRewrite) DeepCopyInto(out *HTTPRewrite) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPRewrite. +func (in *HTTPRewrite) DeepCopy() *HTTPRewrite { + if in == nil { + return nil + } + out := new(HTTPRewrite) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Headers) DeepCopyInto(out *Headers) { *out = *in @@ -196,6 +212,7 @@ func (in *RouteRuleSpec) DeepCopyInto(out *RouteRuleSpec) { *out = make([]DestinationWeight, len(*in)) copy(*out, *in) } + out.Rewrite = in.Rewrite if in.AppendHeaders != nil { in, out := &in.AppendHeaders, &out.AppendHeaders *out = make(map[string]string, len(*in))