@@ -255,34 +255,45 @@ func semanticIngressEquals(desired, existing *netv1.Ingress) bool {
255
255
}
256
256
257
257
func (r * RawIngressReconciler ) Reconcile (isvc * v1beta1api.InferenceService ) error {
258
- ingress , err := createRawIngress (r .scheme , isvc , r .ingressConfig , r .client )
259
- if ingress == nil {
260
- return nil
258
+ var err error
259
+ isInternal := false
260
+ // disable ingress creation if service is labelled with cluster local or kserve domain is cluster local
261
+ if val , ok := isvc .Labels [constants .NetworkVisibility ]; ok && val == constants .ClusterLocalVisibility {
262
+ isInternal = true
261
263
}
262
- if err != nil {
263
- return err
264
+ if r . ingressConfig . IngressDomain == constants . ClusterLocalDomain {
265
+ isInternal = true
264
266
}
265
- //reconcile ingress
266
- existingIngress := & netv1.Ingress {}
267
- err = r .client .Get (context .TODO (), types.NamespacedName {
268
- Namespace : isvc .Namespace ,
269
- Name : isvc .Name ,
270
- }, existingIngress )
271
- if err != nil {
272
- if apierr .IsNotFound (err ) {
273
- err = r .client .Create (context .TODO (), ingress )
274
- log .Info ("creating ingress" , "ingressName" , isvc .Name , "err" , err )
275
- } else {
267
+ if ! isInternal {
268
+ ingress , err := createRawIngress (r .scheme , isvc , r .ingressConfig , r .client )
269
+ if ingress == nil {
270
+ return nil
271
+ }
272
+ if err != nil {
276
273
return err
277
274
}
278
- } else {
279
- if ! semanticIngressEquals (ingress , existingIngress ) {
280
- err = r .client .Update (context .TODO (), ingress )
281
- log .Info ("updating ingress" , "ingressName" , isvc .Name , "err" , err )
275
+ //reconcile ingress
276
+ existingIngress := & netv1.Ingress {}
277
+ err = r .client .Get (context .TODO (), types.NamespacedName {
278
+ Namespace : isvc .Namespace ,
279
+ Name : isvc .Name ,
280
+ }, existingIngress )
281
+ if err != nil {
282
+ if apierr .IsNotFound (err ) {
283
+ err = r .client .Create (context .TODO (), ingress )
284
+ log .Info ("creating ingress" , "ingressName" , isvc .Name , "err" , err )
285
+ } else {
286
+ return err
287
+ }
288
+ } else {
289
+ if ! semanticIngressEquals (ingress , existingIngress ) {
290
+ err = r .client .Update (context .TODO (), ingress )
291
+ log .Info ("updating ingress" , "ingressName" , isvc .Name , "err" , err )
292
+ }
293
+ }
294
+ if err != nil {
295
+ return err
282
296
}
283
- }
284
- if err != nil {
285
- return err
286
297
}
287
298
isvc .Status .URL , err = createRawURL (isvc , r .ingressConfig )
288
299
if err != nil {
0 commit comments