@@ -177,13 +177,13 @@ func (wh *IngressControllerWebhook) authorized(request admissionctl.Request) adm
177
177
}
178
178
179
179
/* TODO:
180
- * 1) ONLY check for privatelink clusters? How?
181
- * 2) HCP vs Classic, etc.. ...any other cluster type this should apply to? Is this handled by the
182
- * HypershiftEnabled vs ClassicEnabled flags set in this module? Currently HCP disabled.
183
- * If HCP is to be enabled for allowed source ranges, should this part of a 2nd ingress validator to
184
- * allow separation of validations between cluster install types? Is there a run time method available
185
- * to this validator to determine classic vs hcp?
186
- * 3) What other specifics should be checked here for this cidr check to be applicable?m
180
+ * - HypershiftEnabled is currently set to false/disabled.
181
+ * If HCP is to be enabled for allowed source ranges, should this part of a 2nd ingress validator to
182
+ * allow separation of validations between cluster install types? ...or if there's a reliable run time method available
183
+ * to this validator to determine classic vs hcp they can remain in the single webhook(?)
184
+ * - Classic vs HCP could likely share some of the network funcions, but will need slightly
185
+ * different logic as well as permissions fetching the network config info from different
186
+ * source (configmap) locations and config formats(?).
187
187
*/
188
188
// Only check for machine cidr in allowed ranges if creating or updating resource...
189
189
reqOp := request .AdmissionRequest .Operation
@@ -279,7 +279,7 @@ func (wh *IngressControllerWebhook) checkAllowsMachineCIDR(ipRanges []operatorv1
279
279
// Note: From docs it appears a missing ASR value/attr allows all. However...
280
280
// once ASR values have been added to an ingresscontroller, later deleting all the ASRs can expose an issue
281
281
// where the IGC will remaining in progressing state indefinitely.
282
- // For now return Allowed with a warning?
282
+ // For now return Allowed, but with a warning?
283
283
if ipRanges == nil || len (ipRanges ) <= 0 {
284
284
return admissionctl .Allowed ("Allowing empty 'AllowedSourceRanges'. Populate this value if operator remains in 'progressing' state" )
285
285
}
@@ -370,8 +370,12 @@ func NewWebhook() *IngressControllerWebhook {
370
370
log .Error (err , "Fail adding corev1 scheme to IngressControllerWebhook" )
371
371
os .Exit (1 )
372
372
}
373
- return & IngressControllerWebhook {
373
+ wh := & IngressControllerWebhook {
374
374
s : * scheme ,
375
375
kubeClient : nil ,
376
376
}
377
+ // Try to populate machine cidr at init. If this fails it will try again on the
378
+ // first update/create request involving the default ingress controller.
379
+ wh .getMachineCIDR ()
380
+ return wh
377
381
}
0 commit comments