Skip to content

Added feature gate "EnableServiceController" to restrict to only ingress resources #8

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

Merged
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
3 changes: 2 additions & 1 deletion docs/deploy/configurations.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,5 @@ They are a set of kye=value pairs that describe AWS load balance controller feat
|---------------------------------------|---------------------------------|-----------------|-------------|
| ListenerRulesTagging | string | true | Enable or disable tagging AWS load balancer listeners and rules |
| WeightedTargetGroups | string | true | Enable or disable weighted target groups |
| ServiceTypeLoadBalancerOnly | string | false | If enabled, controller will be limited to reconciling service of type `LoadBalancer`|
| ServiceTypeLoadBalancerOnly | string | false | If enabled, controller will be limited to reconciling service of type `LoadBalancer`|
| EnableServiceController | string | true | Toggles support for `Service` type resources. |
9 changes: 6 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,12 @@ func main() {
setupLog.Error(err, "unable to create controller", "controller", "Ingress")
os.Exit(1)
}
if err = svcReconciler.SetupWithManager(ctx, mgr); err != nil {
setupLog.Error(err, "Unable to create controller", "controller", "Service")
os.Exit(1)
// Setup service reconciler only if EnableServiceController is set to true.
if controllerCFG.FeatureGates.Enabled(config.EnableServiceController) {
if err = svcReconciler.SetupWithManager(ctx, mgr); err != nil {
setupLog.Error(err, "Unable to create controller", "controller", "Service")
os.Exit(1)
}
}
if err := tgbReconciler.SetupWithManager(ctx, mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "TargetGroupBinding")
Expand Down
2 changes: 2 additions & 0 deletions pkg/config/feature_gates.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const (
WeightedTargetGroups Feature = "WeightedTargetGroups"
ServiceTypeLoadBalancerOnly Feature = "ServiceTypeLoadBalancerOnly"
EndpointsFailOpen Feature = "EndpointsFailOpen"
EnableServiceController Feature = "EnableServiceController"
)

type FeatureGates interface {
Expand Down Expand Up @@ -45,6 +46,7 @@ func NewFeatureGates() FeatureGates {
WeightedTargetGroups: true,
ServiceTypeLoadBalancerOnly: false,
EndpointsFailOpen: false,
EnableServiceController: true,
},
}
}
Expand Down