Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support nginx conf #1130

Merged
merged 23 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
mv omitempty from jsonschema to json, to the generated yaml is more c…
…lean
  • Loading branch information
suchen-sci committed Nov 2, 2023
commit 09a055b5f11d8cbcffff55111a66da5db906057c
14 changes: 7 additions & 7 deletions pkg/filters/proxies/httpproxy/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,16 +181,16 @@ type ServerPool struct {
type ServerPoolSpec struct {
BaseServerPoolSpec `json:",inline"`

Filter *RequestMatcherSpec `json:"filter" jsonschema:"omitempty"`
SpanName string `json:"spanName" jsonschema:"omitempty"`
ServerMaxBodySize int64 `json:"serverMaxBodySize" jsonschema:"omitempty"`
Timeout string `json:"timeout" jsonschema:"omitempty,format=duration"`
RetryPolicy string `json:"retryPolicy" jsonschema:"omitempty"`
CircuitBreakerPolicy string `json:"circuitBreakerPolicy" jsonschema:"omitempty"`
Filter *RequestMatcherSpec `json:"filter,omitempty" jsonschema:"omitempty"`
SpanName string `json:"spanName,omitempty" jsonschema:"omitempty"`
ServerMaxBodySize int64 `json:"serverMaxBodySize,omitempty" jsonschema:"omitempty"`
Timeout string `json:"timeout,omitempty" jsonschema:"omitempty,format=duration"`
RetryPolicy string `json:"retryPolicy,omitempty" jsonschema:"omitempty"`
CircuitBreakerPolicy string `json:"circuitBreakerPolicy,omitempty" jsonschema:"omitempty"`
MemoryCache *MemoryCacheSpec `json:"memoryCache,omitempty" jsonschema:"omitempty"`

// FailureCodes would be 5xx if it isn't assigned any value.
FailureCodes []int `json:"failureCodes" jsonschema:"omitempty,uniqueItems=true"`
FailureCodes []int `json:"failureCodes,omitempty" jsonschema:"omitempty,uniqueItems=true"`
}

// ServerPoolStatus is the status of Pool.
Expand Down
8 changes: 4 additions & 4 deletions pkg/filters/proxies/httpproxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ type (
MirrorPool *ServerPoolSpec `json:"mirrorPool,omitempty" jsonschema:"omitempty"`
Compression *CompressionSpec `json:"compression,omitempty" jsonschema:"omitempty"`
MTLS *MTLS `json:"mtls,omitempty" jsonschema:"omitempty"`
MaxIdleConns int `json:"maxIdleConns" jsonschema:"omitempty"`
MaxIdleConnsPerHost int `json:"maxIdleConnsPerHost" jsonschema:"omitempty"`
MaxRedirection int `json:"maxRedirection" jsonschema:"omitempty"`
ServerMaxBodySize int64 `json:"serverMaxBodySize" jsonschema:"omitempty"`
MaxIdleConns int `json:"maxIdleConns,omitempty" jsonschema:"omitempty"`
MaxIdleConnsPerHost int `json:"maxIdleConnsPerHost,omitempty" jsonschema:"omitempty"`
MaxRedirection int `json:"maxRedirection,omitempty" jsonschema:"omitempty"`
ServerMaxBodySize int64 `json:"serverMaxBodySize,omitempty" jsonschema:"omitempty"`
}

// Status is the status of Proxy.
Expand Down
10 changes: 5 additions & 5 deletions pkg/filters/proxies/loadbalance.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ type LoadBalancer interface {
// this is not good as new policies could be added in the future, we should
// convert it to a map later.
type LoadBalanceSpec struct {
Policy string `json:"policy" jsonschema:"omitempty"`
HeaderHashKey string `json:"headerHashKey" jsonschema:"omitempty"`
ForwardKey string `json:"forwardKey" jsonschema:"omitempty"`
StickySession *StickySessionSpec `json:"stickySession" jsonschema:"omitempty"`
HealthCheck *HealthCheckSpec `json:"healthCheck" jsonschema:"omitempty"`
Policy string `json:"policy,omitempty" jsonschema:"omitempty"`
HeaderHashKey string `json:"headerHashKey,omitempty" jsonschema:"omitempty"`
ForwardKey string `json:"forwardKey,omitempty" jsonschema:"omitempty"`
StickySession *StickySessionSpec `json:"stickySession,omitempty" jsonschema:"omitempty"`
HealthCheck *HealthCheckSpec `json:"healthCheck,omitempty" jsonschema:"omitempty"`
}

// LoadBalancePolicy is the interface of a load balance policy.
Expand Down
6 changes: 3 additions & 3 deletions pkg/filters/proxies/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ import (
// Server is a backend proxy server.
type Server struct {
URL string `json:"url" jsonschema:"required,format=url"`
Tags []string `json:"tags" jsonschema:"omitempty,uniqueItems=true"`
Weight int `json:"weight" jsonschema:"omitempty,minimum=0,maximum=100"`
KeepHost bool `json:"keepHost" jsonschema:"omitempty,default=false"`
Tags []string `json:"tags,omitempty" jsonschema:"omitempty,uniqueItems=true"`
Weight int `json:"weight,omitempty" jsonschema:"omitempty,minimum=0,maximum=100"`
KeepHost bool `json:"keepHost,omitempty" jsonschema:"omitempty,default=false"`
AddrIsHostName bool `json:"-"`
Unhealth bool `json:"-"`
// HealthCounter is used to count the number of successive health checks
Expand Down
10 changes: 5 additions & 5 deletions pkg/filters/proxies/serverpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ type ServerPoolBase struct {

// ServerPoolBaseSpec is the spec for a base server pool.
type ServerPoolBaseSpec struct {
ServerTags []string `json:"serverTags" jsonschema:"omitempty,uniqueItems=true"`
Servers []*Server `json:"servers" jsonschema:"omitempty"`
ServiceRegistry string `json:"serviceRegistry" jsonschema:"omitempty"`
ServiceName string `json:"serviceName" jsonschema:"omitempty"`
LoadBalance *LoadBalanceSpec `json:"loadBalance" jsonschema:"omitempty"`
ServerTags []string `json:"serverTags,omitempty" jsonschema:"omitempty,uniqueItems=true"`
Servers []*Server `json:"servers,omitempty" jsonschema:"omitempty"`
ServiceRegistry string `json:"serviceRegistry,omitempty" jsonschema:"omitempty"`
ServiceName string `json:"serviceName,omitempty" jsonschema:"omitempty"`
LoadBalance *LoadBalanceSpec `json:"loadBalance,omitempty" jsonschema:"omitempty"`
}

// Validate validates ServerPoolSpec.
Expand Down
2 changes: 1 addition & 1 deletion pkg/supervisor/spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ type (
Version string `json:"version" jsonschema:"required"`

// RFC3339 format
CreatedAt string `json:"createdAt" jsonschema:"omitempty"`
CreatedAt string `json:"createdAt,omitempty" jsonschema:"omitempty"`
}
)

Expand Down