Skip to content

Commit

Permalink
add MultiClusterService featuregate
Browse files Browse the repository at this point in the history
Signed-off-by: changzhen <[email protected]>
  • Loading branch information
XiShanYongYe-Chang committed Nov 30, 2023
1 parent 68d937e commit beadcaf
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 458 deletions.
2 changes: 1 addition & 1 deletion artifacts/agent/karmada-agent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ spec:
- --cluster-status-update-frequency=10s
- --bind-address=0.0.0.0
- --secure-port=10357
- --feature-gates=CustomizedClusterResourceModeling=true
- --feature-gates=CustomizedClusterResourceModeling=true,MultiClusterService=true
- --v=4
livenessProbe:
httpGet:
Expand Down
2 changes: 1 addition & 1 deletion artifacts/deploy/karmada-controller-manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec:
- --secure-port=10357
- --failover-eviction-timeout=30s
- --controllers=*,hpaReplicasSyncer
- --feature-gates=PropagationPolicyPreemption=true
- --feature-gates=PropagationPolicyPreemption=true,MultiClusterService=true
- --v=4
livenessProbe:
httpGet:
Expand Down
4 changes: 4 additions & 0 deletions cmd/agent/app/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import (
"github.com/karmada-io/karmada/pkg/controllers/mcs"
"github.com/karmada-io/karmada/pkg/controllers/multiclusterservice"
"github.com/karmada-io/karmada/pkg/controllers/status"
"github.com/karmada-io/karmada/pkg/features"
karmadaclientset "github.com/karmada-io/karmada/pkg/generated/clientset/versioned"
"github.com/karmada-io/karmada/pkg/karmadactl/util/apiclient"
"github.com/karmada-io/karmada/pkg/metrics"
Expand Down Expand Up @@ -390,6 +391,9 @@ func startServiceExportController(ctx controllerscontext.Context) (bool, error)
}

func startEndpointSliceCollectController(ctx controllerscontext.Context) (enabled bool, err error) {
if !features.FeatureGate.Enabled(features.MultiClusterService) {
return false, nil
}
opts := ctx.Opts
endpointSliceCollectController := &multiclusterservice.EndpointSliceCollectController{
Client: ctx.Mgr.GetClient(),
Expand Down
9 changes: 9 additions & 0 deletions cmd/controller-manager/app/controllermanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,9 @@ func startServiceExportController(ctx controllerscontext.Context) (enabled bool,
}

func startEndpointSliceCollectController(ctx controllerscontext.Context) (enabled bool, err error) {
if !features.FeatureGate.Enabled(features.Failover) {
return false, nil
}
opts := ctx.Opts
endpointSliceCollectController := &multiclusterservice.EndpointSliceCollectController{
Client: ctx.Mgr.GetClient(),
Expand All @@ -483,6 +486,9 @@ func startEndpointSliceCollectController(ctx controllerscontext.Context) (enable
}

func startEndpointSliceDispatchController(ctx controllerscontext.Context) (enabled bool, err error) {
if !features.FeatureGate.Enabled(features.Failover) {
return false, nil
}
endpointSliceSyncController := &multiclusterservice.EndpointsliceDispatchController{
Client: ctx.Mgr.GetClient(),
EventRecorder: ctx.Mgr.GetEventRecorderFor(multiclusterservice.EndpointsliceDispatchControllerName),
Expand Down Expand Up @@ -668,6 +674,9 @@ func startHPAReplicasSyncerController(ctx controllerscontext.Context) (enabled b
}

func startMCSController(ctx controllerscontext.Context) (enabled bool, err error) {
if !features.FeatureGate.Enabled(features.MultiClusterService) {
return false, nil
}
mcsController := &multiclusterservice.MCSController{
Client: ctx.Mgr.GetClient(),
EventRecorder: ctx.Mgr.GetEventRecorderFor(multiclusterservice.ControllerName),
Expand Down
4 changes: 4 additions & 0 deletions pkg/features/features.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ const (

// PolicyPreemption indicates if high-priority PropagationPolicy/ClusterPropagationPolicy could preempt resource templates which are matched by low-priority PropagationPolicy/ClusterPropagationPolicy.
PolicyPreemption featuregate.Feature = "PropagationPolicyPreemption"

// MultiClusterService indicates if enable multi-cluster service function.
MultiClusterService featuregate.Feature = "MultiClusterService"
)

var (
Expand All @@ -50,6 +53,7 @@ var (
PropagateDeps: {Default: true, PreRelease: featuregate.Beta},
CustomizedClusterResourceModeling: {Default: true, PreRelease: featuregate.Beta},
PolicyPreemption: {Default: false, PreRelease: featuregate.Alpha},
MultiClusterService: {Default: false, PreRelease: featuregate.Alpha},
}
)

Expand Down
Loading

0 comments on commit beadcaf

Please sign in to comment.