Support mirroring request body
Co-authored-by: Mathieu Lonjaret <mathieu.lonjaret@gmail.com> Co-authored-by: Julien Salleyron <julien.salleyron@gmail.com>
This commit is contained in:
parent
09c07f45ee
commit
cf7f0f878a
20 changed files with 454 additions and 44 deletions
|
@ -240,8 +240,9 @@ func (c configBuilder) buildMirroring(ctx context.Context, tService *v1alpha1.Tr
|
|||
|
||||
conf[id] = &dynamic.Service{
|
||||
Mirroring: &dynamic.Mirroring{
|
||||
Service: fullNameMain,
|
||||
Mirrors: mirrorServices,
|
||||
Service: fullNameMain,
|
||||
Mirrors: mirrorServices,
|
||||
MaxBodySize: tService.Spec.Mirroring.MaxBodySize,
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,8 @@ type ServiceSpec struct {
|
|||
// load-balancer, and a list of mirrors.
|
||||
type Mirroring struct {
|
||||
LoadBalancerSpec
|
||||
Mirrors []MirrorService `json:"mirrors,omitempty"`
|
||||
MaxBodySize *int64
|
||||
Mirrors []MirrorService `json:"mirrors,omitempty"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen=true
|
||||
|
|
|
@ -749,6 +749,11 @@ func (in *MirrorService) DeepCopy() *MirrorService {
|
|||
func (in *Mirroring) DeepCopyInto(out *Mirroring) {
|
||||
*out = *in
|
||||
in.LoadBalancerSpec.DeepCopyInto(&out.LoadBalancerSpec)
|
||||
if in.MaxBodySize != nil {
|
||||
in, out := &in.MaxBodySize, &out.MaxBodySize
|
||||
*out = new(int64)
|
||||
**out = **in
|
||||
}
|
||||
if in.Mirrors != nil {
|
||||
in, out := &in.Mirrors, &out.Mirrors
|
||||
*out = make([]MirrorService, len(*in))
|
||||
|
|
|
@ -56,6 +56,7 @@ func Test_buildConfiguration(t *testing.T) {
|
|||
"traefik/http/services/Service01/loadBalancer/servers/0/url": "foobar",
|
||||
"traefik/http/services/Service01/loadBalancer/servers/1/url": "foobar",
|
||||
"traefik/http/services/Service02/mirroring/service": "foobar",
|
||||
"traefik/http/services/Service02/mirroring/maxBodySize": "42",
|
||||
"traefik/http/services/Service02/mirroring/mirrors/0/name": "foobar",
|
||||
"traefik/http/services/Service02/mirroring/mirrors/0/percent": "42",
|
||||
"traefik/http/services/Service02/mirroring/mirrors/1/name": "foobar",
|
||||
|
@ -635,7 +636,8 @@ func Test_buildConfiguration(t *testing.T) {
|
|||
},
|
||||
"Service02": {
|
||||
Mirroring: &dynamic.Mirroring{
|
||||
Service: "foobar",
|
||||
Service: "foobar",
|
||||
MaxBodySize: func(v int64) *int64 { return &v }(42),
|
||||
Mirrors: []dynamic.MirrorService{
|
||||
{
|
||||
Name: "foobar",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue