chore: change Route crd structure
This commit is contained in:
@@ -25,8 +25,33 @@ import (
|
||||
|
||||
// RouteSpec defines the desired state of Route.
|
||||
type RouteSpec struct {
|
||||
Gateway string `json:"gateway"`
|
||||
Routes []RouteConfig `json:"routes"`
|
||||
// Gateway defines the name of the Gateway resource
|
||||
Gateway string `json:"gateway"`
|
||||
// Path defines route path
|
||||
Path string `json:"path" yaml:"path"`
|
||||
// Hosts Domains/hosts based request routing
|
||||
Hosts []string `json:"hosts,omitempty" yaml:"hosts"`
|
||||
// Rewrite rewrites route path to desired path
|
||||
Rewrite string `json:"rewrite,omitempty" yaml:"rewrite"`
|
||||
// Methods allowed method
|
||||
Methods []string `json:"methods,omitempty" yaml:"methods"`
|
||||
// Destination Defines backend URL
|
||||
Destination string `json:"destination,omitempty" yaml:"destination"`
|
||||
Backends []string `json:"backends,omitempty" yaml:"backends"`
|
||||
InsecureSkipVerify bool `json:"insecureSkipVerify,omitempty" yaml:"insecureSkipVerify"`
|
||||
// HealthCheck Defines the backend is health
|
||||
HealthCheck RouteHealthCheck `json:"healthCheck,omitempty" yaml:"healthCheck,omitempty"`
|
||||
// Cors contains the route cors headers
|
||||
Cors Cors `json:"cors,omitempty" yaml:"cors"`
|
||||
RateLimit int `json:"rateLimit,omitempty" yaml:"rateLimit"`
|
||||
// DisableHostFording Disables host forwarding.
|
||||
DisableHostFording bool `json:"disableHostFording,omitempty" yaml:"disableHostFording"`
|
||||
// InterceptErrors intercepts backend errors based on the status codes
|
||||
InterceptErrors []int `json:"interceptErrors,omitempty" yaml:"interceptErrors"`
|
||||
// BlockCommonExploits enable, disable block common exploits
|
||||
BlockCommonExploits bool `json:"blockCommonExploits,omitempty" yaml:"blockCommonExploits"`
|
||||
// Middlewares Defines route middleware
|
||||
Middlewares []string `json:"middlewares,omitempty" yaml:"middlewares"`
|
||||
}
|
||||
|
||||
// RouteStatus defines the observed state of Route.
|
||||
|
||||
@@ -51,38 +51,7 @@ type Server struct {
|
||||
// EnableMetrics enable and disable server metrics
|
||||
EnableMetrics bool `json:"enableMetrics,omitempty" yaml:"enableMetrics"`
|
||||
}
|
||||
type RouteConfig struct {
|
||||
// Path defines route path
|
||||
Path string `json:"path" yaml:"path"`
|
||||
// Name defines route name
|
||||
Name string `json:"name" yaml:"name"`
|
||||
// Hosts Domains/hosts based request routing
|
||||
Hosts []string `json:"hosts,omitempty" yaml:"hosts"`
|
||||
// Rewrite rewrites route path to desired path
|
||||
Rewrite string `json:"rewrite,omitempty" yaml:"rewrite"`
|
||||
// Methods allowed method
|
||||
Methods []string `json:"methods,omitempty" yaml:"methods"`
|
||||
// Destination Defines backend URL
|
||||
Destination string `json:"destination,omitempty" yaml:"destination"`
|
||||
Backends []string `json:"backends,omitempty" yaml:"backends"`
|
||||
InsecureSkipVerify bool `json:"insecureSkipVerify,omitempty" yaml:"insecureSkipVerify"`
|
||||
// HealthCheck Defines the backend is health
|
||||
HealthCheck RouteHealthCheck `json:"healthCheck,omitempty" yaml:"healthCheck,omitempty"`
|
||||
// Cors contains the route cors headers
|
||||
Cors Cors `json:"cors,omitempty" yaml:"cors"`
|
||||
RateLimit int `json:"rateLimit,omitempty" yaml:"rateLimit"`
|
||||
// DisableHostFording Disable host forwarding.
|
||||
DisableHostFording bool `json:"disableHostFording,omitempty" yaml:"disableHostFording"`
|
||||
// InterceptErrors intercepts backend errors based on the status codes
|
||||
InterceptErrors []int `json:"interceptErrors,omitempty" yaml:"interceptErrors"`
|
||||
// BlockCommonExploits enable, disable block common exploits
|
||||
BlockCommonExploits bool `json:"blockCommonExploits,omitempty" yaml:"blockCommonExploits"`
|
||||
// Middlewares Defines route middleware
|
||||
Middlewares []string `json:"middlewares,omitempty" yaml:"middlewares"`
|
||||
}
|
||||
type RoutesConfig struct {
|
||||
Routes []RouteConfig `json:"routes" yaml:"routes"`
|
||||
}
|
||||
|
||||
type RouteHealthCheck struct {
|
||||
Path string `json:"path,omitempty" yaml:"path"`
|
||||
Interval string `json:"interval,omitempty" yaml:"interval"`
|
||||
|
||||
@@ -347,48 +347,6 @@ func (in *Route) DeepCopyObject() runtime.Object {
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *RouteConfig) DeepCopyInto(out *RouteConfig) {
|
||||
*out = *in
|
||||
if in.Hosts != nil {
|
||||
in, out := &in.Hosts, &out.Hosts
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.Methods != nil {
|
||||
in, out := &in.Methods, &out.Methods
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.Backends != nil {
|
||||
in, out := &in.Backends, &out.Backends
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
in.HealthCheck.DeepCopyInto(&out.HealthCheck)
|
||||
in.Cors.DeepCopyInto(&out.Cors)
|
||||
if in.InterceptErrors != nil {
|
||||
in, out := &in.InterceptErrors, &out.InterceptErrors
|
||||
*out = make([]int, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.Middlewares != nil {
|
||||
in, out := &in.Middlewares, &out.Middlewares
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteConfig.
|
||||
func (in *RouteConfig) DeepCopy() *RouteConfig {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(RouteConfig)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *RouteHealthCheck) DeepCopyInto(out *RouteHealthCheck) {
|
||||
*out = *in
|
||||
@@ -444,12 +402,32 @@ func (in *RouteList) DeepCopyObject() runtime.Object {
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *RouteSpec) DeepCopyInto(out *RouteSpec) {
|
||||
*out = *in
|
||||
if in.Routes != nil {
|
||||
in, out := &in.Routes, &out.Routes
|
||||
*out = make([]RouteConfig, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
if in.Hosts != nil {
|
||||
in, out := &in.Hosts, &out.Hosts
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.Methods != nil {
|
||||
in, out := &in.Methods, &out.Methods
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.Backends != nil {
|
||||
in, out := &in.Backends, &out.Backends
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
in.HealthCheck.DeepCopyInto(&out.HealthCheck)
|
||||
in.Cors.DeepCopyInto(&out.Cors)
|
||||
if in.InterceptErrors != nil {
|
||||
in, out := &in.InterceptErrors, &out.InterceptErrors
|
||||
*out = make([]int, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.Middlewares != nil {
|
||||
in, out := &in.Middlewares, &out.Middlewares
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -478,28 +456,6 @@ func (in *RouteStatus) DeepCopy() *RouteStatus {
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *RoutesConfig) DeepCopyInto(out *RoutesConfig) {
|
||||
*out = *in
|
||||
if in.Routes != nil {
|
||||
in, out := &in.Routes, &out.Routes
|
||||
*out = make([]RouteConfig, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RoutesConfig.
|
||||
func (in *RoutesConfig) DeepCopy() *RoutesConfig {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(RoutesConfig)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Server) DeepCopyInto(out *Server) {
|
||||
*out = *in
|
||||
|
||||
Reference in New Issue
Block a user