in appconfigmgrv2/controllers/appenvconfigtemplatev2_controller.go [179:207]
func (r *AppEnvConfigTemplateV2Reconciler) SetupWithManager(mgr ctrl.Manager) error {
c := ctrl.NewControllerManagedBy(mgr).
For(&appconfigmgrv1alpha1.AppEnvConfigTemplateV2{}).
// Watch namespaces for enforcing opa constraints.
Watches(&source.Kind{Type: &corev1.Namespace{}}, &handler.EnqueueRequestForObject{}).
Owns(&corev1.Service{}).
Owns(&v1beta1.Ingress{}).
Owns(&netv1.NetworkPolicy{})
istioInstalled := true
for _, t := range istioTypes {
installed, err := r.resourceInstalled(context.Background(), t.Resource)
if err != nil {
return fmt.Errorf("checking if istio crd is installed: %v", err)
}
if !installed {
istioInstalled = false
break
}
}
log.Info("Determined istio installation status", "installed", istioInstalled)
if istioInstalled {
for _, t := range istioTypes {
c.Owns(gvkObject(t.Kind))
}
}
return c.Complete(r)
}