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:
|
setup:
|
||||||
$(CC) get -u github.com/client9/misspell
|
$(CC) get -u github.com/client9/misspell
|
||||||
|
|
||||||
release: clean generate gofmt codeqa
|
release: clean gofmt codeqa
|
||||||
$(ENV) $(CC) $(BUILD) $(GCFLAGS) $(LDFLAGS) $(CMD)
|
$(ENV) $(CC) $(BUILD) $(GCFLAGS) $(LDFLAGS) $(CMD)
|
||||||
|
|
||||||
release-vendor: clean generate gofmt codeqa
|
release-vendor: clean generate gofmt codeqa
|
||||||
$(ENV) $(CC) $(BUILD) -mod=vendor $(GCFLAGS) $(LDFLAGS) $(CMD)
|
$(ENV) $(CC) $(BUILD) -mod=vendor $(GCFLAGS) $(LDFLAGS) $(CMD)
|
||||||
|
|
||||||
vendor: clean generate gofmt
|
vendor: clean gofmt
|
||||||
$(ENV) $(CC) $(BUILD) -mod=vendor $(GCFLAGS) $(LDFLAGS) $(CMD)
|
$(ENV) $(CC) $(BUILD) -mod=vendor $(GCFLAGS) $(LDFLAGS) $(CMD)
|
||||||
|
|
||||||
$(PROGRAM): clean generate gofmt
|
$(PROGRAM): clean gofmt
|
||||||
$(ENV) $(CC) $(BUILD) $(GCFLAGS) $(LDFLAGS) $(CMD)
|
$(ENV) $(CC) $(BUILD) $(GCFLAGS) $(LDFLAGS) $(CMD)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
|
@ -29,9 +29,6 @@ clean:
|
||||||
|
|
||||||
codeqa: misspell golint test
|
codeqa: misspell golint test
|
||||||
|
|
||||||
generate:
|
|
||||||
$(CC) generate
|
|
||||||
|
|
||||||
gofmt:
|
gofmt:
|
||||||
gofmt -w pkg/ cmd/
|
gofmt -w pkg/ cmd/
|
||||||
|
|
||||||
|
|
@ -39,7 +36,7 @@ golint:
|
||||||
$(GOPATH)/bin/golint .
|
$(GOPATH)/bin/golint .
|
||||||
|
|
||||||
misspell:
|
misspell:
|
||||||
$(GOPATH)/bin/misspell pkg/* cmd/* Makefile README.md vipman.yaml
|
$(GOPATH)/bin/misspell pkg/* cmd/* Makefile README.md haproxy-lb.yaml
|
||||||
|
|
||||||
test:
|
test:
|
||||||
ifeq ($(shell go env GOARCH), $(shell go env GOHOSTARCH))
|
ifeq ($(shell go env GOARCH), $(shell go env GOHOSTARCH))
|
||||||
|
|
@ -52,4 +49,4 @@ else
|
||||||
$(info skipping tests of other platforms)
|
$(info skipping tests of other platforms)
|
||||||
endif
|
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"
|
const Version = "v1"
|
||||||
|
|
||||||
|
type ProxyProtocol string
|
||||||
|
|
||||||
|
const (
|
||||||
|
ProxyProtocolV1 ProxyProtocol = "v1"
|
||||||
|
ProxyProtocolV2 = "v2"
|
||||||
|
)
|
||||||
|
|
||||||
type LoadBalancer struct {
|
type LoadBalancer struct {
|
||||||
Name string `json:"name,omitempty"`
|
Name string `json:"name,omitempty"`
|
||||||
IP string `json:"ip,omitempty"`
|
IP string `json:"ip,omitempty"`
|
||||||
|
|
@ -31,7 +38,7 @@ func NewLoadBalancerFromBytes(b []byte) (lb *LoadBalancer, err error) {
|
||||||
type Options struct {
|
type Options struct {
|
||||||
Frontend []string `json:"frontend,omitempty"`
|
Frontend []string `json:"frontend,omitempty"`
|
||||||
Backend []string `json:"backend,omitempty"`
|
Backend []string `json:"backend,omitempty"`
|
||||||
ProxyProtocol string `json:"proxyProtocol,omitempty"`
|
ProxyProtocol ProxyProtocol `json:"proxyProtocol,omitempty"`
|
||||||
CheckProxyProtocol bool `json:"checkProxyProtocol,omitempty"`
|
CheckProxyProtocol bool `json:"checkProxyProtocol,omitempty"`
|
||||||
DefaultServer string `json:"defaultServer,omitempty`
|
DefaultServer string `json:"defaultServer,omitempty`
|
||||||
}
|
}
|
||||||
|
|
@ -144,6 +151,11 @@ func (lb LoadBalancer) ValidateServer() error {
|
||||||
if lb.CIDR == "" {
|
if lb.CIDR == "" {
|
||||||
return errors.New("LoadBalancer.CIDR can not be empty")
|
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()
|
err := lb.ValidateClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue