Skip to content

Commit

Permalink
[CZBANK] feat(*) oem rebase and cherry-pick canary features from 2.11 (
Browse files Browse the repository at this point in the history
…#201)

* optimize: use internal http backend to replace default-http-backend (#147)

* feat: manual update vendor for ipv6

* feat: sync vips to provider status for dual stack

* [CPS-6115]fix: redefine Registry struct in package of plugin (#152)

* fix: redefine Registry struct in package of plugin

  remove packages dependent on personal repo

* vendor update

* fix: mount xtables file to ipvsdr deployment (#154)

* build: switch to go mod (#153)

* [CPS-6047]upgrade k8s api to 1.17+ & upgrade clientset (#155)

* upgrade k8s api to 1.17+ & upgrade clientset

* fix: api upgrade

* upgrade golang version to 1.13.6 & upgrade golangci-lint (#156)

* chore: update nginx-ingress-controller version (#158)

Co-authored-by: Lisheng Zheng <zhenglisheng@caicloud.io>

* fix: sync lb crd with the definition in vaquita (#159)

* chore: update vendor to add NodeStatus (#160)

* upgrade crd version from v1beta1 to v1 (#161)

* [CPS-6637]chore(*): bump kubernetes version to 1.17.5 (#162)

* chore(golang): upgrade golang to 1.13.9

* feat(health): add health check (#164)

* fix: do not add 'helm.sh' annotations on deployment (#163)

annotations will be added by other CPS component,
such as workload-controller.

* fix: upgrade go-common=0.3.6 (#167)

* [CPS-7306]fix: false live state caused by leaderelection (#176)

* update go-common to v0.3.7

* [CPS-7306]fix: false live state caused by leaderelection

* fix: fix broken custom lb config caused by eb249d6 (#178)

fix http://jira.caicloud.xyz/browse/CPS-7374

* fix(resource): increate limits and requests (#181)

* chore(nginx): bump up ingress-nginx version (#183)

Co-authored-by: Lisheng Zheng <zhenglisheng@caicloud.io>

* chore(owners): add approver and reviewer VincentGuoCQ (#194)

* feat(ingress): remove nginx proxy sidecar (#195)

* fix(ingress): use ingress v1beta1 for k8s 1.14.8

* feat(net): add "helm.sh/..." annotation on lb deployment (#124)

Co-authored-by: Shi Wang <wangshi@caicloud.io>
Co-authored-by: Huanle Han <hanhuanle@caicloud.io>
Co-authored-by: Lisheng Zheng <zls1129@gmail.com>
Co-authored-by: Lisheng Zheng <zhenglisheng@caicloud.io>
Co-authored-by: Mengjiang Bao <baomengjiang@gmail.com>
Co-authored-by: Pengfei Guo <guopengfei@caicloud.io>
Co-authored-by: Jinghao Lu <lujinghao@caicloud.io>
Co-authored-by: caicloud-bot <register@caicloud.io>
  • Loading branch information
9 people authored Feb 4, 2021
1 parent 9e8f321 commit 042f494
Show file tree
Hide file tree
Showing 1,563 changed files with 198,889 additions and 316,436 deletions.
890 changes: 0 additions & 890 deletions Gopkg.lock

This file was deleted.

63 changes: 0 additions & 63 deletions Gopkg.toml

This file was deleted.

9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ CPUS ?= $(shell /bin/bash hack/read_cpus_available.sh)
# Track code version with Docker Label.
DOCKER_LABELS ?= git-describe="$(shell date -u +v%Y%m%d)-$(shell git describe --tags --always --dirty)"

# This will force go to use the vendor files instead of using the `$GOPATH/pkg/mod`. (vendor mode)
# more info: https://github.com/golang/go/wiki/Modules#how-do-i-use-vendoring-with-modules-is-vendoring-going-away
export GOFLAGS := -mod=vendor

# Golang standard bin directory.
GOPATH ?= $(shell go env GOPATH)
BIN_DIR := $(GOPATH)/bin
Expand All @@ -91,7 +95,7 @@ lint: $(GOLANGCI_LINT)
@$(GOLANGCI_LINT) run

$(GOLANGCI_LINT):
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(BIN_DIR) v1.20.1
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(BIN_DIR) v1.23.6

test:
@go test -p $(CPUS) $$(go list ./... | grep -v /vendor | grep -v /test) -coverprofile=coverage.out
Expand All @@ -112,8 +116,9 @@ build-linux:
-e GOOS=linux \
-e GOARCH=amd64 \
-e GOPATH=/go \
-e GOFLAGS=$(GOFLAGS) \
-e SHELLOPTS=$(SHELLOPTS) \
$(BASE_REGISTRY)/golang:1.12-security \
$(BASE_REGISTRY)/golang:1.13.9-stretch \
/bin/bash -c 'for target in $(TARGETS); do \
go build -i -v -o $(OUTPUT_DIR)/$${target} -p $(CPUS) \
-ldflags "-s -w -X $(ROOT)/pkg/version.VERSION=$(VERSION) \
Expand Down
3 changes: 3 additions & 0 deletions OWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ reviewers:
- hanxueluo
- hicaistar
- sinksmell
- VincentGuoCQ

approvers:
- whalecold
- hanxueluo
- hicaistar
- VincentGuoCQ
30 changes: 1 addition & 29 deletions cmd/controller/app/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,12 @@ package app

import (
"github.com/caicloud/loadbalancer-controller/cmd/controller/app/config"
"github.com/caicloud/loadbalancer-controller/cmd/controller/app/options"
lbcontroller "github.com/caicloud/loadbalancer-controller/pkg/controller"
"github.com/caicloud/loadbalancer-controller/pkg/version"
"github.com/spf13/cobra"
"k8s.io/apimachinery/pkg/util/wait"

"k8s.io/klog"
)

// NewCommand creates a *cobra.Command object with default parameters
func NewCommand() *cobra.Command {
s := options.NewOptions()

cmd := &cobra.Command{
Use: "loadbalancer-controller",
Long: `k8s loadbalancer resource controller`,
Run: func(cmd *cobra.Command, args []string) {
c, err := s.Config()
if err != nil {
klog.Exitln(err)
}
if err := Run(c, wait.NeverStop); err != nil {
klog.Exitln(err)
}
},
}

fs := cmd.Flags()
fs.AddFlagSet(s.Flags())

_ = fs.Set("logtostderr", "true")

return cmd
}

// Run runs the Config. This should never exit.
func Run(c *config.Config, stopCh <-chan struct{}) error {
klog.Info(version.Get().Pretty())
Expand Down
12 changes: 8 additions & 4 deletions cmd/controller/app/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,17 @@ const (

// Options is the main context object for the admission controller.
type Options struct {
Master string
Kubeconfig string
Cfg lbconfig.Configuration
Master string
Kubeconfig string
HealthzPort int
Cfg lbconfig.Configuration
}

// NewOptions creates a new AddmissionOptions with a default config.
func NewOptions() *Options {
return &Options{}
return &Options{
HealthzPort: 8081,
}
}

// Flags returns flags for admission controller
Expand All @@ -56,6 +59,7 @@ func (s *Options) Flags() *pflag.FlagSet {

fs.StringVar(&s.Kubeconfig, "kubeconfig", s.Kubeconfig, "Path to kubeconfig file with authorization and master location information.")
fs.StringVar(&s.Master, "master", s.Master, "The address of the Kubernetes API server (overrides any value in kubeconfig).")
fs.IntVar(&s.HealthzPort, "healthzPort", s.HealthzPort, "Port for health check")

// init log
gofs := goflag.NewFlagSet("klog", goflag.ExitOnError)
Expand Down
34 changes: 29 additions & 5 deletions cmd/controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,40 @@ limitations under the License.
package main

import (
"fmt"
"context"
"os"

"k8s.io/klog"

"github.com/caicloud/loadbalancer-controller/cmd/controller/app"
"github.com/caicloud/loadbalancer-controller/cmd/controller/app/options"

"github.com/caicloud/go-common/kubernetes/leaderelection"
"github.com/caicloud/go-common/signal"
)

func main() {
command := app.NewCommand()
if err := command.Execute(); err != nil {
fmt.Fprintf(os.Stderr, "%v\n", err)
os.Exit(1)
s := options.NewOptions()
_ = s.Flags().Set("logtostderr", "true")
if err := s.Flags().Parse(os.Args); err != nil {
klog.Exitln(err)
}

c, err := s.Config()
if err != nil {
klog.Exitln(err)
}

stopCh := signal.SetupStopSignalHandler()
leaderelection.RunOrDie(leaderelection.Option{
LeaseLockName: "loadbalancer-controller",
LeaseLockNamespace: "default",
KubeClient: c.Cfg.Client,
Run: func(_ context.Context) {
_ = app.Run(c, stopCh)
signal.RequestShutdown()
},
Port: s.HealthzPort,
StopCh: stopCh,
})
}
45 changes: 45 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
module github.com/caicloud/loadbalancer-controller

go 1.13

require (
github.com/InVisionApp/conjungo v1.1.0
github.com/caicloud/clientset v0.0.0-20200420062837-792b5fced8a6
github.com/caicloud/go-common v0.3.7
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
github.com/mattbaird/jsonpatch v0.0.0-20171005235357-81af80346b1a
github.com/spf13/cobra v0.0.5
github.com/spf13/pflag v1.0.5
golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4 // indirect
k8s.io/api v0.17.5
k8s.io/apiextensions-apiserver v0.17.5
k8s.io/apimachinery v0.17.5
k8s.io/client-go v0.17.5
k8s.io/klog v1.0.0
k8s.io/kubernetes v1.17.5
)

replace (
k8s.io/api => k8s.io/api v0.17.5
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.17.5
k8s.io/apimachinery => k8s.io/apimachinery v0.17.5
k8s.io/apiserver => k8s.io/apiserver v0.17.5
k8s.io/cli-runtime => k8s.io/cli-runtime v0.17.5
k8s.io/client-go => k8s.io/client-go v0.17.5
k8s.io/cloud-provider => k8s.io/cloud-provider v0.17.5
k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.17.5
k8s.io/code-generator => k8s.io/code-generator v0.17.5
k8s.io/component-base => k8s.io/component-base v0.17.5
k8s.io/cri-api => k8s.io/cri-api v0.17.5
k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.17.5
k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.17.5
k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.17.5
k8s.io/kube-proxy => k8s.io/kube-proxy v0.17.5
k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.17.5
k8s.io/kubectl => k8s.io/kubectl v0.17.5
k8s.io/kubelet => k8s.io/kubelet v0.17.5
k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.17.5
k8s.io/metrics => k8s.io/metrics v0.17.5
k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.17.5
)
Loading

0 comments on commit 042f494

Please sign in to comment.