Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optimize: make alibaba_cloud_slb controller optional #80

Merged
merged 4 commits into from
Aug 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These codes should be left.
AlibabaCloudSlb needs to be add in it with Default false.

AlibabaCloudSlb: {Default: false, PreRelease: featuregate.Alpha},
}

func init() {
Expand Down
Loading