Skip to content

Commit

Permalink
optimize: make alibaba_cloud_slb controller optional (#80)
Browse files Browse the repository at this point in the history
* optimize: make alibaba_cloud_slb controller optional
  • Loading branch information
WeichengWang1 committed Aug 31, 2023
1 parent 55052b3 commit 8a081ee
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
5 changes: 5 additions & 0 deletions pkg/controllers/add_alibaba_cloud_slb.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,18 @@ import (

"kusionstack.io/kafed/pkg/controllers/alibaba_cloud_slb"
"kusionstack.io/kafed/pkg/controllers/resourceconsist"
"kusionstack.io/kafed/pkg/features"
"kusionstack.io/kafed/pkg/utils/feature"
)

func init() {
AddToManagerFuncs = append(AddToManagerFuncs, Add)
}

func Add(manager manager.Manager) error {
if !feature.DefaultFeatureGate.Enabled(features.AlibabaCloudSlb) {
return nil
}
reconcileAdapter, err := alibaba_cloud_slb.NewReconcileAdapter(manager.GetClient())
if err != nil {
return err
Expand Down
6 changes: 1 addition & 5 deletions pkg/controllers/add_podopslifecycle.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,8 @@ package controllers

import (
"kusionstack.io/kafed/pkg/controllers/podopslifecycle"
"kusionstack.io/kafed/pkg/features"
"kusionstack.io/kafed/pkg/utils/feature"
)

func init() {
if feature.DefaultFeatureGate.Enabled(features.PodOpsLifecycle) {
AddToManagerFuncs = append(AddToManagerFuncs, podopslifecycle.Add)
}
AddToManagerFuncs = append(AddToManagerFuncs, podopslifecycle.Add)
}
6 changes: 3 additions & 3 deletions pkg/features/features.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ import (
)

const (
// PodOpsLifecycle enables the PodOpsLifecycle controller.
PodOpsLifecycle featuregate.Feature = "PodOpsLifecycle"
// AlibabaCloudSlb enables the alibaba_cloud_slb controller.
AlibabaCloudSlb featuregate.Feature = "AlibabaCloudSlb"
)

var defaultFeatureGates = map[featuregate.Feature]featuregate.FeatureSpec{
PodOpsLifecycle: {Default: true, PreRelease: featuregate.Alpha},
AlibabaCloudSlb: {Default: false, PreRelease: featuregate.Alpha},
}

func init() {
Expand Down

0 comments on commit 8a081ee

Please sign in to comment.