@@ -171,36 +171,34 @@ func main() {
171
171
kubeConfig .QPS = ptr .Deref (cfg .ClientConnection .QPS , rest .DefaultQPS )
172
172
setupLog .V (2 ).Info ("REST client" , "qps" , kubeConfig .QPS , "burst" , kubeConfig .Burst )
173
173
174
- selector , err := labels .Parse (controllers .RayClusterNameLabel )
175
- exitOnError (err , "unable to parse label selector" )
176
-
177
- cacheOpts := cache.Options {
178
- ByObject : map [client.Object ]cache.ByObject {
179
- & corev1.Secret {}: {
180
- Label : selector ,
181
- },
182
- & corev1.Service {}: {
183
- Label : selector ,
184
- },
185
- & corev1.ServiceAccount {}: {
186
- Label : selector ,
187
- },
188
- & networkingv1.Ingress {}: {
189
- Label : selector ,
190
- },
191
- & networkingv1.NetworkPolicy {}: {
192
- Label : selector ,
193
- },
194
- & rbacv1.ClusterRoleBinding {}: {
195
- Label : selector ,
196
- },
197
- },
198
- }
199
-
200
- if isOpenShift (ctx , kubeClient .DiscoveryClient ) {
201
- cacheOpts .ByObject [& routev1.Route {}] = cache.ByObject {
174
+ cacheOpts := cache.Options {}
175
+ if cfg .AppWrapper == nil || ! ptr .Deref (cfg .AppWrapper .Enabled , false ) {
176
+ selector , err := labels .Parse (controllers .RayClusterNameLabel )
177
+ exitOnError (err , "unable to parse label selector" )
178
+ cacheOpts .ByObject = make (map [client.Object ]cache.ByObject , 7 )
179
+ cacheOpts .ByObject [& corev1.Secret {}] = cache.ByObject {
180
+ Label : selector ,
181
+ }
182
+ cacheOpts .ByObject [& corev1.Service {}] = cache.ByObject {
183
+ Label : selector ,
184
+ }
185
+ cacheOpts .ByObject [& corev1.ServiceAccount {}] = cache.ByObject {
186
+ Label : selector ,
187
+ }
188
+ cacheOpts .ByObject [& networkingv1.Ingress {}] = cache.ByObject {
202
189
Label : selector ,
203
190
}
191
+ cacheOpts .ByObject [& networkingv1.NetworkPolicy {}] = cache.ByObject {
192
+ Label : selector ,
193
+ }
194
+ cacheOpts .ByObject [& rbacv1.ClusterRoleBinding {}] = cache.ByObject {
195
+ Label : selector ,
196
+ }
197
+ if isOpenShift (ctx , kubeClient .DiscoveryClient ) {
198
+ cacheOpts .ByObject [& routev1.Route {}] = cache.ByObject {
199
+ Label : selector ,
200
+ }
201
+ }
204
202
}
205
203
206
204
mgr , err := ctrl .NewManager (kubeConfig , ctrl.Options {
0 commit comments