code restructuring as per typical golang projects (#397)

* code restructuring as per typical golang projects

* fix link in docs
This commit is contained in:
Murali Reddy 2018-04-17 00:18:20 +05:30 committed by GitHub
parent 8c746b2cbc
commit 71d16bf4d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
47 changed files with 36 additions and 36 deletions

View File

@ -41,11 +41,11 @@ ifeq "$(BUILD_IN_DOCKER)" "true"
$(DOCKER) run -v $(PWD):/go/src/github.com/cloudnativelabs/kube-router -w /go/src/github.com/cloudnativelabs/kube-router $(DOCKER_BUILD_IMAGE) \
sh -c ' \
GOARCH=$(GOARCH) CGO_ENABLED=0 go build \
-ldflags "-X github.com/cloudnativelabs/kube-router/app.version=$(GIT_COMMIT) -X github.com/cloudnativelabs/kube-router/app.buildDate=$(BUILD_DATE)" \
-o kube-router kube-router.go'
-ldflags "-X github.com/cloudnativelabs/kube-router/pkg/cmd.version=$(GIT_COMMIT) -X github.com/cloudnativelabs/kube-router/pkg/cmd.buildDate=$(BUILD_DATE)" \
-o kube-router cmd/kube-router/kube-router.go'
@echo Finished kube-router binary build.
else
GOARCH=$(GOARCH) CGO_ENABLED=0 go build -ldflags '-X github.com/cloudnativelabs/kube-router/app.version=$(GIT_COMMIT) -X github.com/cloudnativelabs/kube-router/app.buildDate=$(BUILD_DATE)' -o kube-router kube-router.go
GOARCH=$(GOARCH) CGO_ENABLED=0 go build -ldflags '-X github.com/cloudnativelabs/kube-router/pkg/cmd.version=$(GIT_COMMIT) -X github.com/cloudnativelabs/kube-router/pkg/cmd.buildDate=$(BUILD_DATE)' -o kube-router cmd/kube-router/kube-router.go
endif
test: gofmt gomoqs ## Runs code quality pipelines (gofmt, tests, coverage, lint, etc)
@ -53,7 +53,7 @@ ifeq "$(BUILD_IN_DOCKER)" "true"
$(DOCKER) run -v $(PWD):/go/src/github.com/cloudnativelabs/kube-router -w /go/src/github.com/cloudnativelabs/kube-router $(DOCKER_BUILD_IMAGE) \
sh -c 'go test github.com/cloudnativelabs/kube-router github.com/cloudnativelabs/kube-router/app/... github.com/cloudnativelabs/kube-router/utils/'
else
go test github.com/cloudnativelabs/kube-router github.com/cloudnativelabs/kube-router/app/... github.com/cloudnativelabs/kube-router/utils/
go test github.com/cloudnativelabs/kube-router/cmd/kube-router/ github.com/cloudnativelabs/kube-router/pkg/...
endif
vagrant-up: export docker=$(DOCKER)
@ -144,7 +144,7 @@ gofmt-fix: ## Fixes files that need to be gofmt'd.
# List of all file_moq.go files which would need to be regenerated
# from file.go if changed
gomoqs: ./app/controllers/network_services_controller_moq.go
gomoqs: ./pkg/controllers/network_services_controller_moq.go
# file_moq.go file is generated from file.go "//go:generate moq ..." in-file
# annotation, as it needs to know which interfaces to create mock stubs for

View File

@ -20,7 +20,7 @@ single DaemonSet/Binary. It doesn't get any easier.
### IPVS/LVS based service proxy | `--run-service-proxy`
kube-router uses the Linux kernel's LVS/IPVS features to implement its K8s Services
Proxy. Kube-router fully leverages power off LVS/IPVS to provide rich set of [scheduling options](/Documentation#load-balancing-scheduling-algorithms) and unique features like DSR (Direct Server Return), L3 load balancing with ECMP for deployments where high throughput, minimal latency and high-availability are crucial.
Proxy. Kube-router fully leverages power off LVS/IPVS to provide rich set of [scheduling options](/docs#load-balancing-scheduling-algorithms) and unique features like DSR (Direct Server Return), L3 load balancing with ECMP for deployments where high throughput, minimal latency and high-availability are crucial.
Read more about the advantages of IPVS for container load balancing:
- [Kubernetes network services proxy with IPVS/LVS](https://cloudnativelabs.github.io/post/2017-05-10-kube-network-service-proxy/)
@ -68,18 +68,18 @@ configured BGP peers. Kube-routes also support MD5 password based authentication
uses strict export policies so you can be assured routes are advertised to underlay
only as you intended.
For more details please refer to the [BGP documentation](Documentation/bgp.md).
For more details please refer to the [BGP documentation](docs/bgp.md).
### Standard Linux Networking
A key design tenet of Kube-router is to use standard Linux networking stack and toolset. There is no overlays or
SDN pixie dust, but just plain good old networking. You can use standard Linux networking tools like iptables, ipvsadm, ipset,
iproute, traceroute, tcpdump etc. to troubleshoot or observe data path. When kube-router is ran as a daemonset, image also ships with these [tools](./Documentation/pod-toolbox.md#pod-toolbox) automatically configured for your cluster.
iproute, traceroute, tcpdump etc. to troubleshoot or observe data path. When kube-router is ran as a daemonset, image also ships with these [tools](./docs/pod-toolbox.md#pod-toolbox) automatically configured for your cluster.
### Small Footprint
Although it does the work of several of its peers in one binary, kube-router
does it all with a relatively [tiny codebase](https://github.com/cloudnativelabs/kube-router/tree/master/app/controllers), partly because IPVS is already
does it all with a relatively [tiny codebase](https://github.com/cloudnativelabs/kube-router/tree/master/pkg/controllers), partly because IPVS is already
there on your Kuberneres nodes waiting to help you do amazing things.
kube-router brings that and GoBGP's modern BGP interface to you in an elegant
package designed from the ground up for Kubernetes.
@ -94,11 +94,11 @@ that has been thouroughly tested and optimized.
## Getting Started
- [How it Works](./Documentation/how-it-works.md)
- [Architecture](./Documentation/README.md#architecture)
- [See Kube-router in action](./Documentation#see-kube-router-in-action)
- [User Guide](./Documentation/README.md#user-guide)
- [Developer Guide](./Documentation/developing.md)
- [How it Works](./docs/how-it-works.md)
- [Architecture](./docs/README.md#architecture)
- [See Kube-router in action](./docs/README.md#see-kube-router-in-action)
- [User Guide](./docs/README.md#user-guide)
- [Developer Guide](./docs/developing.md)
## Project status

View File

@ -8,8 +8,8 @@ import (
_ "net/http/pprof"
"github.com/cloudnativelabs/kube-router/app"
"github.com/cloudnativelabs/kube-router/app/options"
"github.com/cloudnativelabs/kube-router/pkg/cmd"
"github.com/cloudnativelabs/kube-router/pkg/options"
"github.com/spf13/pflag"
)
@ -39,7 +39,7 @@ func Main() error {
}
if config.Version {
app.PrintVersion(false)
cmd.PrintVersion(false)
return nil
}
@ -48,11 +48,11 @@ func Main() error {
}
if config.CleanupConfig {
app.CleanupConfigAndExit()
cmd.CleanupConfigAndExit()
return nil
}
kubeRouter, err := app.NewKubeRouterDefault(config)
kubeRouter, err := cmd.NewKubeRouterDefault(config)
if err != nil {
return fmt.Errorf("Failed to parse kube-router config: %v", err)
}

View File

@ -32,9 +32,9 @@ func TestMainHelp(t *testing.T) {
stderrW.Close()
wg.Wait()
docF, err := os.Open("Documentation/README.md")
docF, err := os.Open("../../docs/README.md")
if err != nil {
t.Fatalf("could not open Documentation/README.md: %s\n", err)
t.Fatalf("could not open docs/README.md: %s\n", err)
}
docBuf := bytes.NewBuffer(nil)
docBuf.ReadFrom(docF)
@ -44,6 +44,6 @@ func TestMainHelp(t *testing.T) {
exp = append(exp, []byte("```\n")...)
if !bytes.Contains(docBuf.Bytes(), exp) {
t.Errorf("Documentation/README.md 'command line options' section does not match `kube-router --help`.\nExpected:\n%s", exp)
t.Errorf("docs/README.md 'command line options' section does not match `kube-router --help`.\nExpected:\n%s", exp)
}
}

View File

@ -79,16 +79,16 @@ However BGP can be leveraged to other use cases like advertising the cluster ip,
The best way to get started is to deploy Kubernetes with Kube-router is with a cluster installer.
#### kops
Please see the [steps](https://github.com/cloudnativelabs/kube-router/blob/master/Documentation/kops.md) to deploy Kubernetes cluster with Kube-router using [Kops](https://github.com/kubernetes/kops)
Please see the [steps](https://github.com/cloudnativelabs/kube-router/blob/master/docs/kops.md) to deploy Kubernetes cluster with Kube-router using [Kops](https://github.com/kubernetes/kops)
#### bootkube
Please see the [steps](https://github.com/cloudnativelabs/kube-router/tree/master/contrib/bootkube) to deploy Kubernetes cluster with Kube-router using [bootkube](https://github.com/kubernetes-incubator/bootkube)
#### kubeadm
Please see the [steps](https://github.com/cloudnativelabs/kube-router/blob/master/Documentation/kubeadm.md) to deploy Kubernetes cluster with Kube-router using [Kubeadm](https://kubernetes.io/docs/setup/independent/create-cluster-kubeadm/)
Please see the [steps](https://github.com/cloudnativelabs/kube-router/blob/master/docs/kubeadm.md) to deploy Kubernetes cluster with Kube-router using [Kubeadm](https://kubernetes.io/docs/setup/independent/create-cluster-kubeadm/)
#### generic
Please see the [steps](https://github.com/cloudnativelabs/kube-router/blob/master/Documentation/generic.md) to deploy kube-router on manually installed clusters
Please see the [steps](https://github.com/cloudnativelabs/kube-router/blob/master/docs/generic.md) to deploy kube-router on manually installed clusters
### deployment

View File

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 56 KiB

View File

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 40 KiB

View File

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 59 KiB

View File

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View File

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 41 KiB

View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

Before

Width:  |  Height:  |  Size: 155 KiB

After

Width:  |  Height:  |  Size: 155 KiB

View File

@ -1,4 +1,4 @@
package app
package cmd
import (
"errors"
@ -9,8 +9,8 @@ import (
"sync"
"syscall"
"github.com/cloudnativelabs/kube-router/app/controllers"
"github.com/cloudnativelabs/kube-router/app/options"
"github.com/cloudnativelabs/kube-router/pkg/controllers"
"github.com/cloudnativelabs/kube-router/pkg/options"
"github.com/golang/glog"
"k8s.io/client-go/informers"

View File

@ -6,7 +6,7 @@ import (
"sync"
"time"
"github.com/cloudnativelabs/kube-router/app/options"
"github.com/cloudnativelabs/kube-router/pkg/options"
"github.com/golang/glog"
"golang.org/x/net/context"
)

View File

@ -7,7 +7,7 @@ import (
"sync"
"time"
"github.com/cloudnativelabs/kube-router/app/options"
"github.com/cloudnativelabs/kube-router/pkg/options"
"github.com/golang/glog"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"

View File

@ -11,8 +11,8 @@ import (
"sync"
"time"
"github.com/cloudnativelabs/kube-router/app/options"
"github.com/cloudnativelabs/kube-router/utils"
"github.com/cloudnativelabs/kube-router/pkg/options"
"github.com/cloudnativelabs/kube-router/pkg/utils"
"github.com/coreos/go-iptables/iptables"
"github.com/golang/glog"
"github.com/prometheus/client_golang/prometheus"

View File

@ -19,8 +19,8 @@ import (
"github.com/aws/aws-sdk-go/aws/ec2metadata"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/cloudnativelabs/kube-router/app/options"
"github.com/cloudnativelabs/kube-router/utils"
"github.com/cloudnativelabs/kube-router/pkg/options"
"github.com/cloudnativelabs/kube-router/pkg/utils"
"github.com/coreos/go-iptables/iptables"
"github.com/golang/glog"
bgpapi "github.com/osrg/gobgp/api"

View File

@ -18,8 +18,8 @@ import (
"syscall"
"time"
"github.com/cloudnativelabs/kube-router/app/options"
"github.com/cloudnativelabs/kube-router/utils"
"github.com/cloudnativelabs/kube-router/pkg/options"
"github.com/cloudnativelabs/kube-router/pkg/utils"
"github.com/coreos/go-iptables/iptables"
"github.com/docker/docker/client"
"github.com/docker/libnetwork/ipvs"