diff --git a/deploy/role.yaml b/deploy/role.yaml index 988d844b60..27692b0c6e 100644 --- a/deploy/role.yaml +++ b/deploy/role.yaml @@ -61,6 +61,12 @@ rules: - routes/custom-host verbs: - create +- apiGroups: + - networking.k8s.io + resources: + - ingresses + verbs: + - '*' - apiGroups: - template.openshift.io resources: @@ -84,4 +90,3 @@ rules: - update - create - delete - diff --git a/pkg/controller/hawtio/hawtio_controller.go b/pkg/controller/hawtio/hawtio_controller.go index 45153b685d..70f5e5ed2d 100644 --- a/pkg/controller/hawtio/hawtio_controller.go +++ b/pkg/controller/hawtio/hawtio_controller.go @@ -157,14 +157,14 @@ func add(mgr manager.Manager, r reconcile.Reconciler, routeSupport bool) error { if err != nil { return errs.Wrap(err, "Failed to create watch for Route resource") } - } - - err = c.Watch(&source.Kind{Type: &networkingv1.Ingress{}}, &handler.EnqueueRequestForOwner{ - IsController: true, - OwnerType: &hawtiov1.Hawtio{}, - }) - if err != nil { - return errs.Wrap(err, "Failed to create watch for Ingress resource") + } else { + err = c.Watch(&source.Kind{Type: &networkingv1.Ingress{}}, &handler.EnqueueRequestForOwner{ + IsController: true, + OwnerType: &hawtiov1.Hawtio{}, + }) + if err != nil { + return errs.Wrap(err, "Failed to create watch for Ingress resource") + } } err = c.Watch(&source.Kind{Type: &appsv1.Deployment{}}, &handler.EnqueueRequestForOwner{