Skip to content

Commit f6735b5

Browse files
authored
Merge pull request #2579 from thejasn/feature/restrict-only-ingress
Added feature gate to restrict to only ingress resources
2 parents c1b9579 + f0e348e commit f6735b5

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

docs/deploy/configurations.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,3 +145,4 @@ They are a set of kye=value pairs that describe AWS load balance controller feat
145145
| WeightedTargetGroups | string | true | Enable or disable weighted target groups |
146146
| ServiceTypeLoadBalancerOnly | string | false | If enabled, controller will be limited to reconciling service of type `LoadBalancer`|
147147
| EndpointsFailOpen | string | false | Enable or disable allowing endpoints with `ready:unknown` state in the target groups. |
148+
| EnableServiceController | string | true | Toggles support for `Service` type resources. |

main.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,15 @@ 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+
130+
// Setup service reconciler only if AllowServiceType is set to true.
131+
if controllerCFG.FeatureGates.Enabled(config.EnableServiceController) {
132+
if err = svcReconciler.SetupWithManager(ctx, mgr); err != nil {
133+
setupLog.Error(err, "Unable to create controller", "controller", "Service")
134+
os.Exit(1)
135+
}
132136
}
137+
133138
if err := tgbReconciler.SetupWithManager(ctx, mgr); err != nil {
134139
setupLog.Error(err, "unable to create controller", "controller", "TargetGroupBinding")
135140
os.Exit(1)

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)