Skip to content

Commit 438e8cd

Browse files
committed
Simplify fetching and checking for featuregate ManagedClusterAutoApproval
Signed-off-by: Jeffrey Wong <jeffreywong0417@gmail.com>
1 parent 0727737 commit 438e8cd

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

pkg/cmd/init/exec.go

+1-12
Original file line numberDiff line numberDiff line change
@@ -159,18 +159,7 @@ func (o *Options) validate() error {
159159
}
160160
}
161161

162-
featureGates := genericclioptionsclusteradm.ConvertToFeatureGateAPI(
163-
genericclioptionsclusteradm.HubMutableFeatureGate, ocmfeature.DefaultHubRegistrationFeatureGates)
164-
managedClusterAutoApprove := false
165-
for _, feature := range featureGates {
166-
if feature.Feature == "ManagedClusterAutoApproval" {
167-
if feature.Mode == "Enable" {
168-
managedClusterAutoApprove = true
169-
}
170-
}
171-
}
172-
173-
if managedClusterAutoApprove {
162+
if genericclioptionsclusteradm.HubMutableFeatureGate.Enabled("ManagedClusterAutoApproval") {
174163
// If hub registration does not accept awsirsa, we stop user if they also pass in a list of patterns for AWS EKS ARN.
175164

176165
if len(o.autoApprovedARNPatterns) > 0 && !sets.New[string](o.registrationDrivers...).Has("awsirsa") {

0 commit comments

Comments
 (0)