Skip to content

Commit f175872

Browse files
authored
UPSTREAM: 2579: added EnableServiceController feature gate to controller (#8)
Signed-off-by: thejasn <[email protected]>
1 parent cd5728e commit f175872

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

docs/deploy/configurations.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,4 +143,5 @@ They are a set of kye=value pairs that describe AWS load balance controller feat
143143
|---------------------------------------|---------------------------------|-----------------|-------------|
144144
| ListenerRulesTagging | string | true | Enable or disable tagging AWS load balancer listeners and rules |
145145
| WeightedTargetGroups | string | true | Enable or disable weighted target groups |
146-
| ServiceTypeLoadBalancerOnly | string | false | If enabled, controller will be limited to reconciling service of type `LoadBalancer`|
146+
| ServiceTypeLoadBalancerOnly | string | false | If enabled, controller will be limited to reconciling service of type `LoadBalancer`|
147+
| EnableServiceController | string | true | Toggles support for `Service` type resources. |

main.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,12 @@ func main() {
126126
setupLog.Error(err, "unable to create controller", "controller", "Ingress")
127127
os.Exit(1)
128128
}
129-
if err = svcReconciler.SetupWithManager(ctx, mgr); err != nil {
130-
setupLog.Error(err, "Unable to create controller", "controller", "Service")
131-
os.Exit(1)
129+
// Setup service reconciler only if EnableServiceController is set to true.
130+
if controllerCFG.FeatureGates.Enabled(config.EnableServiceController) {
131+
if err = svcReconciler.SetupWithManager(ctx, mgr); err != nil {
132+
setupLog.Error(err, "Unable to create controller", "controller", "Service")
133+
os.Exit(1)
134+
}
132135
}
133136
if err := tgbReconciler.SetupWithManager(ctx, mgr); err != nil {
134137
setupLog.Error(err, "unable to create controller", "controller", "TargetGroupBinding")

pkg/config/feature_gates.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const (
1414
WeightedTargetGroups Feature = "WeightedTargetGroups"
1515
ServiceTypeLoadBalancerOnly Feature = "ServiceTypeLoadBalancerOnly"
1616
EndpointsFailOpen Feature = "EndpointsFailOpen"
17+
EnableServiceController Feature = "EnableServiceController"
1718
)
1819

1920
type FeatureGates interface {
@@ -45,6 +46,7 @@ func NewFeatureGates() FeatureGates {
4546
WeightedTargetGroups: true,
4647
ServiceTypeLoadBalancerOnly: false,
4748
EndpointsFailOpen: false,
49+
EnableServiceController: true,
4850
},
4951
}
5052
}

0 commit comments

Comments
 (0)