minor changes
This commit is contained in:
parent
279fba0c57
commit
ba001b4c20
2 changed files with 22 additions and 13 deletions
13
Makefile
13
Makefile
|
|
@ -12,16 +12,16 @@ all: $(PROGRAM)
|
|||
setup:
|
||||
$(CC) get -u github.com/client9/misspell
|
||||
|
||||
release: clean generate gofmt codeqa
|
||||
release: clean gofmt codeqa
|
||||
$(ENV) $(CC) $(BUILD) $(GCFLAGS) $(LDFLAGS) $(CMD)
|
||||
|
||||
release-vendor: clean generate gofmt codeqa
|
||||
$(ENV) $(CC) $(BUILD) -mod=vendor $(GCFLAGS) $(LDFLAGS) $(CMD)
|
||||
|
||||
vendor: clean generate gofmt
|
||||
vendor: clean gofmt
|
||||
$(ENV) $(CC) $(BUILD) -mod=vendor $(GCFLAGS) $(LDFLAGS) $(CMD)
|
||||
|
||||
$(PROGRAM): clean generate gofmt
|
||||
$(PROGRAM): clean gofmt
|
||||
$(ENV) $(CC) $(BUILD) $(GCFLAGS) $(LDFLAGS) $(CMD)
|
||||
|
||||
clean:
|
||||
|
|
@ -29,9 +29,6 @@ clean:
|
|||
|
||||
codeqa: misspell golint test
|
||||
|
||||
generate:
|
||||
$(CC) generate
|
||||
|
||||
gofmt:
|
||||
gofmt -w pkg/ cmd/
|
||||
|
||||
|
|
@ -39,7 +36,7 @@ golint:
|
|||
$(GOPATH)/bin/golint .
|
||||
|
||||
misspell:
|
||||
$(GOPATH)/bin/misspell pkg/* cmd/* Makefile README.md vipman.yaml
|
||||
$(GOPATH)/bin/misspell pkg/* cmd/* Makefile README.md haproxy-lb.yaml
|
||||
|
||||
test:
|
||||
ifeq ($(shell go env GOARCH), $(shell go env GOHOSTARCH))
|
||||
|
|
@ -52,4 +49,4 @@ else
|
|||
$(info skipping tests of other platforms)
|
||||
endif
|
||||
|
||||
.PHONY: setup release release-vendor vendor build clean codeqa generate gofmt golint misspell test
|
||||
.PHONY: setup release release-vendor vendor build clean codeqa gofmt golint misspell test
|
||||
|
|
|
|||
|
|
@ -14,6 +14,13 @@ healthCheckNodePort
|
|||
|
||||
const Version = "v1"
|
||||
|
||||
type ProxyProtocol string
|
||||
|
||||
const (
|
||||
ProxyProtocolV1 ProxyProtocol = "v1"
|
||||
ProxyProtocolV2 = "v2"
|
||||
)
|
||||
|
||||
type LoadBalancer struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
IP string `json:"ip,omitempty"`
|
||||
|
|
@ -31,7 +38,7 @@ func NewLoadBalancerFromBytes(b []byte) (lb *LoadBalancer, err error) {
|
|||
type Options struct {
|
||||
Frontend []string `json:"frontend,omitempty"`
|
||||
Backend []string `json:"backend,omitempty"`
|
||||
ProxyProtocol string `json:"proxyProtocol,omitempty"`
|
||||
ProxyProtocol ProxyProtocol `json:"proxyProtocol,omitempty"`
|
||||
CheckProxyProtocol bool `json:"checkProxyProtocol,omitempty"`
|
||||
DefaultServer string `json:"defaultServer,omitempty`
|
||||
}
|
||||
|
|
@ -144,6 +151,11 @@ func (lb LoadBalancer) ValidateServer() error {
|
|||
if lb.CIDR == "" {
|
||||
return errors.New("LoadBalancer.CIDR can not be empty")
|
||||
}
|
||||
switch lb.Options.ProxyProtocol {
|
||||
case "", ProxyProtocolV1, ProxyProtocolV2:
|
||||
default:
|
||||
return errors.New(`LoadBalancer.Options.ProxyProtocol invalid value. (allowed: "", "v1", "v2")`)
|
||||
}
|
||||
err := lb.ValidateClient()
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue