Skip to content

Commit

Permalink
add multiclusteringress service locations controller
Browse files Browse the repository at this point in the history
Signed-off-by: changzhen <[email protected]>
  • Loading branch information
XiShanYongYe-Chang committed Feb 27, 2024
1 parent 2beda5f commit 1492074
Show file tree
Hide file tree
Showing 5 changed files with 306 additions and 125 deletions.
12 changes: 12 additions & 0 deletions app/controllers.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

controllerscontext "github.com/karmada-io/multicluster-cloud-provider/pkg/controllers/context"
"github.com/karmada-io/multicluster-cloud-provider/pkg/controllers/crdinstallation"
"github.com/karmada-io/multicluster-cloud-provider/pkg/controllers/mciservicelocations"
"github.com/karmada-io/multicluster-cloud-provider/pkg/controllers/multiclusteringress"
"github.com/karmada-io/multicluster-cloud-provider/pkg/controllers/multiclusterservice"
"github.com/karmada-io/multicluster-cloud-provider/pkg/controllers/serviceexportpropagation"
Expand Down Expand Up @@ -79,3 +80,14 @@ func startServiceExportPropagationController(ctx controllerscontext.Context) (en
}
return true, nil
}

func startMCIServiceLocationsController(ctx controllerscontext.Context) (enabled bool, err error) {
c := &mciservicelocations.Controller{
Client: ctx.Mgr.GetClient(),
RateLimiterOptions: ctx.Opts.RateLimiterOptions,
}
if err = c.SetupWithManager(ctx.Mgr); err != nil {
return false, err
}
return true, nil
}
6 changes: 4 additions & 2 deletions app/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/cache"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/healthz"
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"

multiclusterprovider "github.com/karmada-io/multicluster-cloud-provider"
"github.com/karmada-io/multicluster-cloud-provider/options"
Expand All @@ -39,6 +40,7 @@ func init() {
controllers["multiclusterservice"] = startMCSController
controllers["crd-installation"] = startCRDInstallationController
controllers["serviceexport-propagation"] = startServiceExportPropagationController
controllers["mci-service-locations"] = startMCIServiceLocationsController
}

// InitProviderFunc is used to initialize multicluster provider
Expand Down Expand Up @@ -105,7 +107,7 @@ func Run(ctx context.Context, opts *options.MultiClusterControllerManagerOptions
controllerManager, err := controllerruntime.NewManager(config, controllerruntime.Options{
Logger: klog.Background(),
Scheme: gclient.NewSchema(),
SyncPeriod: &opts.ResyncPeriod.Duration,
Cache: cache.Options{SyncPeriod: &opts.ResyncPeriod.Duration},
LeaderElection: opts.LeaderElection.LeaderElect,
LeaderElectionID: opts.LeaderElection.ResourceName,
LeaderElectionNamespace: opts.LeaderElection.ResourceNamespace,
Expand All @@ -115,7 +117,7 @@ func Run(ctx context.Context, opts *options.MultiClusterControllerManagerOptions
LeaderElectionResourceLock: opts.LeaderElection.ResourceLock,
HealthProbeBindAddress: net.JoinHostPort(opts.BindAddress, strconv.Itoa(opts.SecurePort)),
LivenessEndpointName: "/healthz",
MetricsBindAddress: opts.MetricsBindAddress,
Metrics: metricsserver.Options{BindAddress: opts.MetricsBindAddress},
MapperProvider: restmapper.MapperProvider,
BaseContext: func() context.Context {
return ctx
Expand Down
49 changes: 24 additions & 25 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ module github.com/karmada-io/multicluster-cloud-provider
go 1.19

require (
github.com/karmada-io/karmada v1.8.0
github.com/karmada-io/karmada v1.9.0-preview5.0.20240227142131-bc9316705c36
github.com/pkg/errors v0.9.1
github.com/spf13/cobra v1.7.0
github.com/spf13/pflag v1.0.5
k8s.io/api v0.27.8
k8s.io/apimachinery v0.27.8
k8s.io/client-go v0.27.8
k8s.io/component-base v0.27.8
k8s.io/klog/v2 v2.90.1
k8s.io/api v0.28.5
k8s.io/apimachinery v0.28.5
k8s.io/client-go v0.28.5
k8s.io/component-base v0.28.5
k8s.io/klog/v2 v2.100.1
k8s.io/utils v0.0.0-20230406110748-d93618cff8a2
sigs.k8s.io/controller-runtime v0.15.0
sigs.k8s.io/controller-runtime v0.16.3
sigs.k8s.io/mcs-api v0.1.0
)

Expand All @@ -25,18 +25,18 @@ require (
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emicklei/go-restful/v3 v3.10.2 // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-logr/zapr v1.2.4 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.1 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/gnostic v0.6.9 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/uuid v1.3.0 // indirect
Expand All @@ -48,40 +48,39 @@ require (
github.com/kr/text v0.2.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mitchellh/go-wordwrap v1.0.0 // indirect
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/moby/spdystream v0.2.0 // indirect
github.com/moby/term v0.0.0-20221205130635-1aeaba878587 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/prometheus/client_golang v1.16.0 // indirect
github.com/prometheus/client_model v0.4.0 // indirect
github.com/prometheus/common v0.42.0 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.10.1 // indirect
github.com/rogpeppe/go-internal v1.11.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/yuin/gopher-lua v0.0.0-20220504180219-658193537a64 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
go.uber.org/zap v1.24.0 // indirect
golang.org/x/net v0.17.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.25.0 // indirect
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/oauth2 v0.10.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/term v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/term v0.15.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.3.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.3.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 // indirect
google.golang.org/grpc v1.56.3 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiextensions-apiserver v0.27.8 // indirect
k8s.io/apiserver v0.27.8 // indirect
k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f // indirect
k8s.io/kubectl v0.27.8 // indirect
k8s.io/apiextensions-apiserver v0.28.5 // indirect
k8s.io/apiserver v0.28.5 // indirect
k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 // indirect
k8s.io/kubectl v0.28.5 // indirect
sigs.k8s.io/cluster-api v1.5.0 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
Expand Down
Loading

0 comments on commit 1492074

Please sign in to comment.