Add header manipulation rules to Canary CRD

This commit is contained in:
stefanprodan
2019-03-06 12:41:53 +02:00
parent 7f0cd27591
commit 7d0df82861
5 changed files with 61 additions and 42 deletions
+8 -8
View File
@@ -109,14 +109,14 @@ 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"`
Match []istiov1alpha3.HTTPMatchRequest `json:"match,omitempty"`
Rewrite *istiov1alpha3.HTTPRewrite `json:"rewrite,omitempty"`
Timeout string `json:"timeout,omitempty"`
Retries *istiov1alpha3.HTTPRetry `json:"retries,omitempty"`
AppendHeaders map[string]string `json:"appendHeaders,omitempty"`
Port int32 `json:"port"`
Gateways []string `json:"gateways"`
Hosts []string `json:"hosts"`
Match []istiov1alpha3.HTTPMatchRequest `json:"match,omitempty"`
Rewrite *istiov1alpha3.HTTPRewrite `json:"rewrite,omitempty"`
Timeout string `json:"timeout,omitempty"`
Retries *istiov1alpha3.HTTPRetry `json:"retries,omitempty"`
Headers *istiov1alpha3.Headers `json:"headers,omitempty"`
}
// CanaryAnalysis is used to describe how the analysis should be done
@@ -161,12 +161,10 @@ func (in *CanaryService) DeepCopyInto(out *CanaryService) {
*out = new(istiov1alpha3.HTTPRetry)
**out = **in
}
if in.AppendHeaders != nil {
in, out := &in.AppendHeaders, &out.AppendHeaders
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
if in.Headers != nil {
in, out := &in.Headers, &out.Headers
*out = new(istiov1alpha3.Headers)
(*in).DeepCopyInto(*out)
}
return
}
+2 -2
View File
@@ -345,11 +345,11 @@ type HTTPRoute struct {
type Headers struct {
// Header manipulation rules to apply before forwarding a request
// to the destination service
Request HeaderOperations `json:"request,omitempty"`
Request *HeaderOperations `json:"request,omitempty"`
// Header manipulation rules to apply before returning a response
// to the caller
Response HeaderOperations `json:"response,omitempty"`
Response *HeaderOperations `json:"response,omitempty"`
}
// HeaderOperations Describes the header manipulations to apply
@@ -339,8 +339,16 @@ func (in *HeaderOperations) DeepCopy() *HeaderOperations {
// 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
in.Request.DeepCopyInto(&out.Request)
in.Response.DeepCopyInto(&out.Response)
if in.Request != nil {
in, out := &in.Request, &out.Request
*out = new(HeaderOperations)
(*in).DeepCopyInto(*out)
}
if in.Response != nil {
in, out := &in.Response, &out.Response
*out = new(HeaderOperations)
(*in).DeepCopyInto(*out)
}
return
}